Class NimbusReactiveJwtDecoder
java.lang.Object
org.springframework.security.oauth2.jwt.NimbusReactiveJwtDecoder
- All Implemented Interfaces:
- ReactiveJwtDecoder
An implementation of a 
ReactiveJwtDecoder that "decodes" a JSON Web
 Token (JWT) and additionally verifies its digital signature if the JWT is a JSON Web
 Signature (JWS).
 NOTE: This implementation uses the Nimbus JOSE + JWT SDK internally.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classA builder for creatingNimbusReactiveJwtDecoderinstances based on a JWK Set uri.static final classA builder for creatingNimbusReactiveJwtDecoderinstances.static final classA builder for creatingNimbusReactiveJwtDecoderinstances based on a public key.static final classA builder for creatingNimbusReactiveJwtDecoderinstances based on aSecretKey.
- 
Constructor SummaryConstructorsConstructorDescriptionNimbusReactiveJwtDecoder(String jwkSetUrl) Constructs aNimbusReactiveJwtDecoderusing the provided parameters.NimbusReactiveJwtDecoder(RSAPublicKey publicKey) Constructs aNimbusReactiveJwtDecoderusing the provided parameters.NimbusReactiveJwtDecoder(org.springframework.core.convert.converter.Converter<com.nimbusds.jwt.JWT, reactor.core.publisher.Mono<com.nimbusds.jwt.JWTClaimsSet>> jwtProcessor) Constructs aNimbusReactiveJwtDecoderusing the provided parameters.
- 
Method SummaryModifier and TypeMethodDescriptionreactor.core.publisher.Mono<Jwt>Decodes the JWT from its compact claims representation format and returns aJwt.voidsetClaimSetConverter(org.springframework.core.convert.converter.Converter<Map<String, Object>, Map<String, Object>> claimSetConverter) Use the followingConverterfor manipulating the JWT's claim setvoidsetJwtValidator(org.springframework.security.oauth2.core.OAuth2TokenValidator<Jwt> jwtValidator) Use the providedOAuth2TokenValidatorto validate incomingJwts.withIssuerLocation(String issuer) Use the given Issuer by making an OpenID Provider Configuration Request and using the values in the OpenID Provider Configuration Response to derive the needed JWK Set uri.withJwkSetUri(String jwkSetUri) Use the given JWK Set uri to validate JWTs.withJwkSource(Function<com.nimbusds.jwt.SignedJWT, reactor.core.publisher.Flux<com.nimbusds.jose.jwk.JWK>> source) Use the givenFunctionto validate JWTsUse the given public key to validate JWTswithSecretKey(SecretKey secretKey) Use the givenSecretKeyto validate the MAC on a JSON Web Signature (JWS).
- 
Constructor Details- 
NimbusReactiveJwtDecoderConstructs aNimbusReactiveJwtDecoderusing the provided parameters.- Parameters:
- jwkSetUrl- the JSON Web Key (JWK) Set- URL
 
- 
NimbusReactiveJwtDecoderConstructs aNimbusReactiveJwtDecoderusing the provided parameters.- Parameters:
- publicKey- the- RSAPublicKeyused to verify the signature
- Since:
- 5.2
 
- 
NimbusReactiveJwtDecoderpublic NimbusReactiveJwtDecoder(org.springframework.core.convert.converter.Converter<com.nimbusds.jwt.JWT, reactor.core.publisher.Mono<com.nimbusds.jwt.JWTClaimsSet>> jwtProcessor) Constructs aNimbusReactiveJwtDecoderusing the provided parameters.- Parameters:
- jwtProcessor- the- Converterused to process and verify the signed Jwt and return the Jwt Claim Set
- Since:
- 5.2
 
 
- 
- 
Method Details- 
setJwtValidatorpublic void setJwtValidator(org.springframework.security.oauth2.core.OAuth2TokenValidator<Jwt> jwtValidator) Use the providedOAuth2TokenValidatorto validate incomingJwts.- Parameters:
- jwtValidator- the- OAuth2TokenValidatorto use
 
- 
setClaimSetConverterpublic void setClaimSetConverter(org.springframework.core.convert.converter.Converter<Map<String, Object>, Map<String, Object>> claimSetConverter) Use the followingConverterfor manipulating the JWT's claim set- Parameters:
- claimSetConverter- the- Converterto use
 
- 
decodeDescription copied from interface:ReactiveJwtDecoderDecodes the JWT from its compact claims representation format and returns aJwt.- Specified by:
- decodein interface- ReactiveJwtDecoder
- Parameters:
- token- the JWT value
- Returns:
- a Jwt
 
- 
withIssuerLocationpublic static NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder withIssuerLocation(String issuer) Use the given Issuer by making an OpenID Provider Configuration Request and using the values in the OpenID Provider Configuration Response to derive the needed JWK Set uri.- Parameters:
- issuer- the Issuer
- Returns:
- a NimbusJwtDecoder.JwkSetUriJwtDecoderBuilderthat will derive the JWK Set uri whenNimbusJwtDecoder.JwkSetUriJwtDecoderBuilder.build()is called
- Since:
- 6.1
- See Also:
 
- 
withJwkSetUripublic static NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder withJwkSetUri(String jwkSetUri) Use the given JWK Set uri to validate JWTs.- Parameters:
- jwkSetUri- the JWK Set uri to use
- Returns:
- a NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilderfor further configurations
- Since:
- 5.2
 
- 
withPublicKeypublic static NimbusReactiveJwtDecoder.PublicKeyReactiveJwtDecoderBuilder withPublicKey(RSAPublicKey key) Use the given public key to validate JWTs- Parameters:
- key- the public key to use
- Returns:
- a NimbusReactiveJwtDecoder.PublicKeyReactiveJwtDecoderBuilderfor further configurations
- Since:
- 5.2
 
- 
withSecretKeypublic static NimbusReactiveJwtDecoder.SecretKeyReactiveJwtDecoderBuilder withSecretKey(SecretKey secretKey) Use the givenSecretKeyto validate the MAC on a JSON Web Signature (JWS).- Parameters:
- secretKey- the- SecretKeyused to validate the MAC
- Returns:
- a NimbusReactiveJwtDecoder.SecretKeyReactiveJwtDecoderBuilderfor further configurations
- Since:
- 5.2
 
- 
withJwkSourcepublic static NimbusReactiveJwtDecoder.JwkSourceReactiveJwtDecoderBuilder withJwkSource(Function<com.nimbusds.jwt.SignedJWT, reactor.core.publisher.Flux<com.nimbusds.jose.jwk.JWK>> source) Use the givenFunctionto validate JWTs- Parameters:
- source- the- Function
- Returns:
- a NimbusReactiveJwtDecoder.JwkSourceReactiveJwtDecoderBuilderfor further configurations
- Since:
- 5.2
 
 
-