Class NimbusReactiveJwtDecoder.JwkSourceReactiveJwtDecoderBuilder
- Enclosing class:
- NimbusReactiveJwtDecoder
NimbusReactiveJwtDecoder instances.- Since:
- 5.2
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the configuredNimbusReactiveJwtDecoder.jwsAlgorithm(JwsAlgorithm jwsAlgorithm) Use the given signing algorithm.jwtProcessorCustomizer(Consumer<com.nimbusds.jwt.proc.ConfigurableJWTProcessor<com.nimbusds.jose.proc.JWKSecurityContext>> jwtProcessorCustomizer) Use the givenConsumerto customize theConfigurableJWTProcessorbefore passing it to the buildNimbusReactiveJwtDecoder.validateType(boolean shouldValidateTypHeader) Whether to use Nimbus's typ header verification.
-
Method Details
-
jwsAlgorithm
public NimbusReactiveJwtDecoder.JwkSourceReactiveJwtDecoderBuilder jwsAlgorithm(JwsAlgorithm jwsAlgorithm) Use the given signing algorithm.- Parameters:
jwsAlgorithm- the algorithm to use- Returns:
- a
NimbusReactiveJwtDecoder.JwkSourceReactiveJwtDecoderBuilderfor further configurations
-
validateType
public NimbusReactiveJwtDecoder.JwkSourceReactiveJwtDecoderBuilder validateType(boolean shouldValidateTypHeader) Whether to use Nimbus's typ header verification. This istrueby default, however it may change tofalsein a future major release.By turning off this feature,
NimbusReactiveJwtDecoderexpects applications to check thetypheader themselves in order to determine what kind of validation is neededThis is done for you when you use
JwtValidatorsto construct a validator.That means that this:
NimbusReactiveJwtDecoder jwtDecoder = NimbusReactiveJwtDecoder.withJwkSource(issuer).build(); jwtDecoder.setJwtValidator(JwtValidators.createDefaultWithIssuer(issuer);Is equivalent to this:
NimbusReactiveJwtDecoder jwtDecoder = NimbusReactiveJwtDecoder.withJwkSource(key) .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:NimbusReactiveJwtDecoder jwtDecoder = NimbusReactiveJwtDecoder.withJwkSource(key) .validateType(false) .build(); jwtDecoder.setJwtValidator(new MyAtJwtValidator());- Parameters:
shouldValidateTypHeader- whether Nimbus should validate the typ header or not- Returns:
- a
NimbusReactiveJwtDecoder.JwkSourceReactiveJwtDecoderBuilderfor further configurations - Since:
- 6.5
-
jwtProcessorCustomizer
public NimbusReactiveJwtDecoder.JwkSourceReactiveJwtDecoderBuilder jwtProcessorCustomizer(Consumer<com.nimbusds.jwt.proc.ConfigurableJWTProcessor<com.nimbusds.jose.proc.JWKSecurityContext>> jwtProcessorCustomizer) Use the givenConsumerto customize theConfigurableJWTProcessorbefore passing it to the buildNimbusReactiveJwtDecoder.- Parameters:
jwtProcessorCustomizer- the callback used to alter the processor- Returns:
- a
NimbusReactiveJwtDecoder.JwkSourceReactiveJwtDecoderBuilderfor further configurations - Since:
- 5.4
-
build
Build the configuredNimbusReactiveJwtDecoder.- Returns:
- the configured
NimbusReactiveJwtDecoder
-