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 givenConsumer
to customize theConfigurableJWTProcessor
before 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.JwkSetUriReactiveJwtDecoderBuilder
for further configurations
-
validateType
public NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder validateType(boolean shouldValidateTypHeader) Whether to use Nimbus's typ header verification. This istrue
by default, however it may change tofalse
in a future major release.By turning off this feature,
NimbusReactiveJwtDecoder
expects applications to check thetyp
header themselves in order to determine what kind of validation is neededThis is done for you when you use
JwtValidators
to 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.JwkSetUriReactiveJwtDecoderBuilder
for 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
- aConsumer
for further configuring the algorithm list- Returns:
- a
NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder
for further configurations
-
webClient
public NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder webClient(org.springframework.web.reactive.function.client.WebClient webClient) Use the givenWebClient
to coordinate with the authorization servers indicated in the JWK Set uri as well as the Issuer.- Parameters:
webClient
-- Returns:
- a
NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder
for further configurations
-
jwtProcessorCustomizer
public NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder jwtProcessorCustomizer(Consumer<com.nimbusds.jwt.proc.ConfigurableJWTProcessor<com.nimbusds.jose.proc.JWKSecurityContext>> jwtProcessorCustomizer) Use the givenConsumer
to customize theConfigurableJWTProcessor
before passing it to the buildNimbusReactiveJwtDecoder
.- Parameters:
jwtProcessorCustomizer
- the callback used to alter the processor- Returns:
- a
NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder
for further configurations - Since:
- 5.4
-
build
Build the configuredNimbusReactiveJwtDecoder
.- Returns:
- the configured
NimbusReactiveJwtDecoder
-