OpenIDConnectStateToken.php in OpenID Connect / OAuth client 8
File
src/OpenIDConnectStateToken.php
View source
<?php
namespace Drupal\openid_connect;
use Drupal\Component\Utility\Crypt;
class OpenIDConnectStateToken implements OpenIDConnectStateTokenInterface {
public static function create() {
$state = Crypt::randomBytesBase64();
$_SESSION['openid_connect_state'] = $state;
return $state;
}
public static function confirm($state_token) {
return isset($_SESSION['openid_connect_state']) && $state_token == $_SESSION['openid_connect_state'];
}
}