Class NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder
- Enclosing class:
- NimbusReactiveJwtDecoder
NimbusReactiveJwtDecoder instances based on a
JWK Set
uri.- Since:
- 5.2
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the configuredNimbusReactiveJwtDecoder.jwsAlgorithm(SignatureAlgorithm signatureAlgorithm) Append the given signing algorithm to the set of algorithms to use.jwsAlgorithms(Consumer<Set<SignatureAlgorithm>> signatureAlgorithmsConsumer) Configure the list of algorithms to use with the givenConsumer.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.webClient(org.springframework.web.reactive.function.client.WebClient webClient)
-
Method Details
-
jwsAlgorithm
public NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder jwsAlgorithm(SignatureAlgorithm signatureAlgorithm) Append the given signing algorithm to the set of algorithms to use.- Parameters:
signatureAlgorithm- the algorithm to use- Returns:
- a
NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilderfor further configurations
-
validateType
public NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder 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.withIssuerLocation(issuer).build(); jwtDecoder.setJwtValidator(JwtValidators.createDefaultWithIssuer(issuer);Is equivalent to this:
NimbusReactiveJwtDecoder jwtDecoder = NimbusReactiveJwtDecoder.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:NimbusReactiveJwtDecoder jwtDecoder = NimbusReactiveJwtDecoder.withIssuerLocation(issuer) .validateType(false) .build(); jwtDecoder.setJwtValidator(new MyAtJwtValidator());- Parameters:
shouldValidateTypHeader- whether Nimbus should validate the typ header or not- Returns:
- a
NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilderfor further configurations - Since:
- 6.5
-
jwsAlgorithms
public NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder jwsAlgorithms(Consumer<Set<SignatureAlgorithm>> signatureAlgorithmsConsumer) Configure the list of algorithms to use with the givenConsumer.- Parameters:
signatureAlgorithmsConsumer- aConsumerfor further configuring the algorithm list- Returns:
- a
NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilderfor further configurations
-
webClient
public NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder webClient(org.springframework.web.reactive.function.client.WebClient webClient) Use the givenWebClientto coordinate with the authorization servers indicated in the JWK Set uri as well as the Issuer.- Parameters:
webClient-- Returns:
- a
NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilderfor further configurations
-
jwtProcessorCustomizer
public NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder 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.JwkSetUriReactiveJwtDecoderBuilderfor further configurations - Since:
- 5.4
-
build
Build the configuredNimbusReactiveJwtDecoder.- Returns:
- the configured
NimbusReactiveJwtDecoder
-