[Security] Fix BC break introduces in #10694

This commit is contained in:
Romain Neutron 2014-09-26 11:21:57 +02:00
parent c06e7546ad
commit b2183aa2b5
2 changed files with 6 additions and 3 deletions

View File

@ -58,8 +58,8 @@
<tag name="monolog.logger" channel="security" />
<argument type="service" id="security.context" />
<argument /> <!-- Key -->
<argument type="service" id="security.authentication.manager" />
<argument type="service" id="logger" on-invalid="null" />
<argument type="service" id="security.authentication.manager" />
</service>
<service id="security.authentication.provider.anonymous" class="%security.authentication.provider.anonymous.class%" public="false">

View File

@ -31,7 +31,7 @@ class AnonymousAuthenticationListener implements ListenerInterface
private $authenticationManager;
private $logger;
public function __construct(SecurityContextInterface $context, $key, AuthenticationManagerInterface $authenticationManager, LoggerInterface $logger = null)
public function __construct(SecurityContextInterface $context, $key, LoggerInterface $logger = null, AuthenticationManagerInterface $authenticationManager = null)
{
$this->context = $context;
$this->key = $key;
@ -51,7 +51,10 @@ class AnonymousAuthenticationListener implements ListenerInterface
}
try {
$token = $this->authenticationManager->authenticate(new AnonymousToken($this->key, 'anon.', array()));
if (null !== $this->authenticationManager) {
$token = $this->authenticationManager->authenticate(new AnonymousToken($this->key, 'anon.', array()));
}
$this->context->setToken($token);
if (null !== $this->logger) {