public function RevocableTokenRepositoryTrait::revoke in Simple OAuth (OAuth2) & OpenID Connect 8.4
Same name and namespace in other branches
- 8.2 src/Repositories/RevocableTokenRepositoryTrait.php \Drupal\simple_oauth\Repositories\RevocableTokenRepositoryTrait::revoke()
- 8.3 src/Repositories/RevocableTokenRepositoryTrait.php \Drupal\simple_oauth\Repositories\RevocableTokenRepositoryTrait::revoke()
- 5.x src/Repositories/RevocableTokenRepositoryTrait.php \Drupal\simple_oauth\Repositories\RevocableTokenRepositoryTrait::revoke()
3 calls to RevocableTokenRepositoryTrait::revoke()
- AccessTokenRepository::revokeAccessToken in src/
Repositories/ AccessTokenRepository.php - AuthCodeRepository::revokeAuthCode in src/
Repositories/ AuthCodeRepository.php - RefreshTokenRepository::revokeRefreshToken in src/
Repositories/ RefreshTokenRepository.php
File
- src/
Repositories/ RevocableTokenRepositoryTrait.php, line 72
Class
- RevocableTokenRepositoryTrait
- Common methods for token repositories on different grants.
Namespace
Drupal\simple_oauth\RepositoriesCode
public function revoke($token_id) {
if (!($tokens = $this->entityTypeManager
->getStorage(static::$entityTypeId)
->loadByProperties([
'value' => $token_id,
]))) {
return;
}
/** @var \Drupal\simple_oauth\Entity\Oauth2TokenInterface $token */
$token = reset($tokens);
$token
->revoke();
$token
->save();
}