File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/Symfony/Component/Security/Http/Firewall Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 21
21
use Symfony \Component \Security \Core \Exception \AuthenticationException ;
22
22
use Symfony \Component \Security \Http \Authentication \AuthenticationFailureHandlerInterface ;
23
23
use Symfony \Component \Security \Http \Authentication \AuthenticationSuccessHandlerInterface ;
24
- use Symfony \Component \Security \Core \Authentication \Token \TokenInterface ;
25
24
26
25
/**
27
26
* SimplePreAuthenticationListener implements simple proxying to an authenticator.
@@ -76,13 +75,15 @@ public function handle(GetResponseEvent $event)
76
75
}
77
76
78
77
try {
79
- $ this ->securityContext ->setToken (null );
80
78
$ token = $ this ->simpleAuthenticator ->createToken ($ request , $ this ->providerKey );
81
79
82
- if ( $ token instanceof TokenInterface) {
83
- $ token = $ this -> authenticationManager -> authenticate ( $ token );
84
- $ this -> securityContext -> setToken ( $ token ) ;
80
+ // allow null to be returned to skip authentication
81
+ if ( null === $ token ) {
82
+ return ;
85
83
}
84
+
85
+ $ token = $ this ->authenticationManager ->authenticate ($ token );
86
+ $ this ->securityContext ->setToken ($ token );
86
87
} catch (AuthenticationException $ e ) {
87
88
$ this ->securityContext ->setToken (null );
88
89
You can’t perform that action at this time.
0 commit comments