Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationHandlerInterface::requestAuthenticationCode PHP 메소드

requestAuthenticationCode() 공개 메소드

Request and validate authentication code.
public requestAuthenticationCode ( Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationContextInterface $context ) : Response | null
$context Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationContextInterface
리턴 Symfony\Component\HttpFoundation\Response | null
    public function requestAuthenticationCode(AuthenticationContextInterface $context);

Usage Example

예제 #1
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;
 }
All Usage Examples Of Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationHandlerInterface::requestAuthenticationCode