public function authenticate(TokenInterface $token)
    {
        if (!$this->supports($token)) {
            return;
        }

        $username = $token->getUsername();
        if (empty($username)) {
            $username = 'NONE_PROVIDED';
        }

        $user = $this->_userProvider->loadUserByUsername($username);
        if (false === is_array($user)) {
            $user = array($user);
        }

        $authenticatedToken = false;
        while (false === $authenticatedToken) {
            if (null !== $provider = array_pop($user)) {
                $authenticatedToken = $this->authenticateUser($token, $provider);
            } else {
                break;
            }
        }

        if (false === $authenticatedToken) {
            throw new SecurityException('Invalid authentication informations', SecurityException::INVALID_CREDENTIALS);
        }

        return $authenticatedToken;
    }
public function authenticate(TokenInterface $token)
    {
        if (!$this->supports($token)) {
            return;
        }

        $username = $token->getUsername();
        if (empty($username)) {
            $username = 'NONE_PROVIDED';
        }

        $user = $this->_userProvider->loadUserByUsername($username);
        if (false === is_array($user)) {
            $user = array($user);
        }

        $authenticatedToken = false;
        while (false === $authenticatedToken) {
            if (null !== $provider = array_pop($user)) {
                $authenticatedToken = $this->authenticateUser($token, $provider);
            } else {
                break;
            }
        }

        if (false === $authenticatedToken) {
            throw new SecurityException('Invalid authentication informations', SecurityException::INVALID_CREDENTIALS);
        }

        return $authenticatedToken;
    }
public function authenticate ( TokenInterface $ token ) { if ( ! $ this -> supports ( $ token ) ) { return ; } $ username = $ token -> getUsername ( ) ; if ( empty ( $ username ) ) { $ username = 'NONE_PROVIDED' ; } $ user = $ this -> _userProvider -> loadUserByUsername ( $ username ) ; if ( false === is_array ( $ user ) ) { $ user = array ( $ user ) ; } $ authenticatedToken = false ; while ( false === $ authenticatedToken ) { if ( null !== $ provider = array_pop ( $ user ) ) { $ authenticatedToken = $ this -> authenticateUser ( $ token , $ provider ) ; } else { break ; } } if ( false === $ authenticatedToken ) { throw new SecurityException ( 'Invalid authentication informations' , SecurityException :: INVALID_CREDENTIALS ) ; } return $ authenticatedToken ; }
Authenticate a token according to the user provider.

@param \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token

@return \Symfony\Component\Security\Core\User\UserProviderInterface

@throws SecurityException Occures on invalid connection
Authenticate a token according to the user provider .