setBegin() public méthode

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
 /**
  * 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());
         }
     }
 }
 /**
  * Iterate over two-factor providers and begin the two-factor authentication process.
  *
  * @param AuthenticationContextInterface $context
  */
 public function beginAuthentication(AuthenticationContextInterface $context)
 {
     /** @var TwoFactorProviderInterface $provider */
     foreach ($this->providers as $providerName => $provider) {
         if ($provider->beginAuthentication($context)) {
             $this->flagManager->setBegin($providerName, $context->getToken());
         }
     }
 }
 /**
  * @test
  */
 public function setBegin_startTwoFactor_flagIsSetFalse()
 {
     $token = $this->getMock("Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface");
     //Mock the SessionFlagGenerator
     $this->flagGenerator->expects($this->once())->method("getSessionFlag")->with("providerName", $token)->will($this->returnValue("session_flag"));
     //Mock the Session
     $this->session->expects($this->once())->method("set")->with("session_flag", false);
     $this->sessionFlagManager->setBegin("providerName", $token);
 }
 /**
  * @test
  */
 public function setBegin_startTwoFactor_flagIsSetFalse()
 {
     $token = $this->createMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');
     //Mock the SessionFlagGenerator
     $this->flagGenerator->expects($this->once())->method('getSessionFlag')->with('providerName', $token)->willReturn('session_flag');
     //Mock the Session
     $this->session->expects($this->once())->method('set')->with('session_flag', false);
     $this->sessionFlagManager->setBegin('providerName', $token);
 }