[Security] Fix BC break introduces in #10694
This commit is contained in:
parent
c06e7546ad
commit
b2183aa2b5
@ -58,8 +58,8 @@
|
|||||||
<tag name="monolog.logger" channel="security" />
|
<tag name="monolog.logger" channel="security" />
|
||||||
<argument type="service" id="security.context" />
|
<argument type="service" id="security.context" />
|
||||||
<argument /> <!-- Key -->
|
<argument /> <!-- Key -->
|
||||||
<argument type="service" id="security.authentication.manager" />
|
|
||||||
<argument type="service" id="logger" on-invalid="null" />
|
<argument type="service" id="logger" on-invalid="null" />
|
||||||
|
<argument type="service" id="security.authentication.manager" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="security.authentication.provider.anonymous" class="%security.authentication.provider.anonymous.class%" public="false">
|
<service id="security.authentication.provider.anonymous" class="%security.authentication.provider.anonymous.class%" public="false">
|
||||||
|
@ -31,7 +31,7 @@ class AnonymousAuthenticationListener implements ListenerInterface
|
|||||||
private $authenticationManager;
|
private $authenticationManager;
|
||||||
private $logger;
|
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->context = $context;
|
||||||
$this->key = $key;
|
$this->key = $key;
|
||||||
@ -51,7 +51,10 @@ class AnonymousAuthenticationListener implements ListenerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
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);
|
$this->context->setToken($token);
|
||||||
|
|
||||||
if (null !== $this->logger) {
|
if (null !== $this->logger) {
|
||||||
|
Reference in New Issue
Block a user