public class LocalKeyInfoCredentialResolver extends BasicProviderKeyInfoCredentialResolver
BasicProviderKeyInfoCredentialResolver
which is capable of using information from a KeyInfo
to resolve
local credentials from a supplied CredentialResolver
which manages local credentials.
The local credential resolver supplied should manage and return credentials which contain either a secret (symmetric) key or the private key half of a key pair.
A typical use case for this class would be as a resolver of decryption keys,
such as is needed by Decrypter
.
Resolution proceeds as follows:
BasicProviderKeyInfoCredentialResolver
resolution process which is not a local credential will be removed
from the effective set of credentials to be returned. Note that a configured
KeyInfoProvider
may have itself already resolved local credentials using a
different mechanism. These will not be removed.KeyInfoResolutionContext.getKeyNames()
will also
be used as resolution criteria for local credentials and the resultant credentials
added to the set to be returned.Constructor and Description |
---|
LocalKeyInfoCredentialResolver(List<KeyInfoProvider> keyInfoProviders,
CredentialResolver localCredentialResolver)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
CredentialResolver |
getLocalCredentialResolver()
Get the resolver for local credentials.
|
protected boolean |
isLocalCredential(Credential credential)
Determine whether the credential is a local credential.
|
protected void |
postProcess(KeyInfoResolutionContext kiContext,
CriteriaSet criteriaSet,
List<Credential> credentials)
Hook for subclasses to do post-processing of the credential set after all KeyInfo children have been processed.
|
protected Collection<? extends Credential> |
resolveByKeyName(String keyName)
Resolve credentials from local resolver using key name criteria.
|
protected Collection<? extends Credential> |
resolveByPublicKey(PublicKey publicKey)
Resolve credentials from local resolver using public key criteria.
|
buildBasicCredential, extractKeyValue, getProviders, initResolutionContext, postProcessEmptyCredentials, processKeyInfoChild, processKeyInfoChildren, resolveFromSource, resolveKeyValue
isSatisfyAllPredicates, resolve, setSatisfyAllPredicates
resolveSingle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
resolve, resolveSingle
public LocalKeyInfoCredentialResolver(@Nonnull List<KeyInfoProvider> keyInfoProviders, @Nonnull CredentialResolver localCredentialResolver)
keyInfoProviders
- the list of KeyInfoProvider
s to use in this resolverlocalCredentialResolver
- resolver of local credentials@Nonnull public CredentialResolver getLocalCredentialResolver()
protected void postProcess(@Nonnull KeyInfoResolutionContext kiContext, @Nullable CriteriaSet criteriaSet, @Nonnull List<Credential> credentials) throws ResolverException
postProcess
in class BasicProviderKeyInfoCredentialResolver
kiContext
- KeyInfo resolution contextcriteriaSet
- the credential criteria used to resolve credentialscredentials
- the list which will store the resolved credentialsResolverException
- thrown if there is an error during processingprotected boolean isLocalCredential(@Nonnull Credential credential)
credential
- the credential to evaluate@Nonnull protected Collection<? extends Credential> resolveByKeyName(@Nonnull String keyName) throws ResolverException
keyName
- the key name criteriaResolverException
- thrown if there is a problem resolving credentials from the
local credential resolver@Nonnull protected Collection<? extends Credential> resolveByPublicKey(@Nonnull PublicKey publicKey) throws ResolverException
publicKey
- the public key criteriaResolverException
- thrown if there is a problem resolving credentials from the
local credential resolverCopyright © 2016 JBoss by Red Hat. All rights reserved.