class OpenIDConnectStateToken in OpenID Connect / OAuth client 8
Same name and namespace in other branches
- 2.x src/OpenIDConnectStateToken.php \Drupal\openid_connect\OpenIDConnectStateToken
Creates and validates state tokens.
@package Drupal\openid_connect
Hierarchy
- class \Drupal\openid_connect\OpenIDConnectStateToken implements OpenIDConnectStateTokenInterface
Expanded class hierarchy of OpenIDConnectStateToken
1 file declares its use of OpenIDConnectStateToken
- OpenIDConnectStateTokenTest.php in tests/
src/ Unit/ OpenIDConnectStateTokenTest.php
1 string reference to 'OpenIDConnectStateToken'
1 service uses OpenIDConnectStateToken
File
- src/
OpenIDConnectStateToken.php, line 12
Namespace
Drupal\openid_connectView source
class OpenIDConnectStateToken implements OpenIDConnectStateTokenInterface {
/**
* {@inheritdoc}
*/
public static function create() {
$state = Crypt::randomBytesBase64();
$_SESSION['openid_connect_state'] = $state;
return $state;
}
/**
* {@inheritdoc}
*/
public static function confirm($state_token) {
return isset($_SESSION['openid_connect_state']) && $state_token == $_SESSION['openid_connect_state'];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
OpenIDConnectStateToken:: |
public static | function |
Confirms anti-forgery state token. Overrides OpenIDConnectStateTokenInterface:: |
|
OpenIDConnectStateToken:: |
public static | function |
Creates a state token and stores it in the session for later validation. Overrides OpenIDConnectStateTokenInterface:: |