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
trigger_deprecation('symfony/security-core', '5.4', 'Method "%s()" is deprecated. In version 6.0, security tokens won\'t have an "authenticated" flag anymore and will always be considered authenticated.', __METHOD__);
138
+
}
139
+
128
140
return$this->authenticated;
129
141
}
130
142
@@ -133,6 +145,10 @@ public function isAuthenticated()
trigger_deprecation('symfony/security-core', '5.4', 'Method "%s()" is deprecated. In version 6.0, security tokens won\'t have an "authenticated" state anymore and will always be considered as authenticated.', __METHOD__);
150
+
}
151
+
136
152
$this->authenticated = $authenticated;
137
153
}
138
154
@@ -275,6 +291,9 @@ final public function unserialize($serialized)
Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Token/NullToken.php
+10
Original file line number
Diff line number
Diff line change
@@ -53,11 +53,21 @@ public function getUserIdentifier(): string
53
53
return'';
54
54
}
55
55
56
+
/**
57
+
* @deprecated since Symfony 5.4
58
+
*/
56
59
publicfunctionisAuthenticated()
57
60
{
61
+
if (0 === \func_num_args() || func_get_arg(0)) {
62
+
trigger_deprecation('symfony/security-core', '5.4', 'Method "%s()" is deprecated. In version 6.0, security tokens won\'t have an "authenticated" flag anymore and will always be considered authenticated.', __METHOD__);
Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/AuthorizationChecker.php
+6-1
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,12 @@ final public function isGranted($attribute, $subject = null): bool
62
62
63
63
$token = newNullToken();
64
64
} else {
65
-
if ($this->alwaysAuthenticate || !$token->isAuthenticated()) {
65
+
$authenticated = true;
66
+
// @deprecated since Symfony 5.4
67
+
if ($this->alwaysAuthenticate || !$authenticated = $token->isAuthenticated(false)) {
68
+
if (!($authenticated ?? true)) {
69
+
trigger_deprecation('symfony/core', '5.4', 'Returning false from "%s()" is deprecated and won\'t have any effect in Symfony 6.0 as security tokens will always be considered authenticated.');
0 commit comments