getRequest() public method

Return the request.
public getRequest ( ) : Request
return Symfony\Component\HttpFoundation\Request
Exemplo n.º 1
0
 /**
  * Ask for email authentication code.
  *
  * @param AuthenticationContextInterface $context
  *
  * @return Response|null
  */
 public function requestAuthenticationCode(AuthenticationContextInterface $context)
 {
     $user = $context->getUser();
     $request = $context->getRequest();
     $session = $context->getSession();
     // Display and process form
     $authCode = $request->get($this->authCodeParameter);
     if ($authCode !== null) {
         if ($this->authenticator->checkCode($user, $authCode)) {
             $context->setAuthenticated(true);
             return new RedirectResponse($request->getUri());
         }
         $session->getFlashBag()->set('two_factor', 'scheb_two_factor.code_invalid');
     }
     // Force authentication code dialog
     return $this->renderer->render($context);
 }
Exemplo n.º 2
0
 /**
  * Call TwoFactorProviderRegistry, set trusted computer cookie if requested.
  *
  * @param AuthenticationContextInterface $context
  *
  * @return Response|null
  */
 public function requestAuthenticationCode(AuthenticationContextInterface $context)
 {
     $request = $context->getRequest();
     $user = $context->getUser();
     $context->setUseTrustedOption($this->useTrustedOption);
     // Set trusted flag
     $response = $this->authHandler->requestAuthenticationCode($context);
     // On response validate if trusted cookie should be set
     if ($response instanceof Response) {
         // Set trusted cookie
         if ($context->isAuthenticated() && $context->useTrustedOption() && $request->get($this->trustedName)) {
             $cookie = $this->cookieManager->createTrustedCookie($request, $user);
             $response->headers->setCookie($cookie);
         }
         return $response;
     }
     return null;
 }