Package org.opensaml.xmlsec.impl
Class BasicSignatureSigningParametersResolver
- java.lang.Object
-
- org.opensaml.xmlsec.impl.AbstractSecurityParametersResolver<org.opensaml.xmlsec.SignatureSigningParameters>
-
- org.opensaml.xmlsec.impl.BasicSignatureSigningParametersResolver
-
- All Implemented Interfaces:
net.shibboleth.utilities.java.support.resolver.Resolver<org.opensaml.xmlsec.SignatureSigningParameters,net.shibboleth.utilities.java.support.resolver.CriteriaSet>
,org.opensaml.xmlsec.SignatureSigningParametersResolver
public class BasicSignatureSigningParametersResolver extends AbstractSecurityParametersResolver<org.opensaml.xmlsec.SignatureSigningParameters> implements org.opensaml.xmlsec.SignatureSigningParametersResolver
Basic implementation ofSignatureSigningParametersResolver
.The following
Criterion
inputs are supported:SignatureSigningConfigurationCriterion
- requiredKeyInfoGenerationProfileCriterion
- optional
-
-
Field Summary
Fields Modifier and Type Field Description private org.opensaml.xmlsec.algorithm.AlgorithmRegistry
algorithmRegistry
The AlgorithmRegistry used when processing algorithm URIs.private org.slf4j.Logger
log
Logger.
-
Constructor Summary
Constructors Constructor Description BasicSignatureSigningParametersResolver()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
credentialSupportsAlgorithm(org.opensaml.security.credential.Credential credential, String algorithm)
Evaluate whether the specified credential is supported for use with the specified algorithm URI.org.opensaml.xmlsec.algorithm.AlgorithmRegistry
getAlgorithmRegistry()
Get theAlgorithmRegistry
instance used when resolving algorithm URIs.protected Predicate<String>
getAlgorithmRuntimeSupportedPredicate()
Get a predicate which evaluates whether a cryptographic algorithm is supported by the runtime environment.protected List<String>
getEffectiveSignatureAlgorithms(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, Predicate<String> whitelistBlacklistPredicate)
Get the effective list of signature algorithm URIs to consider, including application of whitelist/blacklist policy.protected List<org.opensaml.security.credential.Credential>
getEffectiveSigningCredentials(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Get the effective list of signing credentials to consider.protected Predicate<String>
getWhitelistBlacklistPredicate(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Get a predicate which implements the effective configured whitelist/blacklist policy.protected void
logResult(org.opensaml.xmlsec.SignatureSigningParameters params)
Log the resolved parameters.Iterable<org.opensaml.xmlsec.SignatureSigningParameters>
resolve(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
protected void
resolveAndPopulateCredentialAndSignatureAlgorithm(org.opensaml.xmlsec.SignatureSigningParameters params, net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, Predicate<String> whitelistBlacklistPredicate)
Resolve and populate the signing credential and signature method algorithm URI on the supplied parameters instance.protected String
resolveCanonicalizationAlgorithm(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Resolve and return the canonicalization algorithm URI to use.protected Integer
resolveHMACOutputLength(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, org.opensaml.security.credential.Credential signingCredential, String algorithmURI)
Resolve and return the effective HMAC output length to use, if applicable to the specified signing credential and signature method algorithm URI.protected org.opensaml.xmlsec.keyinfo.KeyInfoGenerator
resolveKeyInfoGenerator(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, org.opensaml.security.credential.Credential signingCredential)
Resolve and return theKeyInfoGenerator
instance to use with the specified credential.protected String
resolveReferenceCanonicalizationAlgorithm(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Resolve and return the reference canonicalization algorithm URI to use.protected String
resolveReferenceDigestMethod(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, Predicate<String> whitelistBlacklistPredicate)
Resolve and return the digest method algorithm URI to use, including application of whitelist/blacklist policy.org.opensaml.xmlsec.SignatureSigningParameters
resolveSingle(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
void
setAlgorithmRegistry(org.opensaml.xmlsec.algorithm.AlgorithmRegistry registry)
Set theAlgorithmRegistry
instance used when resolving algorithm URIs.protected boolean
validate(org.opensaml.xmlsec.SignatureSigningParameters params)
Validate that theSignatureSigningParameters
instance has all the required properties populated.-
Methods inherited from class org.opensaml.xmlsec.impl.AbstractSecurityParametersResolver
lookupKeyInfoGenerator, resolveAndPopulateWhiteAndBlacklists, resolveEffectiveBlacklist, resolveEffectiveWhitelist, resolveWhitelistBlacklistPrecedence, resolveWhitelistBlacklistPredicate
-
-
-
-
Method Detail
-
getAlgorithmRegistry
public org.opensaml.xmlsec.algorithm.AlgorithmRegistry getAlgorithmRegistry()
Get theAlgorithmRegistry
instance used when resolving algorithm URIs. Defaults to the registry obtained viaAlgorithmSupport.getGlobalAlgorithmRegistry()
.- Returns:
- the algorithm registry instance
-
setAlgorithmRegistry
public void setAlgorithmRegistry(@Nonnull org.opensaml.xmlsec.algorithm.AlgorithmRegistry registry)
Set theAlgorithmRegistry
instance used when resolving algorithm URIs. Defaults to the registry obtained viaAlgorithmSupport.getGlobalAlgorithmRegistry()
.- Parameters:
registry
- the new algorithm registry instance
-
resolve
@Nonnull public Iterable<org.opensaml.xmlsec.SignatureSigningParameters> resolve(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria) throws net.shibboleth.utilities.java.support.resolver.ResolverException
- Specified by:
resolve
in interfacenet.shibboleth.utilities.java.support.resolver.Resolver<org.opensaml.xmlsec.SignatureSigningParameters,net.shibboleth.utilities.java.support.resolver.CriteriaSet>
- Throws:
net.shibboleth.utilities.java.support.resolver.ResolverException
-
resolveSingle
@Nullable public org.opensaml.xmlsec.SignatureSigningParameters resolveSingle(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria) throws net.shibboleth.utilities.java.support.resolver.ResolverException
- Specified by:
resolveSingle
in interfacenet.shibboleth.utilities.java.support.resolver.Resolver<org.opensaml.xmlsec.SignatureSigningParameters,net.shibboleth.utilities.java.support.resolver.CriteriaSet>
- Throws:
net.shibboleth.utilities.java.support.resolver.ResolverException
-
logResult
protected void logResult(@Nonnull org.opensaml.xmlsec.SignatureSigningParameters params)
Log the resolved parameters.- Parameters:
params
- the resolved param
-
validate
protected boolean validate(@Nonnull org.opensaml.xmlsec.SignatureSigningParameters params)
Validate that theSignatureSigningParameters
instance has all the required properties populated.- Parameters:
params
- the parameters instance to evaluate- Returns:
- true if parameters instance passes validation, false otherwise
-
getWhitelistBlacklistPredicate
@Nonnull protected Predicate<String> getWhitelistBlacklistPredicate(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Get a predicate which implements the effective configured whitelist/blacklist policy.- Parameters:
criteria
- the input criteria being evaluated- Returns:
- a whitelist/blacklist predicate instance
-
resolveAndPopulateCredentialAndSignatureAlgorithm
protected void resolveAndPopulateCredentialAndSignatureAlgorithm(@Nonnull org.opensaml.xmlsec.SignatureSigningParameters params, @Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, Predicate<String> whitelistBlacklistPredicate)
Resolve and populate the signing credential and signature method algorithm URI on the supplied parameters instance.- Parameters:
params
- the parameters instance being populatedcriteria
- the input criteria being evaluatedwhitelistBlacklistPredicate
- the whitelist/blacklist predicate with which to evaluate the candidate signing method algorithm URIs
-
getAlgorithmRuntimeSupportedPredicate
@Nonnull protected Predicate<String> getAlgorithmRuntimeSupportedPredicate()
Get a predicate which evaluates whether a cryptographic algorithm is supported by the runtime environment.- Returns:
- the predicate
-
credentialSupportsAlgorithm
protected boolean credentialSupportsAlgorithm(@Nonnull org.opensaml.security.credential.Credential credential, @Nonnull @NotEmpty String algorithm)
Evaluate whether the specified credential is supported for use with the specified algorithm URI.- Parameters:
credential
- the credential to evaluatealgorithm
- the algorithm URI to evaluate- Returns:
- true if credential may be used with the supplied algorithm URI, false otherwise
-
getEffectiveSigningCredentials
@Nonnull protected List<org.opensaml.security.credential.Credential> getEffectiveSigningCredentials(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Get the effective list of signing credentials to consider.- Parameters:
criteria
- the input criteria being evaluated- Returns:
- the list of credentials
-
getEffectiveSignatureAlgorithms
@Nonnull protected List<String> getEffectiveSignatureAlgorithms(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, @Nonnull Predicate<String> whitelistBlacklistPredicate)
Get the effective list of signature algorithm URIs to consider, including application of whitelist/blacklist policy.- Parameters:
criteria
- the input criteria being evaluatedwhitelistBlacklistPredicate
- the whitelist/blacklist predicate to use- Returns:
- the list of effective algorithm URIs
-
resolveReferenceDigestMethod
@Nullable protected String resolveReferenceDigestMethod(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, @Nonnull Predicate<String> whitelistBlacklistPredicate)
Resolve and return the digest method algorithm URI to use, including application of whitelist/blacklist policy.- Parameters:
criteria
- the input criteria being evaluatedwhitelistBlacklistPredicate
- the whitelist/blacklist predicate to use- Returns:
- the resolved digest method algorithm URI
-
resolveCanonicalizationAlgorithm
@Nullable protected String resolveCanonicalizationAlgorithm(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Resolve and return the canonicalization algorithm URI to use.- Parameters:
criteria
- the input criteria being evaluated- Returns:
- the canonicalization algorithm URI
-
resolveReferenceCanonicalizationAlgorithm
@Nullable protected String resolveReferenceCanonicalizationAlgorithm(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Resolve and return the reference canonicalization algorithm URI to use.- Parameters:
criteria
- the input criteria being evaluated- Returns:
- the reference canonicalization algorithm URI
-
resolveKeyInfoGenerator
@Nullable protected org.opensaml.xmlsec.keyinfo.KeyInfoGenerator resolveKeyInfoGenerator(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, @Nonnull org.opensaml.security.credential.Credential signingCredential)
Resolve and return theKeyInfoGenerator
instance to use with the specified credential.- Parameters:
criteria
- the input criteria being evaluatedsigningCredential
- the credential being evaluated- Returns:
- KeyInfo generator instance, or null
-
resolveHMACOutputLength
@Nullable protected Integer resolveHMACOutputLength(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria, @Nonnull org.opensaml.security.credential.Credential signingCredential, @Nonnull @NotEmpty String algorithmURI)
Resolve and return the effective HMAC output length to use, if applicable to the specified signing credential and signature method algorithm URI.- Parameters:
criteria
- the input criteria being evaluatedsigningCredential
- the signing credential being evaluatedalgorithmURI
- the signature method algorithm URI being evaluated- Returns:
- the HMAC output length to use, or null
-
-