public function UsersJwtKeyRepository::deleteKey in JSON Web Token Authentication (JWT) 8
Delete one key.
Parameters
string $id: The key ID.
Overrides UsersJwtKeyRepositoryInterface::deleteKey
File
- modules/
users_jwt/ src/ UsersJwtKeyRepository.php, line 105
Class
- UsersJwtKeyRepository
- Class UsersJwtKeyRepository
Namespace
Drupal\users_jwtCode
public function deleteKey($id) {
$keys = $this->userData
->get('users_jwt', NULL, $id);
if ($keys) {
$this->userData
->delete('users_jwt', NULL, $id);
// There should be only one key, but invalidate for any we found.
$cache_tags = [];
foreach ($keys as $key_uid => $key_data) {
$cache_tags[] = 'users_jwt:' . $key_uid;
}
$this->cacheTagsInvalidator
->invalidateTags($cache_tags);
}
}