diff --git a/UPGRADE-5.3.md b/UPGRADE-5.3.md index 93de206e82..8e29b2f13c 100644 --- a/UPGRADE-5.3.md +++ b/UPGRADE-5.3.md @@ -193,6 +193,7 @@ Security * Deprecate calling methods `hashPassword()`, `isPasswordValid()` and `needsRehash()` on `UserPasswordHasherInterface` with a `UserInterface` instance that does not implement `PasswordAuthenticatedUserInterface` * Deprecate all classes in the `Core\Encoder\` sub-namespace, use the `PasswordHasher` component instead * Deprecated voters that do not return a valid decision when calling the `vote` method + * [BC break] Add optional array argument `$badges` to `UserAuthenticatorInterface::authenticateUser()` SecurityBundle -------------- diff --git a/src/Symfony/Bundle/SecurityBundle/Security/UserAuthenticator.php b/src/Symfony/Bundle/SecurityBundle/Security/UserAuthenticator.php index 72f9fd4772..76f46e80ec 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/UserAuthenticator.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/UserAuthenticator.php @@ -19,6 +19,7 @@ use Symfony\Component\Security\Core\Exception\LogicException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Http\Authentication\UserAuthenticatorInterface; use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface; /** * A decorator that delegates all method calls to the authenticator @@ -42,9 +43,12 @@ class UserAuthenticator implements UserAuthenticatorInterface $this->requestStack = $requestStack; } - public function authenticateUser(UserInterface $user, AuthenticatorInterface $authenticator, Request $request): ?Response + /** + * {@inheritdoc} + */ + public function authenticateUser(UserInterface $user, AuthenticatorInterface $authenticator, Request $request, array $badges = []): ?Response { - return $this->getUserAuthenticator()->authenticateUser($user, $authenticator, $request); + return $this->getUserAuthenticator()->authenticateUser($user, $authenticator, $request, $badges); } private function getUserAuthenticator(): UserAuthenticatorInterface diff --git a/src/Symfony/Component/Security/Http/Authentication/UserAuthenticatorInterface.php b/src/Symfony/Component/Security/Http/Authentication/UserAuthenticatorInterface.php index fe32a42a97..f6f67f5d8a 100644 --- a/src/Symfony/Component/Security/Http/Authentication/UserAuthenticatorInterface.php +++ b/src/Symfony/Component/Security/Http/Authentication/UserAuthenticatorInterface.php @@ -15,6 +15,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface; /** * @author Wouter de Jong @@ -26,6 +27,8 @@ interface UserAuthenticatorInterface /** * Convenience method to programmatically login a user and return a * Response *if any* for success. + * + * @param BadgeInterface[] $badges Optionally, pass some Passport badges to use for the manual login */ - public function authenticateUser(UserInterface $user, AuthenticatorInterface $authenticator, Request $request): ?Response; + public function authenticateUser(UserInterface $user, AuthenticatorInterface $authenticator, Request $request, array $badges = []): ?Response; }