Esempio n. 1
0
 public function authenticate(TokenInterface $token)
 {
     $user = $this->userProvider->loadUserByUsername($token->getUsername());
     if (!$user) {
         throw new AuthenticationException('The authentication failed.');
     }
     $authenticatedToken = new ChoiceAuthToken($user->getRoles());
     $authenticatedToken->setAttributes($token->getAttributes());
     $authenticatedToken->setUser($user);
     $authenticatedToken->setProviderKey($this->providerKey);
     $authenticatedToken->setAuthenticated(true);
     return $authenticatedToken;
 }