|
10Duke Java Core
|
Interface for persistent storage of JWKS (JSON Web Key Set) public keys.
This interface provides methods for storing, retrieving, and managing public keys used for JWT signature verification in a persistent manner.
The persistent store is designed to work alongside the in-memory cache to optimize API usage by reducing calls to the JWKS endpoint.
Public Member Functions | |
| void | storeKey (String keyId, PublicKey publicKey) |
| Stores a public key with the given key identifier. | |
| void | storeKeys (Map< String, PublicKey > keys) |
| Stores multiple public keys in a single operation. | |
| PublicKey | retrieveKey (String keyId) |
| Retrieves a public key by its identifier. | |
| Map< String, PublicKey > | retrieveAllKeys () |
| Retrieves all stored public keys. | |
| boolean | containsKey (String keyId) |
| Checks if a key with the given identifier exists in the persistent store. | |
| boolean | removeKey (String keyId) |
| Removes a key with the given identifier from the persistent store. | |
| void | clearAll () |
| Removes all keys from the persistent store. | |
| int | getKeyCount () |
| Returns the number of keys currently stored. | |
| boolean | isEmpty () |
| Checks if the persistent store is empty. | |
| String | getStoreInfo () |
| Returns information about the persistent store implementation. | |
| void tenduke.sdk.core.service.JwksPersistentStore.clearAll | ( | ) |
Removes all keys from the persistent store.
This method clears the entire storage, which might be useful for testing or when a complete refresh is needed.
| boolean tenduke.sdk.core.service.JwksPersistentStore.containsKey | ( | String | keyId | ) |
Checks if a key with the given identifier exists in the persistent store.
| keyId | The unique identifier for the key. |
| IllegalArgumentException | if keyId is null or blank. |
| int tenduke.sdk.core.service.JwksPersistentStore.getKeyCount | ( | ) |
Returns the number of keys currently stored.
| String tenduke.sdk.core.service.JwksPersistentStore.getStoreInfo | ( | ) |
Returns information about the persistent store implementation.
This can be useful for logging, debugging, or configuration validation.
| boolean tenduke.sdk.core.service.JwksPersistentStore.isEmpty | ( | ) |
Checks if the persistent store is empty.
| boolean tenduke.sdk.core.service.JwksPersistentStore.removeKey | ( | String | keyId | ) |
Removes a key with the given identifier from the persistent store.
| keyId | The unique identifier for the key to remove. |
| IllegalArgumentException | if keyId is null or blank. |
| Map< String, PublicKey > tenduke.sdk.core.service.JwksPersistentStore.retrieveAllKeys | ( | ) |
Retrieves all stored public keys.
| PublicKey tenduke.sdk.core.service.JwksPersistentStore.retrieveKey | ( | String | keyId | ) |
Retrieves a public key by its identifier.
For key not found errors implementations may choose to use the built-in Exception builder, e.g.:
throw ExceptionBuilder.missingJwtSigningKey( "A public key with id: ".concat(keyId).concat(" does not exist"), null);
| keyId | The unique identifier for the key. |
| IllegalArgumentException | if keyId is null or blank, TokenException with MISSING_SIGNING_KEY error if a key id does not map to a key. |
| void tenduke.sdk.core.service.JwksPersistentStore.storeKey | ( | String | keyId, |
| PublicKey | publicKey ) |
Stores a public key with the given key identifier.
If a key with the same identifier already exists, it should be replaced with the new key.
| keyId | The unique identifier for the key. |
| publicKey | The public key to store. |
| IllegalArgumentException | if keyId is null or blank, or if publicKey is null. |
| void tenduke.sdk.core.service.JwksPersistentStore.storeKeys | ( | Map< String, PublicKey > | keys | ) |
Stores multiple public keys in a single operation.
This method provides an efficient way to store multiple keys at once, which is useful when loading keys from a JWKS endpoint.
| keys | A map of key identifiers to public keys. |
| IllegalArgumentException | if keys is null or contains null values. |