public class SecretStoreAccessor extends Object
This class handles the access to the secret and key store by delegating the calls to the underlying
SecretStoreFacade
.
Constructor and Description |
---|
SecretStoreAccessor() |
Modifier and Type | Method and Description |
---|---|
static KeyStore |
getKeyStore(String name,
SecretStore password)
Retrieves a
KeyStore by its name. |
static Optional<KeyStore> |
getKeyStoreIfPresent(String name,
SecretStore password)
Retrieves a
KeyStore by its name, if present. |
static SecretStore |
getSecretStore(String name)
Retrieves a
SecretStore by its name. |
static SecretStoreFacade |
getSecretStoreFacade()
Returns the
SecretStoreFacade instance. |
static Optional<SecretStore> |
getSecretStoreIfPresent(String name)
Retrieves a
SecretStore by its name, if present. |
static void |
setSecretStoreFacade(SecretStoreFacade secretStoreFacade)
Replaces the default
SecretStoreFacade instance. |
public static void setSecretStoreFacade(@Nonnull SecretStoreFacade secretStoreFacade)
SecretStoreFacade
instance. This method is for internal use only.secretStoreFacade
- The facade to replace the current/default one with.@Nonnull public static SecretStore getSecretStore(String name) throws SecretStoreNotFoundException, SecretStoreAccessException
SecretStore
by its name.name
- The name identifying a SecretStore
.SecretStore
for the given name.SecretStoreNotFoundException
- If the SecretStore
cannot be found.SecretStoreAccessException
- If there is an issue while accessing the SecretStore
.@Nonnull public static Optional<SecretStore> getSecretStoreIfPresent(String name) throws SecretStoreAccessException
SecretStore
by its name, if present.name
- The name identifying a SecretStore
.Optional
of the SecretStore
for the given name.SecretStoreAccessException
- If there is an issue while accessing the SecretStore
.@Nonnull public static KeyStore getKeyStore(String name, SecretStore password) throws KeyStoreNotFoundException, KeyStoreAccessException
KeyStore
by its name.name
- The name identifying a KeyStore
.password
- The password to unlock the KeyStore
.KeyStore
for the given name.KeyStoreNotFoundException
- If the KeyStore
cannot be found.KeyStoreAccessException
- If there is an issue while accessing the KeyStore
.@Nonnull public static Optional<KeyStore> getKeyStoreIfPresent(String name, SecretStore password) throws KeyStoreAccessException
KeyStore
by its name, if present.name
- The name identifying a KeyStore
.password
- The password to unlock the KeyStore
.KeyStore
for the given name.KeyStoreAccessException
- If there is an issue while accessing the KeyStore
.@Nullable public static SecretStoreFacade getSecretStoreFacade()
SecretStoreFacade
instance. For internal use only.Copyright © 2018 SAP SE. All rights reserved.