You are here

public static function OpenIDConnectStateToken::confirm in OpenID Connect / OAuth client 8

Same name and namespace in other branches
  1. 2.x 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

Deprecated

in openid_connect:8.x-1.0-rc2 and is removed from openid_connect:8.x-2.0. Instead of the static OpenIDConnectStateToken::confirm use the non-static \Drupal::service('openid_connect.state_token')->confirm() instead.

See also

https://www.drupal.org/project/openid_connect/issues/3055847

File

src/OpenIDConnectStateToken.php, line 26

Class

OpenIDConnectStateToken
Creates and validates state tokens.

Namespace

Drupal\openid_connect

Code

public static function confirm($state_token) {
  return isset($_SESSION['openid_connect_state']) && $state_token == $_SESSION['openid_connect_state'];
}