src/Aptoma/Security/Provider/ApiKeyAuthenticationProvider.php
public function authenticate(TokenInterface $token)
    {
        $user = $this->userProvider->loadUserByApiKey($this->encoder->encodePassword($token->getCredentials()));

        if (!$user || !($user instanceof UserInterface)) {
            throw new AuthenticationException('Bad credentials');
        }

        $token = new ApiKeyToken($token->getCredentials(), $user->getRoles());
        $token->setUser($user);

        return $token;
    }
public function authenticate(TokenInterface $token)
    {
        $user = $this->userProvider->loadUserByApiKey($this->encoder->encodePassword($token->getCredentials()));

        if (!$user || !($user instanceof UserInterface)) {
            throw new AuthenticationException('Bad credentials');
        }

        $token = new ApiKeyToken($token->getCredentials(), $user->getRoles());
        $token->setUser($user);

        return $token;
    }
public function authenticate ( TokenInterface $ token ) { $ user = $ this -> userProvider -> loadUserByApiKey ( $ this -> encoder -> encodePassword ( $ token -> getCredentials ( ) ) ) ; if ( ! $ user || ! ( $ user instanceof UserInterface ) ) { throw new AuthenticationException ( 'Bad credentials' ) ; } $ token = new ApiKeyToken ( $ token -> getCredentials ( ) , $ user -> getRoles ( ) ) ; $ token -> setUser ( $ user ) ; return $ token ; }
Authenticate the user based on an API key

@param TokenInterface $token
Authenticate the user based on an API key