Skip to content

Commit 3cc426e

Browse files
committed
[Security] added userChecker to SimpleAuthenticationProvider
apply userChecker after authToken is authenticated
1 parent 63d9dce commit 3cc426e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Symfony/Component/Security/Core/Authentication/Provider/SimpleAuthenticationProvider.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ public function __construct(SimpleAuthenticatorInterface $simpleAuthenticator, U
3939
public function authenticate(TokenInterface $token)
4040
{
4141
$authToken = $this->simpleAuthenticator->authenticateToken($token, $this->userProvider, $this->providerKey);
42-
$this->userChecker->checkPreAuth($authToken->getUser());
43-
$this->userChecker->checkPostAuth($authToken->getUser());
4442

45-
if ($authToken instanceof TokenInterface) {
46-
return $authToken;
43+
if (!($authToken instanceof TokenInterface)) {
44+
throw new AuthenticationException('Simple authenticator failed to return an authenticated token.');
4745
}
4846

49-
throw new AuthenticationException('Simple authenticator failed to return an authenticated token.');
47+
$this->userChecker->checkPreAuth($authToken->getUser());
48+
$this->userChecker->checkPostAuth($authToken->getUser());
49+
50+
return $authToken;
5051
}
5152

5253
public function supports(TokenInterface $token)

0 commit comments

Comments
 (0)