8000 Deprecated IS_AUTHENTICATED_REMEMBERED in favor of IS_REMEMBERED · symfony/symfony@0d888e5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d888e5

Browse files
committed
Deprecated IS_AUTHENTICATED_REMEMBERED in favor of IS_REMEMBERED
1 parent 5e60040 commit 0d888e5

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

UPGRADE-5.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ Security
346346
* Classes implementing the `TokenInterface` must implement the two new methods
347347
`__serialize` and `__unserialize`
348348
* The `IS_AUTHENTICATED_ANONYMOUSLY` attribute is removed, use `IS_AUTHENTICATED` instead.
349+
* The `IS_AUTHENTICATED_REMEMBERED` attribute is removed, use `IS_REMEMBERED` instead.
349350

350351
SecurityBundle
351352
--------------

src/Symfony/Component/Security/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ CHANGELOG
2424
* Deprecated `Argon2iPasswordEncoder`, use `SodiumPasswordEncoder` instead
2525
* Deprecated `BCryptPasswordEncoder`, use `NativePasswordEncoder` instead
2626
* Deprecated `IS_AUTHENTICATED_ANONYMOUSLY` in favor of `IS_AUTHENTICATED`
27+
* Deprecated `IS_AUTHENTICATED_REMEMBERED` in favor of `IS_REMEMBERED`
2728
* Added `IS_ANONYMOUS`
2829

2930
4.2.0

src/Symfony/Component/Security/Core/Authorization/Voter/AuthenticatedVoter.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ class AuthenticatedVoter implements VoterInterface
2828
{
2929
const IS_AUTHENTICATED = 'IS_AUTHENTICATED';
3030
const IS_AUTHENTICATED_FULLY = 'IS_AUTHENTICATED_FULLY';
31-
const IS_AUTHENTICATED_REMEMBERED = 'IS_AUTHENTICATED_REMEMBERED';
3231
const IS_ANONYMOUS = 'IS_ANONYMOUS';
3332
const IS_IMPERSONATOR = 'IS_IMPERSONATOR';
33+
const IS_REMEMBERED = 'IS_REMEMBERED';
3434
/** @deprecated since 4.3 */
3535
const IS_AUTHENTICATED_ANONYMOUSLY = 'IS_AUTHENTICATED_ANONYMOUSLY';
36+
/** @deprecated since 4.3 */
37+
const IS_AUTHENTICATED_REMEMBERED = 'IS_AUTHENTICATED_REMEMBERED';
3638

3739
private $authenticationTrustResolver;
3840

@@ -53,6 +55,7 @@ public function vote(TokenInterface $token, $subject, array $attributes)
5355
&& self::IS_AUTHENTICATED !== $attribute
5456
&& self::IS_ANONYMOUS !== $attribute
5557
&& self::IS_IMPERSONATOR !== $attribute
58+
&& self::IS_REMEMBERED !== $attribute
5659
&& self::IS_AUTHENTICATED_ANONYMOUSLY !== $attribute)) {
5760
continue;
5861
}
@@ -64,9 +67,13 @@ public function vote(TokenInterface $token, $subject, array $attributes)
6467
return VoterInterface::ACCESS_GRANTED;
6568
}
6669

67-
if (self::IS_AUTHENTICATED_REMEMBERED === $attribute
70+
if ((($bc = self::IS_AUTHENTICATED_REMEMBERED === $attribute) || self::IS_REMEMBERED === $attribute)
6871
&& ($this->authenticationTrustResolver->isRememberMe($token)
6972
|| $this->authenticationTrustResolver->isFullFledged($token))) {
73+
if ($bc) {
74+
@trigger_error(sprintf('Using "%s" is deprecated since version 4.3 and will be removed in 5.0. Use "%s" instead.', self::IS_AUTHENTICATED_REMEMBERED, self::IS_REMEMBERED), E_USER_DEPRECATED);
75+
}
76+
7077
return VoterInterface::ACCESS_GRANTED;
7178
}
7279

src/Symfony/Component/Security/Core/Tests/Authorization/Voter/AuthenticatedVoterTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public function getVoteTests()
4242
['remembered', ['IS_AUTHENTICATED'], VoterInterface::ACCESS_GRANTED],
4343
['anonymously', ['IS_AUTHENTICATED'], VoterInterface::ACCESS_GRANTED],
4444

45-
['fully', ['IS_AUTHENTICATED_REMEMBERED'], VoterInterface::ACCESS_GRANTED],
46-
['remembered', ['IS_AUTHENTICATED_REMEMBERED'], VoterInterface::ACCESS_GRANTED],
47-
['anonymously', ['IS_AUTHENTICATED_REMEMBERED'], VoterInterface::ACCESS_DENIED],
45+
['fully', ['IS_REMEMBERED'], VoterInterface::ACCESS_GRANTED],
46+
['remembered', ['IS_REMEMBERED'], VoterInterface::ACCESS_GRANTED],
47+
['anonymously', ['IS_REMEMBERED'], VoterInterface::ACCESS_DENIED],
4848

4949
['fully', ['IS_AUTHENTICATED_FULLY'], VoterInterface::ACCESS_GRANTED],
5050
['remembered', ['IS_AUTHENTICATED_FULLY'], VoterInterface::ACCESS_DENIED],
@@ -73,6 +73,10 @@ public function getLegacyVoteTests()
7373
['fully', ['IS_AUTHENTICATED_ANONYMOUSLY'], VoterInterface::ACCESS_GRANTED],
7474
['remembered', ['IS_AUTHENTICATED_ANONYMOUSLY'], VoterInterface::ACCESS_GRANTED],
7575
['anonymously', ['IS_AUTHENTICATED_ANONYMOUSLY'], VoterInterface::ACCESS_GRANTED],
76+
77+
['fully', ['IS_AUTHENTICATED_REMEMBERED'], VoterInterface::ACCESS_GRANTED],
78+
['remembered', ['IS_AUTHENTICATED_REMEMBERED'], VoterInterface::ACCESS_GRANTED],
79+
['anonymously', ['IS_AUTHENTICATED_REMEMBERED'], VoterInterface::ACCESS_DENIED],
7680
];
7781
}
7882

0 commit comments

Comments
 (0)
0