You are here

public function OAuth2Storage::getStorageClient in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/OAuth2Storage.php \Drupal\oauth2_server\OAuth2Storage::getStorageClient()

Get the client from the entity backend.

Parameters

string $client_id: The client id to find.

Return value

\Drupal\oauth2_server\ClientInterface|bool A client entity or false.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

7 calls to OAuth2Storage::getStorageClient()
OAuth2Storage::checkRestrictedGrantType in src/OAuth2Storage.php
Check restricted grant type.
OAuth2Storage::getClientDetails in src/OAuth2Storage.php
Get client credentials.
OAuth2Storage::getJti in src/OAuth2Storage.php
Get Jti.
OAuth2Storage::setAccessToken in src/OAuth2Storage.php
Set access token.
OAuth2Storage::setAuthorizationCode in src/OAuth2Storage.php
Set authorization code.

... See full list

File

src/OAuth2Storage.php, line 127

Class

OAuth2Storage
Provides Drupal OAuth2 storage for the library.

Namespace

Drupal\oauth2_server

Code

public function getStorageClient($client_id) {

  /** @var \Drupal\oauth2_server\ClientInterface[] $clients */
  $clients = $this->entityTypeManager
    ->getStorage('oauth2_server_client')
    ->loadByProperties([
    'client_id' => $client_id,
  ]);
  if ($clients) {
    return reset($clients);
  }
  return FALSE;
}