Example #1
0
 /**
  * {@inheritDoc}
  */
 public function authenticate(TokenInterface $token)
 {
     $username = $this->oauthProvider->getUsername($token->getCredentials());
     $user = $this->userProvider->loadUserByUsername($username);
     $token = new OAuthToken($token->getCredentials(), $user->getRoles());
     $token->setUser($user);
     $token->setAuthenticated(true);
     return $token;
 }
 /**
  * {@inheritDoc}
  */
 public function start(Request $request, AuthenticationException $authException = null)
 {
     if (!$this->httpUtils->checkRequestPath($request, $this->checkPath)) {
         if ($this->httpUtils->checkRequestPath($request, $this->loginPath)) {
             $request->getSession()->remove('_security.target_path');
         }
         $authorizationUrl = $this->oauthProvider->getAuthorizationUrl($request);
         return $this->httpUtils->createRedirectResponse($request, $authorizationUrl);
     }
     throw $authException;
 }
Example #3
0
 /**
  * {@inheritDoc}
  */
 protected function attemptAuthentication(Request $request)
 {
     $accessToken = $this->oauthProvider->getAccessToken($request);
     $token = new OAuthToken($accessToken);
     return $this->authenticationManager->authenticate($token);
 }