File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public function onKernelRequest(GetResponseEvent $event)
8383
8484 $ token = $ this ->tokenStorage ->getToken ();
8585
86- if (null !== $ token && $ this ->authorizationChecker ->isGranted (AuthenticatedVoter::IS_AUTHENTICATED_REMEMBERED )) {
86+ if (null !== $ token && $ token -> isAuthenticated () && $ this ->authorizationChecker ->isGranted (AuthenticatedVoter::IS_AUTHENTICATED_REMEMBERED )) {
8787 $ this ->setUserValue ($ token ->getUser ());
8888
8989 $ contextEvent = new SentryUserContextEvent ($ token );
Original file line number Diff line number Diff line change @@ -260,6 +260,11 @@ public function test_that_username_is_set_from_user_interface_if_token_present_a
260260 ->willReturn ($ user )
261261 ;
262262
263+ $ mockToken
264+ ->method ('isAuthenticated ' )
265+ ->willReturn (true )
266+ ;
267+
263268 $ mockEvent = $ this ->createMock (GetResponseEvent::class);
264269
265270 $ mockEvent
@@ -311,6 +316,11 @@ public function test_that_username_is_set_from_user_interface_if_token_present_a
311316 ->willReturn ('some_user ' )
312317 ;
313318
319+ $ mockToken
320+ ->method ('isAuthenticated ' )
321+ ->willReturn (true )
322+ ;
323+
314324 $ mockEvent = $ this ->createMock (GetResponseEvent::class);
315325
316326 $ mockEvent
@@ -370,6 +380,11 @@ public function test_that_username_is_set_from_user_interface_if_token_present_a
370380 ->willReturn ($ mockUser )
371381 ;
372382
383+ $ mockToken
384+ ->method ('isAuthenticated ' )
385+ ->willReturn (true )
386+ ;
387+
373388 $ mockEvent = $ this ->createMock (GetResponseEvent::class);
374389
375390 $ mockEvent
You can’t perform that action at this time.
0 commit comments