public class InMemoryCredentialStore extends AbstractCredentialStore
MasterKeyService.
This class handles the details of the in-memory storage buffer and associated input and output
streams. Each credential is stored in its own KeyStore that may be be purged upon some
retention timeout - if specified.DEFAULT_STORE_TYPE| Constructor and Description |
|---|
InMemoryCredentialStore()
Constructs a new InMemoryCredentialStore where credentials have no retention timeout
|
InMemoryCredentialStore(long retentionDuration,
TimeUnit units,
boolean activelyPurge)
Constructs a new InMemoryCredentialStore with a specified credential timeout
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCredential(String alias,
Credential credential)
Adds a new credential to this CredentialStore
The supplied key will be converted into UTF-8 bytes before being stored.
|
boolean |
containsCredential(String alias)
Tests this CredentialStore for the existence of a credential with the specified alias
This implementation is thread-safe, allowing one thread at a time to access the credential store.
|
Credential |
getCredential(String alias)
Retrieves the specified credential from this CredentialStore
This implementation is thread-safe, allowing one thread at a time to access the credential store.
|
Set<String> |
listCredentials()
Returns a list of the alias names for the credentials stored in the CredentialStore
This implementation is thread-safe, allowing one thread at a time to access the credential store.
|
protected KeyStore |
loadCredentialStore()
Calls the implementation-specific facility to load the KeyStore
|
protected void |
persistCredentialStore(KeyStore keyStore)
Calls the implementation-specific facility to persist the KeyStore
|
void |
removeCredential(String alias)
Removes the specified credential from this CredentialStore
This implementation is thread-safe, allowing one thread at a time to access the credential store.
|
addCredential, getCredential, getLock, loadKeyStore, setMasterKeyService, toBytes, toChars, writeKeyStorepublic InMemoryCredentialStore()
public InMemoryCredentialStore(long retentionDuration,
TimeUnit units,
boolean activelyPurge)
retentionDuration - the time in some units to keep stored credentials, from the time they are addedunits - the units for the retention duration (minutes, seconds, etc...)activelyPurge - true to actively purge credentials after the retention time has expired;
otherwise false, to passively purge credentials after the retention time has expiredpublic void addCredential(String alias, Credential credential) throws org.apache.ambari.server.AmbariException
addCredential in interface CredentialStoreaddCredential in class AbstractCredentialStorealias - a string declaring the alias (or name) of the credentialcredential - the credential to storeorg.apache.ambari.server.AmbariException - if an error occurs while storing the new credentialpublic Credential getCredential(String alias) throws org.apache.ambari.server.AmbariException
getCredential in interface CredentialStoregetCredential in class AbstractCredentialStorealias - a string declaring the alias (or name) of the credentialorg.apache.ambari.server.AmbariException - if an error occurs while retrieving the new credentialpublic void removeCredential(String alias) throws org.apache.ambari.server.AmbariException
removeCredential in interface CredentialStoreremoveCredential in class AbstractCredentialStorealias - a string declaring the alias (or name) of the credentialorg.apache.ambari.server.AmbariException - if an error occurs while removing the new credentialpublic Set<String> listCredentials() throws org.apache.ambari.server.AmbariException
listCredentials in interface CredentialStorelistCredentials in class AbstractCredentialStoreorg.apache.ambari.server.AmbariException - if an error occurs while searching forthe credentialpublic boolean containsCredential(String alias) throws org.apache.ambari.server.AmbariException
containsCredential in interface CredentialStorecontainsCredential in class AbstractCredentialStorealias - a string declaring the alias (or name) of the credentialorg.apache.ambari.server.AmbariException - if an error occurs while searching forthe credentialprotected void persistCredentialStore(KeyStore keyStore) throws org.apache.ambari.server.AmbariException
AbstractCredentialStorepersistCredentialStore in class AbstractCredentialStorekeyStore - the KeyStore to persistorg.apache.ambari.server.AmbariException - if an error occurs while persisting the key store dataprotected KeyStore loadCredentialStore() throws org.apache.ambari.server.AmbariException
AbstractCredentialStoreloadCredentialStore in class AbstractCredentialStoreorg.apache.ambari.server.AmbariException - if an error occurs while loading the key store dataCopyright © 2022 Apache Software Foundation. All rights reserved.