Package org.forgerock.secrets.gcp.sm
Class GoogleSecretManagerSecretStore
java.lang.Object
org.forgerock.secrets.gcp.sm.GoogleSecretManagerSecretStore
- All Implemented Interfaces:
SecretStore<Secret>
A secret store that can read secrets directly from Google Secret Manager.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder class for configuring an instance of theGoogleSecretManagerSecretStore. -
Field Summary
Fields inherited from interface org.forgerock.secrets.SecretStore
CLOCK, LEASE_EXPIRY_DURATION -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Returns a newGoogleSecretManagerSecretStore.Builderobject to configure the secret store.<S extends Secret>
Promise<S,NoSuchSecretException> Returns the active secret for the given purpose.<S extends Secret>
Promise<S,NoSuchSecretException> Returns the named secret from this store.The top-level class that this store is capable of storing.<S extends Secret>
Promise<Stream<S>,NeverThrowsException> Returns all valid secrets for the given purpose from this store.voidrefresh()Indicates that the store should refresh its secrets from the backing storage mechanism.voidshutdown()Shuts down the secret store, closing the connection to Google Cloud.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.forgerock.secrets.SecretStore
retire, revoke, rotate
-
Method Details
-
builder
Returns a newGoogleSecretManagerSecretStore.Builderobject to configure the secret store.- Returns:
- the builder object.
-
getStoredType
Description copied from interface:SecretStoreThe top-level class that this store is capable of storing. This is a reification of the type parameter and can be used to lookup stores for a given type.- Specified by:
getStoredTypein interfaceSecretStore<Secret>- Returns:
- the top-most type that this store is capable of storing, typically either
CryptoKeyfor key-stores,GenericSecretfor password stores, orSecretif the store is capable of storing any type of secret.
-
getActive
Description copied from interface:SecretStoreReturns the active secret for the given purpose.- Specified by:
getActivein interfaceSecretStore<Secret>- Type Parameters:
S- the type of secret.- Parameters:
purpose- the purpose for which a secret is required.- Returns:
- the active secret from this store.
-
getNamed
public <S extends Secret> Promise<S,NoSuchSecretException> getNamed(Purpose<S> purpose, String name) Description copied from interface:SecretStoreReturns the named secret from this store. The default implementation callsSecretStore.getValid(Purpose)and then returns the first valid key with a matching stable ID.- Specified by:
getNamedin interfaceSecretStore<Secret>- Type Parameters:
S- the type of secret.- Parameters:
purpose- the secret purpose.name- the name (stable id) of the secret.- Returns:
- a promise for the named secret, or a
NoSuchSecretExceptionpromise if no such secret exists.
-
getValid
Description copied from interface:SecretStoreReturns all valid secrets for the given purpose from this store.- Specified by:
getValidin interfaceSecretStore<Secret>- Type Parameters:
S- the type of secret.- Parameters:
purpose- the purpose.- Returns:
- a stream of all valid secrets of the given type from this store, or an empty stream if none exist.
-
refresh
public void refresh()Description copied from interface:SecretStoreIndicates that the store should refresh its secrets from the backing storage mechanism. This can be used to cause reload of a store after a secret rotation if the backend does not automatically detect such changes. Refresh may be an asynchronous operation and no guarantees are made about when clients of this secret store may see updated secrets after a call to refresh.- Specified by:
refreshin interfaceSecretStore<Secret>
-
shutdown
public void shutdown()Shuts down the secret store, closing the connection to Google Cloud. Any further attempts to lookup a secret from this store will result in an error.
-