/**
  * Initializes the security context for the given request. It is loaded from the session.
  *
  * @param F3\FLOW3\MVC\RequestInterface $request The request the context should be initialized for
  * @return void
  * @author Andreas Förthner <*****@*****.**>
  * @author Karsten Dambekalns <*****@*****.**>
  */
 public function initializeContext(\F3\FLOW3\MVC\RequestInterface $request)
 {
     if (!$this->context instanceof \F3\FLOW3\Security\Context) {
         $this->context = $this->objectFactory->create('F3\\FLOW3\\Security\\Context');
     }
     $this->context->setRequest($request);
     $this->authenticationManager->setSecurityContext($this->context);
     $managerTokens = $this->filterInactiveTokens($this->authenticationManager->getTokens(), $request);
     $sessionTokens = $this->context->getAuthenticationTokens();
     $mergedTokens = $this->mergeTokens($managerTokens, $sessionTokens);
     $this->updateTokens($mergedTokens);
     $this->context->setAuthenticationTokens($mergedTokens);
 }
Exemplo n.º 2
0
 /**
  * @test
  * @category unit
  * @author Andreas Förthner <*****@*****.**>
  */
 public function authenticateAllTokensIsSetCorrectlyFromConfiguration()
 {
     $settings = array();
     $settings['security']['authentication']['authenticateAllTokens'] = TRUE;
     $securityContext = new \F3\FLOW3\Security\Context();
     $securityContext->injectSettings($settings);
     $this->assertTrue($securityContext->authenticateAllTokens());
 }