コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function authenticate(TokenInterface $token)
 {
     if (!$this->supports($token)) {
         return;
     }
     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;
 }