function simple_oauth_entity_update in Simple OAuth (OAuth2) & OpenID Connect 8.2
Same name and namespace in other branches
- 8.4 simple_oauth.module \simple_oauth_entity_update()
- 8.3 simple_oauth.module \simple_oauth_entity_update()
- 5.x simple_oauth.module \simple_oauth_entity_update()
Implements hook_entity_update().
File
- ./
simple_oauth.module, line 25 - Contains simple_oauth.module..
Code
function simple_oauth_entity_update(EntityInterface $entity) {
/** @var \Drupal\simple_oauth\ExpiredCollector $collector */
$collector = \Drupal::service('simple_oauth.expired_collector');
// Collect the affected tokens and expire them.
if ($entity instanceof AccountInterface) {
$collector
->deleteMultipleTokens($collector
->collectForAccount($entity));
}
if ($entity instanceof Oauth2ClientInterface) {
$collector
->deleteMultipleTokens($collector
->collectForClient($entity));
}
}