public function LockrKeyProvider::getKeyValue in Lockr 4.x
Same name and namespace in other branches
- 8.4 src/Plugin/KeyProvider/LockrKeyProvider.php \Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider::getKeyValue()
- 8.2 src/Plugin/KeyProvider/LockrKeyProvider.php \Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider::getKeyValue()
- 8.3 src/Plugin/KeyProvider/LockrKeyProvider.php \Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider::getKeyValue()
File
- src/
Plugin/ KeyProvider/ LockrKeyProvider.php, line 166 - Contains Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider.
Class
- LockrKeyProvider
- Adds a key provider that allows a key to be stored in Lockr.
Namespace
Drupal\lockr\Plugin\KeyProviderCode
public function getKeyValue(KeyInterface $key) {
$key_id = $this
->getLockrSecretName($key
->id());
try {
$key_value = $this->lockr
->getSecretValue($key_id);
} catch (\Exception $e) {
if ($e
->getCode() === 404) {
return $this
->generateKey($key);
}
$this
->logException($e);
return NULL;
}
if (is_null($key_value)) {
return $this
->generateKey($key);
}
return $key_value;
}