You are here

public function RevocableTokenRepositoryTrait::isRevoked in Simple OAuth (OAuth2) & OpenID Connect 5.x

Same name and namespace in other branches
  1. 8.4 src/Repositories/RevocableTokenRepositoryTrait.php \Drupal\simple_oauth\Repositories\RevocableTokenRepositoryTrait::isRevoked()
  2. 8.2 src/Repositories/RevocableTokenRepositoryTrait.php \Drupal\simple_oauth\Repositories\RevocableTokenRepositoryTrait::isRevoked()
  3. 8.3 src/Repositories/RevocableTokenRepositoryTrait.php \Drupal\simple_oauth\Repositories\RevocableTokenRepositoryTrait::isRevoked()
3 calls to RevocableTokenRepositoryTrait::isRevoked()
AccessTokenRepository::isAccessTokenRevoked in src/Repositories/AccessTokenRepository.php
AuthCodeRepository::isAuthCodeRevoked in src/Repositories/AuthCodeRepository.php
RefreshTokenRepository::isRefreshTokenRevoked in src/Repositories/RefreshTokenRepository.php

File

src/Repositories/RevocableTokenRepositoryTrait.php, line 88

Class

RevocableTokenRepositoryTrait
Common methods for token repositories on different grants.

Namespace

Drupal\simple_oauth\Repositories

Code

public function isRevoked($token_id) {
  if (!($tokens = $this->entityTypeManager
    ->getStorage(static::$entityTypeId)
    ->loadByProperties([
    'value' => $token_id,
  ]))) {
    return TRUE;
  }

  /** @var \Drupal\simple_oauth\Entity\Oauth2TokenInterface $token */
  $token = reset($tokens);
  return $token
    ->isRevoked();
}