Scheb\TwoFactorBundle\Security\TwoFactor\Session\SessionFlagManager::setBegin PHP Method

setBegin() public method

Set session flag to ask for two-factor authentication.
public setBegin ( string $provider, Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token )
$provider string
$token Symfony\Component\Security\Core\Authentication\Token\TokenInterface
    public function setBegin($provider, $token)
    {
        $sessionFlag = $this->getSessionFlag($provider, $token);
        $this->session->set($sessionFlag, false);
    }

Usage Example

 /**
  * Iterate over two-factor providers and begin the two-factor authentication process
  *
  * @param \Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationContext $context
  */
 public function beginAuthentication(AuthenticationContext $context)
 {
     foreach ($this->providers as $providerName => $provider) {
         if ($provider->beginAuthentication($context)) {
             $this->flagManager->setBegin($providerName, $context->getToken());
         }
     }
 }
All Usage Examples Of Scheb\TwoFactorBundle\Security\TwoFactor\Session\SessionFlagManager::setBegin