Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c5bd0bd

Browse filesBrowse files
author
Boris Vujicic
committed
[Security] added userChecker to SimpleAuthenticationProvider
Added UserChecker to SimpleAuthenticationProvider and updated SimpleFormFactory
1 parent 3ff74ad commit c5bd0bd
Copy full SHA for c5bd0bd

File tree

2 files changed

+9
-1
lines changed
Filter options

2 files changed

+9
-1
lines changed

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimpleFormFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimpleFormFactory.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $config,
5555
->replaceArgument(0, new Reference($config['authenticator']))
5656
->replaceArgument(1, new Reference($userProviderId))
5757
->replaceArgument(2, $id)
58+
->replaceArgument(3, new Reference('security.user_checker.'.$id))
5859
;
5960

6061
return $provider;

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Provider/SimpleAuthenticationProvider.php
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Security\Core\Authentication\Provider;
1313

14+
use Symfony\Component\Security\Core\User\UserChecker;
15+
use Symfony\Component\Security\Core\User\UserCheckerInterface;
1416
use Symfony\Component\Security\Core\User\UserProviderInterface;
1517
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1618
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
@@ -24,17 +26,22 @@ class SimpleAuthenticationProvider implements AuthenticationProviderInterface
2426
private $simpleAuthenticator;
2527
private $userProvider;
2628
private $providerKey;
29+
private $userChecker;
2730

28-
public function __construct(SimpleAuthenticatorInterface $simpleAuthenticator, UserProviderInterface $userProvider, $providerKey)
31+
public function __construct(SimpleAuthenticatorInterface $simpleAuthenticator, UserProviderInterface $userProvider, $providerKey, UserCheckerInterface $userChecker = null)
2932
{
3033
$this->simpleAuthenticator = $simpleAuthenticator;
3134
$this->userProvider = $userProvider;
3235
$this->providerKey = $providerKey;
36+
$this->userChecker = $userChecker ?: new UserChecker();
3337
}
3438

3539
public function authenticate(TokenInterface $token)
3640
{
41+
$user = $this->userProvider->loadUserByUsername($token->getUsername());
42+
$this->userChecker->checkPreAuth($user);
3743
$authToken = $this->simpleAuthenticator->authenticateToken($token, $this->userProvider, $this->providerKey);
44+
$this->userChecker->checkPostAuth($user);
3845

3946
if ($authToken instanceof TokenInterface) {
4047
return $authToken;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.