You are here

public function OpenIDConnectStateToken::confirm in OpenID Connect / OAuth client 2.x

Same name and namespace in other branches
  1. 8 src/OpenIDConnectStateToken.php \Drupal\openid_connect\OpenIDConnectStateToken::confirm()

Confirms anti-forgery state token.

Parameters

string $state_token: The state token that is used for validation.

Return value

bool Whether the state token matches the previously created one that is stored in the session.

Overrides OpenIDConnectStateTokenInterface::confirm

File

src/OpenIDConnectStateToken.php, line 54

Class

OpenIDConnectStateToken
Creates and validates state tokens.

Namespace

Drupal\openid_connect

Code

public function confirm(string $state_token) : bool {
  $state = $this->session
    ->retrieveStateToken(FALSE);
  return !empty($state) && $state_token == $state;
}