@@ -83,7 +83,7 @@ public function authenticateUser(UserInterface $user, AuthenticatorInterface $au
83
83
$ token = $ this ->eventDispatcher ->dispatch (new AuthenticationTokenCreatedEvent ($ token , $ passport ))->getAuthenticatedToken ();
84
84
85
85
// authenticate this in the system
86
- return $ this ->handleAuthenticationSuccess ($ token , $ passport , $ request , $ authenticator );
86
+ return $ this ->handleAuthenticationSuccess ($ token , $ passport , $ request , $ authenticator, $ this -> tokenStorage -> getToken () );
87
87
}
88
88
89
89
public function supports (Request $ request ): ?bool
@@ -165,6 +165,7 @@ private function executeAuthenticators(array $authenticators, Request $request):
165
165
private function executeAuthenticator (AuthenticatorInterface $ authenticator , Request $ request ): ?Response
166
166
{
167
167
$ passport = null ;
168
+ $ previousToken = $ this ->tokenStorage ->getToken ();
168
169
169
170
try {
170
171
// get the passport from the Authenticator
@@ -213,7 +214,7 @@ private function executeAuthenticator(AuthenticatorInterface $authenticator, Req
213
214
}
214
215
215
216
// success! (sets the token on the token storage, etc)
216
- $ response = $ this ->handleAuthenticationSuccess ($ authenticatedToken , $ passport , $ request , $ authenticator );
217
+ $ response = $ this ->handleAuthenticationSuccess ($ authenticatedToken , $ passport , $ request , $ authenticator, $ previousToken );
217
218
if ($ response instanceof Response) {
218
219
return $ response ;
219
220
}
@@ -223,7 +224,7 @@ private function executeAuthenticator(AuthenticatorInterface $authenticator, Req
223
224
return null ;
224
225
}
225
226
226
- private function handleAuthenticationSuccess (TokenInterface $ authenticatedToken , Passport $ passport , Request $ request , AuthenticatorInterface $ authenticator ): ?Response
227
+ private function handleAuthenticationSuccess (TokenInterface $ authenticatedToken , Passport $ passport , Request $ request , AuthenticatorInterface $ authenticator, ? TokenInterface $ previousToken ): ?Response
227
228
{
228
229
$ this ->tokenStorage ->setToken ($ authenticatedToken );
229
230
@@ -233,7 +234,7 @@ private function handleAuthenticationSuccess(TokenInterface $authenticatedToken,
233
234
$ this ->eventDispatcher ->dispatch ($ loginEvent , SecurityEvents::INTERACTIVE_LOGIN );
234
235
}
235
236
236
- $ this ->eventDispatcher ->dispatch ($ loginSuccessEvent = new LoginSuccessEvent ($ authenticator , $ passport , $ authenticatedToken , $ request , $ response , $ this ->firewallName ));
237
+ $ this ->eventDispatcher ->dispatch ($ loginSuccessEvent = new LoginSuccessEvent ($ authenticator , $ passport , $ authenticatedToken , $ request , $ response , $ this ->firewallName , $ previousToken ));
237
238
238
239
return $ loginSuccessEvent ->getResponse ();
239
240
}
0 commit comments