You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removed AnonymousToken from the authenticator system
* Anonymous users are actual to unauthenticated users, both are now represented by no token
* Added a PUBLIC_ACCESS Security attribute to be used in access_control
* Deprecated "anonymous: lazy" in favor of "lazy: true"
thrownewAuthenticationCredentialsNotFoundException('A Token was not found in the TokenStorage.');
68
72
}
69
73
@@ -76,8 +80,26 @@ public function authenticate(RequestEvent $event)
76
80
return;
77
81
}
78
82
79
-
if ($eventinstanceof LazyResponseEvent && null === $token = $this->tokenStorage->getToken()) {
80
-
thrownewAuthenticationCredentialsNotFoundException('A Token was not found in the TokenStorage.');
83
+
if ($eventinstanceof LazyResponseEvent) {
84
+
$token = $this->tokenStorage->getToken();
85
+
}
86
+
87
+
if (null === $token) {
88
+
if ($this->exceptionOnNoToken) {
89
+
thrownewAuthenticationCredentialsNotFoundException('A Token was not found in the TokenStorage.');
90
+
}
91
+
92
+
if ([AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY] === $attributes) {
93
+
trigger_deprecation('symfony/security-http', '5.1', 'Using "IS_AUTHENTICATED_ANONYMOUSLY" in your access_control rules when using the authenticator Security system is deprecated, use "PUBLIC_ACCESS" instead.');
Copy file name to clipboardExpand all lines: Firewall/ExceptionListener.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -144,7 +144,9 @@ private function handleAccessDeniedException(ExceptionEvent $event, AccessDenied
144
144
145
145
try {
146
146
$insufficientAuthenticationException = newInsufficientAuthenticationException('Full authentication is required to access this resource.', 0, $exception);
0 commit comments