You are here

interface OpenIDConnectStateTokenInterface in OpenID Connect / OAuth client 2.x

Same name and namespace in other branches
  1. 8 src/OpenIDConnectStateTokenInterface.php \Drupal\openid_connect\OpenIDConnectStateTokenInterface

Creates and validates state tokens.

@package Drupal\openid_connect

Hierarchy

Expanded class hierarchy of OpenIDConnectStateTokenInterface

All classes that implement OpenIDConnectStateTokenInterface

2 files declare their use of OpenIDConnectStateTokenInterface
OpenIDConnectClientBase.php in src/Plugin/OpenIDConnectClientBase.php
OpenIDConnectRedirectController.php in src/Controller/OpenIDConnectRedirectController.php

File

src/OpenIDConnectStateTokenInterface.php, line 10

Namespace

Drupal\openid_connect
View source
interface OpenIDConnectStateTokenInterface {

  /**
   * Creates a state token and stores it in the session for later validation.
   *
   * @return string
   *   A state token that later can be validated to prevent request forgery.
   */
  public function generateToken() : string;

  /**
   * Confirms anti-forgery state token.
   *
   * @param string $state_token
   *   The state token that is used for validation.
   *
   * @return bool
   *   Whether the state token matches the previously created one that is stored
   *   in the session.
   */
  public function confirm(string $state_token) : bool;

}

Members

Namesort descending Modifiers Type Description Overrides
OpenIDConnectStateTokenInterface::confirm public function Confirms anti-forgery state token. 1
OpenIDConnectStateTokenInterface::generateToken public function Creates a state token and stores it in the session for later validation. 1