Neos\Flow\Security\Authentication\Token\AbstractToken::setAuthenticationStatus PHP Method

setAuthenticationStatus() public method

Sets the authentication status. Usually called by the responsible \Neos\Flow\Security\Authentication\AuthenticationManagerInterface
public setAuthenticationStatus ( integer $authenticationStatus ) : void
$authenticationStatus integer One of NO_CREDENTIALS_GIVEN, WRONG_CREDENTIALS, AUTHENTICATION_SUCCESSFUL, AUTHENTICATION_NEEDED
return void
    public function setAuthenticationStatus($authenticationStatus)
    {
        if (!in_array($authenticationStatus, [self::NO_CREDENTIALS_GIVEN, self::WRONG_CREDENTIALS, self::AUTHENTICATION_SUCCESSFUL, self::AUTHENTICATION_NEEDED])) {
            throw new InvalidAuthenticationStatusException('Invalid authentication status.', 1237224453);
        }
        $this->authenticationStatus = $authenticationStatus;
    }

Usage Example

 /**
  * @test
  * @expectedException \Neos\Flow\Security\Exception\InvalidAuthenticationStatusException
  */
 public function setAuthenticationStatusThrowsAnExceptionForAnInvalidStatus()
 {
     $this->token->setAuthenticationStatus(-1);
 }