getUser() public method

{@inheritDoc}
public getUser ( )
 /**
  * @test
  * @dataProvider dataProvider_getToken
  */
 public function getUser_objectInitialized_returnValid($userObject, $expectedReturnValue)
 {
     //Mock the TokenInterface
     $this->token->expects($this->once())->method('getUser')->will($this->returnValue($userObject));
     $returnValue = $this->authContext->getUser();
     $this->assertEquals($expectedReturnValue, $returnValue);
 }
 /**
  * Ask for Google authentication code.
  *
  * @param AuthenticationContext $context
  *
  * @return Response|null
  */
 public function requestAuthenticationCode(AuthenticationContext $context)
 {
     $user = $context->getUser();
     $request = $context->getRequest();
     $session = $context->getSession();
     // Display and process form
     $authCode = $request->get($this->authCodeParameter);
     if ($authCode !== null) {
         if ($this->authenticator->checkCode($user, $authCode)) {
             $context->setAuthenticated(true);
             return new RedirectResponse($request->getUri());
         } else {
             $session->getFlashBag()->set('two_factor', 'scheb_two_factor.code_invalid');
         }
     }
     // Force authentication code dialog
     return $this->templating->renderResponse($this->formTemplate, array('useTrustedOption' => $context->useTrustedOption()));
 }
 /**
  * Call TwoFactorProviderRegistry, set trusted computer cookie if requested
  *
  * @param  \Scheb\TwoFactorBundle\Security\TwoFactor\AuthenticationContext $context
  * @return \Symfony\Component\HttpFoundation\Response|null
  */
 public function requestAuthenticationCode(AuthenticationContext $context)
 {
     $request = $context->getRequest();
     $user = $context->getUser();
     $context->setUseTrustedOption($this->useTrustedOption($user));
     // 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() && $request->get($this->trustedName)) {
             $cookie = $this->cookieManager->createTrustedCookie($request, $user);
             $response->headers->setCookie($cookie);
         }
         return $response;
     }
     return null;
 }
 /**
  * requestAuthenticationCode
  * @param AuthenticationContext $context
  * @return \Symfony\Component\HttpFoundation\Response|null
  **/
 public function requestAuthenticationCode(AuthenticationContext $context)
 {
     $user = $context->getUser();
     $request = $context->getRequest();
     $session = $context->getSession();
     $authData = $request->get($this->authCodeParameter);
     if (null !== $authData) {
         if ($this->authenticator->checkRequest($user, json_decode($session->get('u2f_authentication')), json_decode($authData))) {
             $context->setAuthenticated(true);
             return new RedirectResponse($request->getUri());
         } else {
             $session->getFlashBag()->set('two_factor', 'r_u2f_two_factor.code_invalid');
         }
     }
     $authenticationData = json_encode($this->authenticator->generateRequest($user), JSON_UNESCAPED_SLASHES);
     $session->set('u2f_authentication', $authenticationData);
     return $this->templating->renderResponse($this->formTemplate, array('authenticationData' => $authenticationData, 'useTrustedOption' => $context->useTrustedOption()));
 }
 public function requestAuthenticationCode(AuthenticationContext $context)
 {
     $user = $context->getUser();
     $request = $context->getRequest();
     $session = $context->getSession();
     // Display and process form
     $authCode = $request->get($this->authCodeParameter);
     if ($authCode !== null) {
         $result = $this->authenticator->checkCode($user, $authCode);
         if ($result) {
             //get the inwebo alias
             $alias = $result['alias'];
             //Persist the alias to the database to be used in case we do 2FA only once
             $this->codeHandler->getAndPersist($user, $alias);
             $context->setAuthenticated(true);
             return new RedirectResponse($request->getUri());
         } else {
             $session->getFlashBag()->set("two_factor", "scheb_two_factor.code_invalid");
         }
     }
     //die();
     // Force authentication code dialog
     return $this->templating->renderResponse($this->formTemplate, array('useTrustedOption' => $context->useTrustedOption()));
 }