public abstract class CredentialStoreSpi extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
initialized
Field indicating successful initialization (
initialize(Map, CredentialStore.ProtectionParameter, Provider[]) . |
Modifier | Constructor and Description |
---|---|
protected |
CredentialStoreSpi()
Construct a new instance of this SPI.
|
Modifier and Type | Method and Description |
---|---|
boolean |
exists(String credentialAlias,
Class<? extends Credential> credentialType)
Check whether credential store service has an entry associated with the given credential alias of specified
credential type.
|
void |
flush()
Flush the credential store contents to storage.
|
Set<String> |
getAliases()
Returns credential aliases stored in this store as
Set<String> . |
abstract void |
initialize(Map<String,String> attributes,
CredentialStore.ProtectionParameter protectionParameter,
Provider[] providers)
Initialize credential store service with given attributes.
|
boolean |
isInitialized()
Checks whether underlying credential store service is initialized.
|
abstract boolean |
isModifiable()
Check if credential store service supports modification of its store
|
abstract void |
remove(String credentialAlias,
Class<? extends Credential> credentialType,
String credentialAlgorithm,
AlgorithmParameterSpec parameterSpec)
Remove the credentialType with from given alias from the credential store service.
|
abstract <C extends Credential> |
retrieve(String credentialAlias,
Class<C> credentialType,
String credentialAlgorithm,
AlgorithmParameterSpec parameterSpec,
CredentialStore.ProtectionParameter protectionParameter)
Retrieve the credential stored in the store under the given alias, matching the given criteria.
|
abstract void |
store(String credentialAlias,
Credential credential,
CredentialStore.ProtectionParameter protectionParameter)
Store credential to the credential store service under the given alias.
|
void |
validateAttribute(Map<String,String> attributes,
List<String> validAttributes)
Validate given attributes in credential store implementation.
|
protected boolean initialized
initialize(Map, CredentialStore.ProtectionParameter, Provider[])
. Each subclass should set this field.protected CredentialStoreSpi()
public abstract void initialize(Map<String,String> attributes, CredentialStore.ProtectionParameter protectionParameter, Provider[] providers) throws CredentialStoreException
initialized
after
successful initialization.attributes
- attributes to used to pass information to credential store serviceprotectionParameter
- the store-wide protection parameter to apply, or null
for noneproviders
- providers to be injected into SPI implementation to get custom object instances of various type from, or null
for noneCredentialStoreException
- if initialization fails due to any reasonpublic boolean isInitialized()
true
in case of initialization passed successfully, false
otherwise.public abstract boolean isModifiable()
true
in case of modification of the store is supported, false
otherwisepublic boolean exists(String credentialAlias, Class<? extends Credential> credentialType) throws CredentialStoreException
true
if any credential was returned. Credential stores which use a protection
parameter should override this method.credentialAlias
- key to check existencecredentialType
- to class of credential to look fortrue
in case key exist in store otherwise false
CredentialStoreException
- when there is a problem with credential storepublic abstract void store(String credentialAlias, Credential credential, CredentialStore.ProtectionParameter protectionParameter) throws CredentialStoreException, UnsupportedCredentialTypeException
CredentialStoreSpi
supports storing of multiple entries (credential types) per alias.
Each must be of different credential type, or differing algorithm, or differing parameters.credentialAlias
- to store the credential to the storecredential
- instance of Credential
to storeprotectionParameter
- the protection parameter to apply to the entry, or null
for noneCredentialStoreException
- when the credential cannot be storedUnsupportedCredentialTypeException
- when the credentialType is not supportedpublic abstract <C extends Credential> C retrieve(String credentialAlias, Class<C> credentialType, String credentialAlgorithm, AlgorithmParameterSpec parameterSpec, CredentialStore.ProtectionParameter protectionParameter) throws CredentialStoreException
C
- the credential typecredentialAlias
- to find the credential in the storecredentialType
- the credential type class (must not be null
)credentialAlgorithm
- the credential algorithm to match, or null
to match any algorithmparameterSpec
- the parameter specification to match, or null
to match any parametersprotectionParameter
- the protection parameter to use to access the entry, or null
for noneCredential
stored in the store, or null
if the credential is not foundCredentialStoreException
- if the credential cannot be retrieved due to an errorpublic abstract void remove(String credentialAlias, Class<? extends Credential> credentialType, String credentialAlgorithm, AlgorithmParameterSpec parameterSpec) throws CredentialStoreException
credentialAlias
- alias to removecredentialType
- the credential type class to match (must not be null
)credentialAlgorithm
- the credential algorithm to match, or null
to match all algorithmsparameterSpec
- the credential parameters to match, or null
to match all parametersCredentialStoreException
- if the credential cannot be removed due to an errorpublic void flush() throws CredentialStoreException
CredentialStoreException
- if the flush fails for some reason.public Set<String> getAliases() throws UnsupportedOperationException, CredentialStoreException
Set<String>
.
It is not mandatory to override this method (throws UnsupportedOperationException
by default).Set<String>
of all keys stored in this storeUnsupportedOperationException
- when this method is not supported by the underlying credential storeCredentialStoreException
- if there is any problem with internal storepublic void validateAttribute(Map<String,String> attributes, List<String> validAttributes) throws CredentialStoreException
attributes
- attributes to used to pass information to credential store service.validAttributes
- valid attributes based on credential store implementation.CredentialStoreException
- if validation failsCopyright © 2020 JBoss by Red Hat. All rights reserved.