Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationContext::getToken PHP Method

getToken() public method

{@inheritDoc}
public getToken ( )
    public function getToken()
    {
        return $this->token;
    }

Usage Example

 /**
  * Iterate over two-factor providers and ask for two-factor authentcation.
  * Each provider can return a response. The first response will be returned.
  *
  * @param  \Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationContext $context
  * @return \Symfony\Component\HttpFoundation\Response|null
  */
 public function requestAuthenticationCode(AuthenticationContext $context)
 {
     $token = $context->getToken();
     // Iterate over two-factor providers and ask for completion
     foreach ($this->providers as $providerName => $provider) {
         if ($this->flagManager->isNotAuthenticated($providerName, $token)) {
             $response = $provider->requestAuthenticationCode($context);
             // Set authentication completed
             if ($context->isAuthenticated()) {
                 $this->flagManager->setComplete($providerName, $token);
             }
             // Return response
             if ($response instanceof Response) {
                 return $response;
             }
         }
     }
     return null;
 }
All Usage Examples Of Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationContext::getToken