Exemple #1
0
 protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token)
 {
     parent::onLoginSuccess($request, $response, $token);
     try {
         $password = $request->get('password');
         $cookie = $this->getCookie($response);
         $hash = $this->decodeCookie($cookie->getValue())[3];
         $key = $this->createKey($hash);
         $value = Crypto::encrypt($password, $key);
         $response->headers->setCookie(new Cookie($this->options['name'] . '_A', $value, $cookie->getExpiresTime(), $this->options['path'], $this->options['domain'], $this->options['secure'], $this->options['httponly']));
     } catch (Exception $ex) {
         $this->logger->error('unexpected exception occurred, while decrypting the rememberMe cookie' . "\n" . $ex->getTraceAsString());
         $request->getSession()->invalidate();
         throw new AccessDeniedException("Unexpected exception occurred.");
     }
 }