userProvider = $userProvider; } /** * @param TokenInterface $token * * @return OAuthToken * * @throws AuthenticationException */ public function authenticate(TokenInterface $token) { $user = $token->getUser(); if ($user) { $token->setAuthenticated(true); return $token; } throw new AuthenticationException('The OAuth authentication failed.'); } /** * @param TokenInterface $token * * @return boolean */ public function supports(TokenInterface $token) { return $token instanceof OAuthToken; } }