Skip to content

Commit 513a272

Browse files
chalasrnicolas-grekas
authored andcommitted
[Security][Ldap] Remove deprecated eraseCredentials() from (User|Token)Interface
1 parent 560e105 commit 513a272

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
@@ -87,6 +87,11 @@ HttpClient
8787
* Remove support for amphp/http-client < 5
8888
* Remove setLogger() methods on decorators; configure the logger on the wrapped client directly instead
8989

90+
Ldap
91+
----
92+
93+
* Remove `LdapUser::eraseCredentials()` in favor of `__serialize()`
94+
9095
OptionsResolver
9196
---------------
9297

@@ -207,6 +212,26 @@ PropertyInfo
207212
}
208213
```
209214

215+
Security
216+
--------
217+
218+
* Remove `UserInterface::eraseCredentials()` and `TokenInterface::eraseCredentials()`;
219+
erase credentials e.g. using `__serialize()` instead:
220+
221+
```diff
222+
-public function eraseCredentials(): void
223+
-{
224+
-}
225+
+// If your eraseCredentials() method was used to empty a "password" property:
226+
+public function __serialize(): array
227+
+{
228+
+ $data = (array) $this;
229+
+ unset($data["\0".self::class."\0password"]);
230+
+
231+
+ return $data;
232+
+}
233+
```
234+
210235
TwigBridge
211236
----------
212237

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/Authentication/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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy