You are here

public function ExpiredCollector::collectForClient in Simple OAuth (OAuth2) & OpenID Connect 8.2

Same name and namespace in other branches
  1. 8.4 src/ExpiredCollector.php \Drupal\simple_oauth\ExpiredCollector::collectForClient()
  2. 8.3 src/ExpiredCollector.php \Drupal\simple_oauth\ExpiredCollector::collectForClient()
  3. 5.x src/ExpiredCollector.php \Drupal\simple_oauth\ExpiredCollector::collectForClient()

Collect all the tokens associated a particular client.

Parameters

\Drupal\simple_oauth\Entity\Oauth2ClientInterface $client: The account.

Return value

\Drupal\simple_oauth\Entity\Oauth2TokenInterface[] The tokens.

1 call to ExpiredCollector::collectForClient()
ExpiredCollector::collectForAccount in src/ExpiredCollector.php
Collect all the tokens associated with the provided account.

File

src/ExpiredCollector.php, line 110

Class

ExpiredCollector
Service in charge of deleting or expiring tokens that cannot be used anymore.

Namespace

Drupal\simple_oauth

Code

public function collectForClient(Oauth2ClientInterface $client) {
  $query = $this->tokenStorage
    ->getQuery();
  $query
    ->condition('client', $client
    ->id());
  if (!($entity_ids = $query
    ->execute())) {
    return [];
  }

  /** @var \Drupal\simple_oauth\Entity\Oauth2TokenInterface[] $results */
  $results = $this->tokenStorage
    ->loadMultiple(array_values($entity_ids));
  return array_values($results);
}