Neos\Flow\Security\Context::refreshTokens PHP Method

refreshTokens() public method

This is useful when doing an explicit authentication inside a request.
public refreshTokens ( ) : void
return void
    public function refreshTokens()
    {
        if ($this->initialized === false) {
            $this->initialize();
        }
        $this->updateTokens($this->activeTokens);
    }

Usage Example

 /**
  * Logout all active authentication tokens
  *
  * @return void
  */
 public function logout()
 {
     if ($this->isAuthenticated() !== true) {
         return;
     }
     $this->isAuthenticated = null;
     /** @var $token TokenInterface */
     foreach ($this->securityContext->getAuthenticationTokens() as $token) {
         $token->setAuthenticationStatus(TokenInterface::NO_CREDENTIALS_GIVEN);
     }
     $this->emitLoggedOut();
     if ($this->session->isStarted()) {
         $this->session->destroy('Logout through AuthenticationProviderManager');
     }
     $this->securityContext->refreshTokens();
 }