-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Closed
Closed
Copy link
Description
Symfony version(s) affected
7.2
Description
In the userBadge class and the function getUser there is this code:
if (null === $this->getAttributes()) {
$user = ($this->userLoader)($this->userIdentifier);
} else {
$user = ($this->userLoader)($this->userIdentifier, $this->getAttributes());
}And in the class EntityUserProvider there is the function:
public function loadUserByIdentifier(string $identifier): UserInterface
{
//...
}The second attribute is missing of the function is missing is there are attributes in the UserBadge.
Same in the Interface, ...
The problem that is you set attributes it's not possible to get these in loadUserByIdentifier in the repository via https://symfony.com/doc/current/security/user_providers.html#creating-a-custom-user-provider
How to reproduce
To reproduce it, direction the Authenticator:
public function authenticate(Request $request): Passport
{
$credentials = $this->getCredentials($request);
$passport = new Passport(
new UserBadge($credentials['username'], [$this->userProvider, 'loadUserByIdentifier'], ['interface' => $credentials['interface']]),
new PasswordCredentials($credentials['password']),
[
new RememberMeBadge(),
]
);
return $passport;
}The interface parameter is impossible to get in the UsersRepository:
phppublic function loadUserByIdentifier(string $identifier, array $attributes = []): ?UserInterface
{
dd($attributes);
}
$attributes is empty.
Possible Solution
No response
Additional Context
No response