You are here

public function Oauth2ClientServiceBase::getClient in OAuth2 Client 8.3

Same name and namespace in other branches
  1. 8.2 src/Service/Oauth2ClientServiceBase.php \Drupal\oauth2_client\Service\Oauth2ClientServiceBase::getClient()

Retrieve an OAuth2 Client Plugin.

Parameters

string $pluginId: The plugin ID of the client to be retrieved.

Return value

\Drupal\oauth2_client\Plugin\Oauth2Client\Oauth2ClientPluginInterface The OAuth2 Client plugin.

Overrides Oauth2ClientServiceInterface::getClient

6 calls to Oauth2ClientServiceBase::getClient()
AuthorizationCodeGrantService::getPostCaptureRedirect in src/Service/Grant/AuthorizationCodeGrantService.php
Provide a redirect for use following authorization code capture.
Oauth2ClientGrantServiceBase::getProvider in src/Service/Grant/Oauth2ClientGrantServiceBase.php
Creates a new provider object.
Oauth2ClientService::getAccessToken in src/Service/Oauth2ClientService.php
Obtains an existing or a new access token.
Oauth2ClientService::getProvider in src/Service/Oauth2ClientService.php
Obtains a Provider from the relevant service.
Oauth2ClientServiceBase::clearAccessToken in src/Service/Oauth2ClientServiceBase.php
Clears the access token for the given client.

... See full list

File

src/Service/Oauth2ClientServiceBase.php, line 23

Class

Oauth2ClientServiceBase
Base class for OAuth2 Client services.

Namespace

Drupal\oauth2_client\Service

Code

public function getClient($pluginId) {
  $clients =& drupal_static(__CLASS__ . '::' . __FUNCTION__, []);
  if (!isset($clients[$pluginId])) {
    $definition = $this->oauth2ClientPluginManager
      ->getDefinition($pluginId);
    if (!$definition || !isset($definition['id'])) {
      throw new InvalidOauth2ClientException($pluginId);
    }
    $clients[$pluginId] = $this->oauth2ClientPluginManager
      ->createInstance($definition['id']);
  }
  return $clients[$pluginId];
}