Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d02addb

Browse files
committed
minor #12049 [Security] Fix BC break introduced in #10694 (romainneutron)
This PR was merged into the 2.6-dev branch. Discussion ---------- [Security] Fix BC break introduced in #10694 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #12034 | License | MIT Not sure about this fix, @stof 'ing welcome Commits ------- b2183aa [Security] Fix BC break introduces in #10694
2 parents db3e451 + b2183aa commit d02addb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
<tag name="monolog.logger" channel="security" />
5959
<argument type="service" id="security.context" />
6060
<argument /> <!-- Key -->
61-
<argument type="service" id="security.authentication.manager" />
6261
<argument type="service" id="logger" on-invalid="null" />
62+
<argument type="service" id="security.authentication.manager" />
6363
</service>
6464

6565
<service id="security.authentication.provider.anonymous" class="%security.authentication.provider.anonymous.class%" public="false">

src/Symfony/Component/Security/Http/Firewall/AnonymousAuthenticationListener.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AnonymousAuthenticationListener implements ListenerInterface
3131
private $authenticationManager;
3232
private $logger;
3333

34-
public function __construct(SecurityContextInterface $context, $key, AuthenticationManagerInterface $authenticationManager, LoggerInterface $logger = null)
34+
public function __construct(SecurityContextInterface $context, $key, LoggerInterface $logger = null, AuthenticationManagerInterface $authenticationManager = null)
3535
{
3636
$this->context = $context;
3737
$this->key = $key;
@@ -51,7 +51,10 @@ public function handle(GetResponseEvent $event)
5151
}
5252

5353
try {
54-
$token = $this->authenticationManager->authenticate(new AnonymousToken($this->key, 'anon.', array()));
54+
if (null !== $this->authenticationManager) {
55+
$token = $this->authenticationManager->authenticate(new AnonymousToken($this->key, 'anon.', array()));
56+
}
57+
5558
$this->context->setToken($token);
5659

5760
if (null !== $this->logger) {

0 commit comments

Comments
 (0)