You are here

interface OpenIDConnectClientInterface in OpenID Connect / OAuth client 2.x

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

Defines an interface for OpenID Connect client plugins.

Hierarchy

Expanded class hierarchy of OpenIDConnectClientInterface

All classes that implement OpenIDConnectClientInterface

6 files declare their use of OpenIDConnectClientInterface
OpenIDConnectClaims.php in src/OpenIDConnectClaims.php
OpenIDConnectClientEntity.php in src/Entity/OpenIDConnectClientEntity.php
OpenIDConnectClientEntityInterface.php in src/OpenIDConnectClientEntityInterface.php
OpenIDConnectClientFormBase.php in src/Form/OpenIDConnectClientFormBase.php
OpenIDConnectRedirectController.php in src/Controller/OpenIDConnectRedirectController.php

... See full list

File

src/Plugin/OpenIDConnectClientInterface.php, line 14

Namespace

Drupal\openid_connect\Plugin
View source
interface OpenIDConnectClientInterface extends ConfigurableInterface, DependentPluginInterface, PluginFormInterface, PluginWithFormsInterface {

  /**
   * Returns an array of endpoints.
   *
   * @return array
   *   An array with the following keys:
   *   - authorization: The full url to the authorization endpoint.
   *   - token: The full url to the token endpoint.
   *   - userinfo: The full url to the userinfo endpoint.
   */
  public function getEndpoints() : array;

  /**
   * Gets an array of of scopes.
   *
   * This method allows a client to override the default minimum set of scopes
   * assumed by OpenIDConnectClaims::getScopes();
   *
   * @return string[]|null
   *   A space separated list of scopes.
   */
  public function getClientScopes() : ?array;

  /**
   * Redirects the user to the authorization endpoint.
   *
   * The authorization endpoint authenticates the user and returns them
   * to the redirect_uri specified previously with an authorization code
   * that can be exchanged for an access token.
   *
   * @param string $scope
   *   Name of scope(s) that with user consent will provide access to otherwise
   *   restricted user data. Defaults to "openid email".
   *
   * @return \Symfony\Component\HttpFoundation\Response
   *   A response object.
   */
  public function authorize(string $scope = 'openid email') : Response;

  /**
   * Retrieve access token and ID token.
   *
   * Exchanging the authorization code that is received as the result of the
   * authentication request for an access token and an ID token.
   *
   * The ID token is a cryptographically signed JSON object encoded in base64.
   * It contains identity information about the user.
   * The access token can be sent to the login provider to obtain user profile
   * information.
   *
   * @param string $authorization_code
   *   Authorization code received as a result of the the authorization request.
   *
   * @return array|null
   *   An associative array containing:
   *   - id_token: The ID token that holds user data.
   *   - access_token: Access token that can be used to obtain user profile
   *     information.
   *   - expire: Unix timestamp of the expiration date of the access token.
   *   Or NULL if tokens could not be retrieved.
   */
  public function retrieveTokens(string $authorization_code) : ?array;

  /**
   * Retrieves user info: additional user profile data.
   *
   * @param string $access_token
   *   Access token.
   *
   * @return array|null
   *   Additional user profile information or NULL on failure.
   */
  public function retrieveUserInfo(string $access_token) : ?array;

  /**
   * Check if the client uses the userinfo endpoint.
   *
   * @return bool
   *   Whether the client uses the userinfo endpoint or not.
   */
  public function usesUserInfo() : bool;

  /**
   * Return the plugin label as defined in the annotation.
   *
   * @return string
   *   Plugin label.
   */
  public function getLabel() : string;

  /**
   * Sets the parent entity ID.
   *
   * @param string $entity_id
   *   The parent entity ID.
   */
  public function setParentEntityId(string $entity_id);

  /**
   * Returns the parent entity ID.
   *
   * @return string
   *   The parent entity ID.
   */
  public function getParentEntityId() : string;

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 14
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 15
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 15
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 20
OpenIDConnectClientInterface::authorize public function Redirects the user to the authorization endpoint. 1
OpenIDConnectClientInterface::getClientScopes public function Gets an array of of scopes. 1
OpenIDConnectClientInterface::getEndpoints public function Returns an array of endpoints. 6
OpenIDConnectClientInterface::getLabel public function Return the plugin label as defined in the annotation. 1
OpenIDConnectClientInterface::getParentEntityId public function Returns the parent entity ID. 1
OpenIDConnectClientInterface::retrieveTokens public function Retrieve access token and ID token. 1
OpenIDConnectClientInterface::retrieveUserInfo public function Retrieves user info: additional user profile data. 1
OpenIDConnectClientInterface::setParentEntityId public function Sets the parent entity ID. 1
OpenIDConnectClientInterface::usesUserInfo public function Check if the client uses the userinfo endpoint. 1
PluginFormInterface::buildConfigurationForm public function Form constructor. 37
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
PluginWithFormsInterface::getFormClass public function Gets the form class for the given operation.
PluginWithFormsInterface::hasFormClass public function Gets whether the plugin has a form class for the given operation.