public function RevocableTokenRepositoryTrait::revoke in Simple OAuth (OAuth2) & OpenID Connect 8.2
Same name and namespace in other branches
- 8.4 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 simple_oauth_extras/
src/ Repositories/ AuthCodeRepository.php - RefreshTokenRepository::revokeRefreshToken in src/
Repositories/ RefreshTokenRepository.php
File
- src/
Repositories/ RevocableTokenRepositoryTrait.php, line 50
Class
Namespace
Drupal\simple_oauth\RepositoriesCode
public function revoke($token_id) {
if (!($tokens = $this->entityTypeManager
->getStorage(static::$entity_type_id)
->loadByProperties([
'value' => $token_id,
]))) {
return;
}
/** @var \Drupal\simple_oauth\Entity\Oauth2TokenInterface $token */
$token = reset($tokens);
$token
->revoke();
$token
->save();
}