public class KeyStoreCredentialResolver extends AbstractCriteriaFilteringCredentialResolver
CredentialResolver
that extracts Credential
's from a key store.
If no key usage type is presented at construction time this resolver will return the key, if available, regardless of
the usage type provided to its resolve method.Constructor and Description |
---|
KeyStoreCredentialResolver(KeyStore store,
Map<String,String> passwords)
Constructor.
|
KeyStoreCredentialResolver(KeyStore store,
Map<String,String> passwords,
UsageType usage)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Credential |
buildCredential(KeyStore.Entry keyStoreEntry,
String entityID,
UsageType usage)
Build a credential instance from the key store entry.
|
protected void |
checkCriteriaRequirements(CriteriaSet criteriaSet)
Check that required credential criteria are available.
|
protected boolean |
matchUsage(UsageType keyStoreUsage,
UsageType criteriaUsage)
Match usage enum type values from keystore configured usage and from credential criteria.
|
protected X509Credential |
processPrivateKeyEntry(KeyStore.PrivateKeyEntry privateKeyEntry,
String entityID,
UsageType usage)
Build an X509Credential from a keystore private key entry.
|
protected Credential |
processSecretKeyEntry(KeyStore.SecretKeyEntry secretKeyEntry,
String entityID,
UsageType usage)
Build a Credential from a keystore secret key entry.
|
protected X509Credential |
processTrustedCertificateEntry(KeyStore.TrustedCertificateEntry trustedCertEntry,
String entityID,
UsageType usage)
Build an X509Credential from a keystore trusted certificate entry.
|
protected Iterable<Credential> |
resolveFromSource(CriteriaSet criteriaSet)
Subclasses are required to implement this method to resolve credentials from the
implementation-specific type of underlying credential source.
|
isMeetAllCriteria, isUnevaluableSatisfies, resolve, setMeetAllCriteria, setUnevaluableSatisfies
resolveSingle
public KeyStoreCredentialResolver(KeyStore store, Map<String,String> passwords) throws IllegalArgumentException
store
- key store credentials are retrieved frompasswords
- for key entries, map key is the entity id, map value is the passwordIllegalArgumentException
- thrown if the given keystore is nullpublic KeyStoreCredentialResolver(KeyStore store, Map<String,String> passwords, UsageType usage) throws IllegalArgumentException
store
- key store credentials are retrieved frompasswords
- for key entries, map key is the entity id, map value is the passwordusage
- usage type of all keys in the storeIllegalArgumentException
- thrown if the given keystore is nullprotected Iterable<Credential> resolveFromSource(CriteriaSet criteriaSet) throws SecurityException
resolveFromSource
in class AbstractCriteriaFilteringCredentialResolver
criteriaSet
- the set of criteria used to resolve credentials from the credential sourceSecurityException
- thrown if there is an error resolving credentials from the credential sourceprotected void checkCriteriaRequirements(CriteriaSet criteriaSet)
criteriaSet
- the credential criteria set to evaluateprotected boolean matchUsage(UsageType keyStoreUsage, UsageType criteriaUsage)
keyStoreUsage
- the usage type configured for the keystorecriteriaUsage
- the value from credential criteriaprotected Credential buildCredential(KeyStore.Entry keyStoreEntry, String entityID, UsageType usage) throws SecurityException
keyStoreEntry
- the key store entry to processentityID
- the entityID to include in the credentialusage
- the usage type to include in the credentialSecurityException
- throw if there is a problem building a credential from the key store entryprotected X509Credential processTrustedCertificateEntry(KeyStore.TrustedCertificateEntry trustedCertEntry, String entityID, UsageType usage)
trustedCertEntry
- the entry being processedentityID
- the entityID to setusage
- the usage type to setprotected X509Credential processPrivateKeyEntry(KeyStore.PrivateKeyEntry privateKeyEntry, String entityID, UsageType usage)
privateKeyEntry
- the entry being processedentityID
- the entityID to setusage
- the usage type to setprotected Credential processSecretKeyEntry(KeyStore.SecretKeyEntry secretKeyEntry, String entityID, UsageType usage)
secretKeyEntry
- the entry being processedentityID
- the entityID to setusage
- the usage type to setCopyright © 1999-2012. All Rights Reserved.