* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Core\Authentication\Provider; use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Core\User\UserCheckerInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; /** * Processes a pre-authenticated authentication request. * * This authentication provider will not perform any checks on authentication * requests, as they should already be pre-authenticated. However, the * UserProviderInterface implementation may still throw a * UsernameNotFoundException, for example. * * @author Fabien Potencier */ class PreAuthenticatedAuthenticationProvider implements AuthenticationProviderInterface { private $userProvider; private $userChecker; private $providerKey; public function __construct(UserProviderInterface $userProvider, UserCheckerInterface $userChecker, $providerKey) { $this->userProvider = $userProvider; $this->userChecker = $userChecker; $this->providerKey = $providerKey; } /** * {@inheritdoc} */ public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { throw new AuthenticationException('The token is not supported by this authentication provider.'); } if (!$user = $token->getUser()) { throw new BadCredentialsException('No pre-authenticated principal found in request.'); } $user = $this->userProvider->loadUserByUsername($user); $this->userChecker->checkPostAuth($user); $authenticatedToken = new PreAuthenticatedToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles()); $authenticatedToken->setAttributes($token->getAttributes()); return $authenticatedToken; } /** * {@inheritdoc} */ public function supports(TokenInterface $token) { return $token instanceof PreAuthenticatedToken && $this->providerKey === $token->getProviderKey(); } } __halt_compiler();----SIGNATURE:----dl5pS3d0JNajKQ+Zu6wcaBbdSbiMoySJ66i3Gv0Mo+0GzOKo9k/mflDxG55NTwWiOrMbD3USvsPHszLGm1tDJyxa2SBvEZR072FFDiPswB7wSVWrh1Gum4z1ehqoD4qfCQv5niApILwmtpiL0ZFUR4N6H13mVOsEU04jqoFsFaUdXFhF1kTm9G4/F5F0fOoGuHRuPgApzZOA/Lz0Kry8HJpOZtk1ScKsGzqaDa9UvWp+4/A2Kli8/POthsbcUhQBYMPzH7/WnCQJiiPqOq7kq7mN5UaflcYv6OJlVPJFQ/SxUom06zn5iVaTo73wEcrRQw/TRQQHbks2B2w32QVFArExBV+2U4r5Q7k5QQNhB4Xlkb7qLiobj38mAxlGOYO/KmUJQ5C25nU1RKzjdfbUavJDuGoJARGfBNQtA+RRBM/nfh93YgCOxXCqhh8sK5+WYh/KZll2zk9En6OuHPQ/3PfnAQP8lwdlmY4XPJlSuVLHCKK+sRaFM2eoTi+Ocwz6i2f3u41pVuBHc26gBCA//z2c1aROoIfmJlZrBSv5Y4ZIg/j/teeYh8sYSq3C4FDhTnaWST7tdLhdF65I4RMW7P3EN2QUHNgHaG0SsBY1ge00uyw7VGeuFl58smaxgIZ0Ud7ktsReu45PoXx6BZMNWz4zTng5iRP7k0PAEP1ZLEg=----ATTACHMENT:----MjMxNTkzODMwMDczMjc2IDYzMDY4MzAzNDUwNTY0MDYgMjQxMzkyNjcwNDAxMzcxMw==