/**
  * {@inheritDoc}
  */
 public function authenticate(TokenInterface $token)
 {
     $resourceOwner = $this->resourceOwnerMap->getResourceOwnerByName($token->getResourceOwnerName());
     $userResponse = $resourceOwner->getUserInformation($token->getCredentials());
     try {
         $user = $this->userProvider->loadUserByOAuthUserResponse($userResponse);
     } catch (OAuthAwareExceptionInterface $e) {
         $e->setAccessToken($token->getCredentials());
         $e->setResourceOwnerName($token->getResourceOwnerName());
         throw $e;
     }
     $token = new OAuthToken($token->getCredentials(), $user->getRoles());
     $token->setUser($user);
     $token->setAuthenticated(true);
     return $token;
 }