Class ClientInformationJWTTrustEngine
- java.lang.Object
-
- net.shibboleth.oidc.security.impl.BaseSignedJWTTrustEngine<Iterable<Credential>>
-
- net.shibboleth.oidc.security.impl.ExplicitKeySignedJWTTrustEngine
-
- net.shibboleth.oidc.security.impl.ClientInformationJWTTrustEngine
-
- All Implemented Interfaces:
TrustedCredentialTrustEngine<com.nimbusds.jwt.SignedJWT>,TrustEngine<com.nimbusds.jwt.SignedJWT>
public class ClientInformationJWTTrustEngine extends ExplicitKeySignedJWTTrustEngine implements TrustedCredentialTrustEngine<com.nimbusds.jwt.SignedJWT>
An implementation ofSignatureTrustEnginewhich evaluates the validity and trustworthiness of JWT signatures.This extends
ExplicitKeySignedJWTTrustEngineby adding a configurable lookup strategy for the signature algorithm that must be used in the incoming token. Also a default value can be set if the function returns no value. If neither function is returning value nor the default value is set, then any signature accepted by the parent class is accepted.- Since:
- 2.2.0
-
-
Field Summary
Fields Modifier and Type Field Description private StringdefaultAlgorithmValueThe default algorithm value used if lookup strategy returned null.private org.slf4j.LoggerlogClass logger.private Function<com.nimbusds.openid.connect.sdk.rp.OIDCClientInformation,String>signatureAlgorithmLookupStrategyA lookup function for the signature algorithm in the client metadata.
-
Constructor Summary
Constructors Constructor Description ClientInformationJWTTrustEngine(CredentialResolver resolver, JOSEObjectCredentialResolver joseObjectResolver, Function<com.nimbusds.openid.connect.sdk.rp.OIDCClientInformation,String> strategy, String defaultValue)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleandoValidate(com.nimbusds.jwt.SignedJWT signedJWT, CriteriaSet trustBasisCriteria)Validate the signed JWT using the supplied trust criteria.protected StringgetExpectedAlgorithm(ClientInformationCriterion criterion)Fetches the expected signature algorithm from theOIDCClientInformation.-
Methods inherited from class net.shibboleth.oidc.security.impl.ExplicitKeySignedJWTTrustEngine
evaluateTrust, getCredentialResolver
-
Methods inherited from class net.shibboleth.oidc.security.impl.BaseSignedJWTTrustEngine
checkParams, resolveTokenCredentials, validate, validate, verifySignature
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opensaml.security.trust.TrustedCredentialTrustEngine
getCredentialResolver
-
Methods inherited from interface org.opensaml.security.trust.TrustEngine
validate
-
-
-
-
Field Detail
-
log
private final org.slf4j.Logger log
Class logger.
-
signatureAlgorithmLookupStrategy
@Nonnull private final Function<com.nimbusds.openid.connect.sdk.rp.OIDCClientInformation,String> signatureAlgorithmLookupStrategy
A lookup function for the signature algorithm in the client metadata.
-
defaultAlgorithmValue
@Nullable private final String defaultAlgorithmValue
The default algorithm value used if lookup strategy returned null.
-
-
Constructor Detail
-
ClientInformationJWTTrustEngine
public ClientInformationJWTTrustEngine(@Nonnull @ParameterName(name="resolver") CredentialResolver resolver, @Nonnull @ParameterName(name="JOSEObjectResolver") JOSEObjectCredentialResolver joseObjectResolver, @Nonnull @ParameterName(name="signatureAlgorithmLookupStrategy") Function<com.nimbusds.openid.connect.sdk.rp.OIDCClientInformation,String> strategy, @Nullable @ParameterName(name="defaultAlgorithmValue") String defaultValue)
Constructor.- Parameters:
resolver- credential resolver used to resolve trusted credentials.joseObjectResolver- resolver which resolve credentials from the headers of aJOSEObjectinstance.strategy- lookup strategy for the signature algorithm in the client metadata.defaultValue- the default signature algorithm value.
-
-
Method Detail
-
doValidate
protected boolean doValidate(@Nonnull com.nimbusds.jwt.SignedJWT signedJWT, @Nonnull CriteriaSet trustBasisCriteria) throws SecurityExceptionValidate the signed JWT using the supplied trust criteria.- Overrides:
doValidatein classExplicitKeySignedJWTTrustEngine- Parameters:
signedJWT- the signed JWT to validatetrustBasisCriteria- criteria used to describe and/or resolve the information which serves as the basis for trust evaluation- Returns:
- true if signature is valid and trusted, false otherwise
- Throws:
SecurityException- if there is a fatal error evaluating the signature
-
getExpectedAlgorithm
@Nullable protected String getExpectedAlgorithm(@Nonnull ClientInformationCriterion criterion)
Fetches the expected signature algorithm from theOIDCClientInformation.- Parameters:
criterion- criterion containing the client information/metadata.- Returns:
- the expected algorithm value.
-
-