Class NimbusJwtDecoder.SecretKeyJwtDecoderBuilder
- Enclosing class:
- NimbusJwtDecoder
NimbusJwtDecoder instances based on a
SecretKey.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the configuredNimbusJwtDecoder.jwtProcessorCustomizer(Consumer<com.nimbusds.jwt.proc.ConfigurableJWTProcessor<com.nimbusds.jose.proc.SecurityContext>> jwtProcessorCustomizer) Use the givenConsumerto customize theConfigurableJWTProcessorbefore passing it to the buildNimbusJwtDecoder.macAlgorithm(MacAlgorithm macAlgorithm) Use the given algorithm when generating the MAC.validateType(boolean shouldValidateTypHeader) Whether to use Nimbus'stypheader verification.
-
Method Details
-
validateType
Whether to use Nimbus'stypheader verification. This isfalseby default.By turning on this feature,
NimbusJwtDecoderwill delegate checking thetypheader to Nimbus by using Nimbus's defaultJOSEObjectTypeVerifier.When this is set to
false, this:NimbusJwtDecoder jwtDecoder = NimbusJwtDecoder.withIssuerLocation(issuer).build(); jwtDecoder.setJwtValidator(JwtValidators.createDefaultWithIssuer(issuer);Is equivalent to this:
NimbusJwtDecoder jwtDecoder = NimbusJwtDecoder.withIssuerLocation(issuer) .validateType(false) .build(); jwtDecoder.setJwtValidator(JwtValidators.createDefaultWithValidators( new JwtIssuerValidator(issuer), JwtTypeValidator.jwt());The difference is that by setting this to
false, it allows you to provide validation by type, like forat+jwt:NimbusJwtDecoder jwtDecoder = NimbusJwtDecoder.withIssuerLocation(issuer) .validateType(false) .build(); jwtDecoder.setJwtValidator(new MyAtJwtValidator());- Parameters:
shouldValidateTypHeader- whether Nimbus should validate the typ header or not- Returns:
- a
NimbusJwtDecoder.JwkSetUriJwtDecoderBuilderfor further configurations - Since:
- 6.5
-
macAlgorithm
Use the given algorithm when generating the MAC. The value should be one of HS256, HS384 or HS512.- Parameters:
macAlgorithm- the MAC algorithm to use- Returns:
- a
NimbusJwtDecoder.SecretKeyJwtDecoderBuilderfor further configurations
-
jwtProcessorCustomizer
public NimbusJwtDecoder.SecretKeyJwtDecoderBuilder jwtProcessorCustomizer(Consumer<com.nimbusds.jwt.proc.ConfigurableJWTProcessor<com.nimbusds.jose.proc.SecurityContext>> jwtProcessorCustomizer) Use the givenConsumerto customize theConfigurableJWTProcessorbefore passing it to the buildNimbusJwtDecoder.- Parameters:
jwtProcessorCustomizer- the callback used to alter the processor- Returns:
- a
NimbusJwtDecoder.SecretKeyJwtDecoderBuilderfor further configurations - Since:
- 5.4
-
build
Build the configuredNimbusJwtDecoder.- Returns:
- the configured
NimbusJwtDecoder
-