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

getAccount() public method

Note: There might be a more currently authenticated account in the remaining tokens. If you need them you'll have to fetch them directly from the tokens. (@see getAuthenticationTokens())
public getAccount ( ) : Account
return Account The authenticated account
    public function getAccount()
    {
        if ($this->initialized === false) {
            $this->initialize();
        }
        /** @var $token TokenInterface */
        foreach ($this->getAuthenticationTokens() as $token) {
            if ($token->isAuthenticated() === true) {
                return $token->getAccount();
            }
        }
        return null;
    }

Usage Example

 /**
  * Get the account of the first authenticated token.
  *
  * @return Account|NULL
  */
 public function getAccount()
 {
     if ($this->securityContext->canBeInitialized()) {
         return $this->securityContext->getAccount();
     }
     return null;
 }
All Usage Examples Of Neos\Flow\Security\Context::getAccount