/**
  * Logout route.
  *
  * @param \Silex\Application $app
  * @param Request            $request
  *
  * @return RedirectResponse
  */
 public function authenticationLogout(Application $app, Request $request)
 {
     if (!$app['clientlogin.provider.manager']->getProviderName()) {
         $request->query->set('provider', 'Generic');
     }
     $response = $this->getFinalResponse($app, 'logout');
     if ($response instanceof SuccessRedirectResponse) {
         $response->setTargetUrl($this->getRedirectUrl($app));
     }
     CookieManager::clearResponseCookies($response, $app['clientlogin.config']->getCookiePaths());
     return $response;
 }
 /**
  * Proceess a profile login validation attempt.
  *
  * @return Response
  */
 protected function process($grantType)
 {
     $accessToken = $this->getAccessToken($this->request, $grantType);
     $guid = $this->handleAccountTransition($accessToken);
     // Update the PHP session
     $this->getTokenManager()->setAuthToken($guid, $accessToken);
     // Fetch the newly set session token and dispatch the event
     $sessionToken = $this->getTokenManager()->getToken(TokenManager::TOKEN_ACCESS);
     //$this->dispatchEvent(ClientLoginEvent::LOGIN_POST, $sessionToken);
     $response = new SuccessRedirectResponse('/');
     $cookiePaths = $this->getConfig()->getCookiePaths();
     CookieManager::setResponseCookies($response, $accessToken, $cookiePaths);
     return $response;
 }