beginAuthentication() public method

Begin the two-factor authentication process.
public beginAuthentication ( Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationContextInterface $context )
$context Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationContextInterface
 /**
  * Check if user is on a trusted computer, otherwise call TwoFactorProviderRegistry.
  *
  * @param AuthenticationContextInterface $context
  */
 public function beginAuthentication(AuthenticationContextInterface $context)
 {
     $request = $context->getRequest();
     $user = $context->getUser();
     $context->setUseTrustedOption($this->useTrustedOption);
     // Skip two-factor authentication on trusted computers
     if ($context->useTrustedOption() && $this->cookieManager->isTrustedComputer($request, $user)) {
         return;
     }
     $this->authHandler->beginAuthentication($context);
 }
 /**
  * Listen for successful login events
  *
  * @param \Symfony\Component\Security\Http\Event\InteractiveLoginEvent $event
  */
 public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
 {
     $request = $event->getRequest();
     // Check if security token is supported
     $token = $event->getAuthenticationToken();
     if (!$this->isTokenSupported($token)) {
         return;
     }
     // Forward to two-factor providers
     // They decide if they will do two-factor authentication
     $context = new AuthenticationContext($request, $token);
     $this->authHandler->beginAuthentication($context);
 }
 /**
  * Listen for successful login events.
  *
  * @param InteractiveLoginEvent $event
  */
 public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
 {
     $request = $event->getRequest();
     // Skip two-factor authentication for whitelisted IPs
     if (in_array($request->getClientIp(), $this->ipWhitelist)) {
         return;
     }
     // Check if security token is supported
     $token = $event->getAuthenticationToken();
     if (!$this->isTokenSupported($token)) {
         return;
     }
     // Forward to two-factor providers
     // They decide if they will do two-factor authentication
     $context = $this->authenticationContextFactory->create($request, $token);
     $this->authHandler->beginAuthentication($context);
 }