Skip to content

[Security] Readd deprecated methods to the interfaces #41493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@
*/
interface UserLoaderInterface
{
/**
* @return UserInterface|null
*
* @deprecated since Symfony 5.3, use loadUserByIdentifier() instead
*/
public function loadUserByUsername(string $username);
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,11 @@ public function getTokenValue();
* @return \DateTime
*/
public function getLastUsed();

/**
* @return string
*
* @deprecated since Symfony 5.3, use getUserIdentifier() instead
*/
public function getUsername();
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,11 @@ public function __serialize(): array;
* Restores the object state from an array given by __serialize().
*/
public function __unserialize(array $data): void;

/**
* @return string
*
* @deprecated since Symfony 5.3, use getUserIdentifier() instead
*/
public function getUsername();
}
7 changes: 7 additions & 0 deletions src/Symfony/Component/Security/Core/User/UserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,11 @@ public function getSalt();
* the plain-text password is stored on this object.
*/
public function eraseCredentials();

/**
* @return string
*
* @deprecated since Symfony 5.3, use getUserIdentifier() instead
*/
public function getUsername();
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,13 @@ public function refreshUser(UserInterface $user);
* @return bool
*/
public function supportsClass(string $class);

/**
* @return UserInterface
*
* @throws UserNotFoundException
*
* @deprecated since Symfony 5.3, use loadUserByIdentifier() instead
*/
public function loadUserByUsername(string $username);
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ public function createUser(TestLoginLinkHandlerUser $user): void
$this->users[$user->getUserIdentifier()] = $user;
}

public function loadUserByUsername($username): TestLoginLinkHandlerUser
{
return $this->loadUserByIdentifier($username);
}

public function loadUserByIdentifier(string $userIdentifier): TestLoginLinkHandlerUser
{
if (!isset($this->users[$userIdentifier])) {
Expand Down