Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  * @param Request $request
  * @return Response
  */
 public function onLogoutSuccess(Request $request)
 {
     if ($accessToken = $this->accessTokenManager->findTokenByToken($request->get('access_token'))) {
         $this->accessTokenManager->deleteToken($accessToken);
     }
     if ($accessToken = $this->accessTokenManager->findTokenByToken($request->cookies->get('access_token'))) {
         $this->accessTokenManager->deleteToken($accessToken);
     }
     if ($accessToken = $request->server->get('HTTP_AUTHORIZATION')) {
         if ($accessTokenObj = $this->accessTokenManager->findTokenByToken(substr($accessToken, 7))) {
             $this->accessTokenManager->deleteToken($accessTokenObj);
         }
     }
     if ($refreshToken = $this->refreshTokenManager->findTokenByToken($request->cookies->get('refresh_token'))) {
         $this->refreshTokenManager->deleteToken($refreshToken);
     }
     $request->headers->remove('Authorization');
     $request->server->remove('HTTP_AUTHORIZATION');
     $request->cookies->remove('access_token');
     $request->cookies->remove('refresh_token');
     $response = Response::create();
     $response->headers->clearCookie('access_token');
     $response->headers->clearCookie('refresh_token');
     return $response;
 }
 /**
  * {@inheritdoc}
  */
 public function unsetRefreshToken($tokenString)
 {
     $token = $this->refreshTokenManager->findTokenByToken($tokenString);
     if (null !== $token) {
         $this->refreshTokenManager->deleteToken($token);
     }
 }