Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 273a924

Browse filesBrowse files
committed
[Security] Deprecate the is_anonymous() expression function
1 parent 7941860 commit 273a924
Copy full SHA for 273a924

File tree

3 files changed

+9
-7
lines changed
Filter options

3 files changed

+9
-7
lines changed

‎UPGRADE-5.4.md

Copy file name to clipboardExpand all lines: UPGRADE-5.4.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ Security
6161

6262
* Deprecate `AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY` and `AuthenticatedVoter::IS_ANONYMOUS`,
6363
use `AuthenticatedVoter::IS_AUTHENTICATED_FULLY` or `AuthenticatedVoter::IS_AUTHENTICATED` instead.
64-
* Deprecate `AuthenticationTrustResolverInterface::isAnonymous()` as anonymous no longer exists
65-
in version 6, use the `isFullFledged()` or the new `isAuthenticated()` instead if you want to
66-
check if the request is (fully) authenticated.
64+
* Deprecate `AuthenticationTrustResolverInterface::isAnonymous()` and the `is_anonymous()` expression function
65+
as anonymous no longer exists in version 6, use the `isFullFledged()` or the new `isAuthenticated()` instead
66+
if you want to check if the request is (fully) authenticated.
6767
* Deprecate the `$authManager` argument of `AccessListener`
6868
* Deprecate the `$authenticationManager` argument of the `AuthorizationChecker` constructor
6969
* Deprecate setting the `$alwaysAuthenticate` argument to `true` and not setting the

‎src/Symfony/Component/Security/Core/Authorization/ExpressionLanguageProvider.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/ExpressionLanguageProvider.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ public function getFunctions()
2626
{
2727
return [
2828
new ExpressionFunction('is_anonymous', function () {
29-
return '$token && $auth_checker->isGranted("IS_ANONYMOUS")';
29+
return 'trigger_deprecation("symfony/security-core", "5.4", "The \"is_anonymous()\" expression function is deprecated.") || ($token && $auth_checker->isGranted("IS_ANONYMOUS"))';
3030
}, function (array $variables) {
31+
trigger_deprecation('symfony/security-core', '5.4', 'The "is_anonymous()" expression function is deprecated.');
32+
3133
return $variables['token'] && $variables['auth_checker']->isGranted('IS_ANONYMOUS');
3234
}),
3335

‎src/Symfony/Component/Security/Core/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/CHANGELOG.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ CHANGELOG
66

77
* Deprecate `AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY` and `AuthenticatedVoter::IS_ANONYMOUS`,
88
use `AuthenticatedVoter::IS_AUTHENTICATED_FULLY` or `AuthenticatedVoter::IS_AUTHENTICATED` instead.
9-
* Deprecate `AuthenticationTrustResolverInterface::isAnonymous()` as anonymous no longer exists
10-
in version 6, use the `isFullFledged()` or the new `isAuthenticated()` instead if you want to
11-
check if the request is (fully) authenticated.
9+
* Deprecate `AuthenticationTrustResolverInterface::isAnonymous()` and the `is_anonymous()` expression
10+
function as anonymous no longer exists in version 6, use the `isFullFledged()` or the new
11+
`isAuthenticated()` instead if you want to check if the request is (fully) authenticated.
1212
* Deprecate the `$authenticationManager` argument of the `AuthorizationChecker` constructor
1313
* Deprecate setting the `$alwaysAuthenticate` argument to `true` and not setting the
1414
`$exceptionOnNoToken` argument to `false` of `AuthorizationChecker`

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.