8000 feature #60742 [Ldap][Security] Remove deprecated `eraseCredentials()… · symfony/symfony@46aa500 · GitHub
[go: up one dir, main page]

Skip to content

Commit 46aa500

Browse files
feature #60742 [Ldap][Security] Remove deprecated eraseCredentials() from (User|Token)Interface (chalasr)
This PR was merged into the 8.0 branch. Discussion ---------- [Ldap][Security] Remove deprecated `eraseCredentials()` from (User|Token)Interface | Q | A | ------------- | --- | Branch? | 8.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | #59682 | License | MIT We didn't deprecate the config option + container parameter from SecurityBundle nor the corresponding `AuthenticatorManager` constructor param, I propose to keep them no-op and deprecate them in 8.1 (mainly because `AuthenticatorManager` already deprecates a boolean parameter in 7.3 which makes deprecating the parameter complicates the bc layer and upgrade path significantly). Commits ------- 513a272 [Security][Ldap] Remove deprecated `eraseCredentials()` from (User|Token)Interface
2 parents 053a2b5 + 513a272 commit 46aa500

File tree

25 files changed

+36
-245
lines changed

25 files changed

+36
-245
lines changed

UPGRADE-8.0.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ HttpClient
126126
* Remove support for amphp/http-client < 5
127127
* Remove setLogger() methods on decorators; configure the logger on the wrapped client directly instead
128128

129+
Ldap
130+
----
131+
132+
* Remove `LdapUser::eraseCredentials()` in favor of `__serialize()`
133+
129134
OptionsResolver
130135
---------------
131136

@@ -246,6 +251,26 @@ PropertyInfo
246251
}
247252
```
248253

254+
Security
255+
--------
256+
257+
* Remove `UserInterface::eraseCredentials()` and `TokenInterface::eraseCredentials()`;
258+
erase credentials e.g. using `__serialize()` instead:
259+
260+
```diff
261+
-public function eraseCredentials(): void
262+
-{
263+
-}
264+
+// If your eraseCredentials() method was used to empty a "password" property:
265+
+public function __serialize(): array
266+
+{
267+
+ $data = (array) $this;
268+
+ unset($data["\0".self::class."\0password"]);
269+
+
270+
+ return $data;
271+
+}
272+
```
273+
249274
TwigBridge
250275
----------
251276

src/Symfony/Bridge/Doctrine/Tests/Fixtures/User.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ public function getUserIdentifier(): string
4545
return $this->name;
4646
}
4747

48-
#[\Deprecated]
49-
public function eraseCredentials(): void
50-
{
51-
}
52-
5348
public function equals(UserInterface $user)
5449
{
5550
}

src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,6 @@ public function isEnabled(): bool
249249
{
250250
return $this->enabled;
251251
}
252-
253-
#[\Deprecated]
254-
public function eraseCredentials(): void
255-
{
256-
}
257252
}
258253

259254
class ForceLoginController

src/Symfony/Component/Ldap/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
8.0
5+
---
6+
7+
* Remove `LdapUser::eraseCredentials()` in favor of `__serialize()`
8+
49
7.3
510
---
611

src/Symfony/Component/Ldap/Security/LdapUser.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,6 @@ public function getUserIdentifier(): string
6060
return $this->identifier;
6161
}
6262

63-
/**
64-
* @deprecated since Symfony 7.3
65-
*/
66-
#[\Deprecated(since: 'symfony/ldap 7.3')]
67-
public function eraseCredentials(): void
68-
{
69-
$this->password = null;
70-
}
71-
7263
public function getExtraFields(): array
7364
{
7465
return $this->extraFields;

src/Symfony/Component/PasswordHasher/Tests/Fixtures/TestLegacyPasswordAuthenticatedUser.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ public function getRoles(): array
3535
return $this->roles;
3636
}
3737

38-
#[\Deprecated]
39-
public function eraseCredentials(): void
40-
{
41-
}
42-
4338
public function getUserIdentifier(): string
4439
{
4540
return $this->username;

src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,6 @@ public function setUser(UserInterface $user): void
5555
$this->user = $user;
5656
}
5757

58-
/**
59-
* Removes sensitive information from the token.
60-
*
61-
* @deprecated since Symfony 7.3, erase credentials using the "__serialize()" method instead
62-
*/
63-
public function eraseCredentials(): void
64-
{
65-
trigger_deprecation('symfony/security-core', '7.3', \sprintf('The "%s::eraseCredentials()" method is deprecated and will be removed in 8.0, erase credentials using the "__serialize()" method instead.', TokenInterface::class));
66-
67-
if ($this->getUser() instanceof UserInterface) {
68-
$this->getUser()->eraseCredentials();
69-
}
70-
}
71-
7258
/**
7359
* Returns all the necessary state of the object for serialization purposes.
7460
*

src/Symfony/Component/Security/Core/Authentication/Token/NullToken.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ public function getUserIdentifier(): string
4343
return '';
4444
}
4545

46-
/**
47-
* @deprecated since Symfony 7.3
48-
*/
49-
#[\Deprecated(since: 'symfony/security-core 7.3')]
50-
public function eraseCredentials(): void
51-
{
52-
}
53-
5446
public function getAttributes(): array
5547
{
5648
return [];

src/Symfony/Component/Security/Core/Authentica FE54 tion/Token/TokenInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ public function getUser(): ?UserInterface;
5757
*/
5858
public function setUser(UserInterface $user): void;
5959

60-
/**
61-
* Removes sensitive information from the token.
62-
*
63-
* @deprecated since Symfony 7.3; erase credentials using the "__serialize()" method instead
64-
*/
65-
public function eraseCredentials(): void;
66-
6760
public function getAttributes(): array;
6861

6962
/**

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
8.0
5+
---
6+
7+
* Remove `UserInterface::eraseCredentials()` and `TokenInterface::eraseCredentials()`,
8+
erase credentials e.g. using `__serialize()` instead
9+
410
7.3
511
---
612

0 commit comments

Comments
 (0)
0