Class NimbusJwtDecoder
java.lang.Object
org.springframework.security.oauth2.jwt.NimbusJwtDecoder
- All Implemented Interfaces:
- JwtDecoder
A low-level Nimbus implementation of 
JwtDecoder which takes a raw Nimbus
 configuration.- Since:
- 5.2
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classA builder for creatingNimbusJwtDecoderinstances based on a JWK Set uri.static final classA builder for creatingNimbusJwtDecoderinstances based on aJWKSource.static final classA builder for creatingNimbusJwtDecoderinstances based on a public key.static final classA builder for creatingNimbusJwtDecoderinstances based on aSecretKey.
- 
Constructor SummaryConstructorsConstructorDescriptionNimbusJwtDecoder(com.nimbusds.jwt.proc.JWTProcessor<com.nimbusds.jose.proc.SecurityContext> jwtProcessor) Configures aNimbusJwtDecoderwith the given parameters
- 
Method SummaryModifier and TypeMethodDescriptionDecode and validate the JWT from its compact claims representation formatvoidsetClaimSetConverter(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 thisJwtValidatorwithIssuerLocation(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.withJwkSource(com.nimbusds.jose.jwk.source.JWKSource<com.nimbusds.jose.proc.SecurityContext> jwkSource) Use the givenJWKSourceto create a JwkSourceJwtDecoderBuilder.Use the given public key to validate JWTswithSecretKey(SecretKey secretKey) Use the givenSecretKeyto validate the MAC on a JSON Web Signature (JWS).
- 
Constructor Details- 
NimbusJwtDecoderpublic NimbusJwtDecoder(com.nimbusds.jwt.proc.JWTProcessor<com.nimbusds.jose.proc.SecurityContext> jwtProcessor) Configures aNimbusJwtDecoderwith the given parameters- Parameters:
- jwtProcessor- - the- JWTProcessorto use
 
 
- 
- 
Method Details- 
setJwtValidatorpublic void setJwtValidator(org.springframework.security.oauth2.core.OAuth2TokenValidator<Jwt> jwtValidator) Use thisJwtValidator- Parameters:
- jwtValidator- - the Jwt Validator to 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
 
- 
decodeDecode and validate the JWT from its compact claims representation format- Specified by:
- decodein interface- JwtDecoder
- Parameters:
- token- the JWT value
- Returns:
- a validated Jwt
- Throws:
- JwtException- when the token is malformed or otherwise invalid
 
- 
withIssuerLocationUse 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:
 
- 
withJwkSetUriUse the given JWK Set uri.- Parameters:
- jwkSetUri- the JWK Set uri to use
- Returns:
- a NimbusJwtDecoder.JwkSetUriJwtDecoderBuilderfor further configurations
 
- 
withPublicKeyUse the given public key to validate JWTs- Parameters:
- key- the public key to use
- Returns:
- a NimbusJwtDecoder.PublicKeyJwtDecoderBuilderfor further configurations
 
- 
withSecretKeyUse the givenSecretKeyto validate the MAC on a JSON Web Signature (JWS).- Parameters:
- secretKey- the- SecretKeyused to validate the MAC
- Returns:
- a NimbusJwtDecoder.SecretKeyJwtDecoderBuilderfor further configurations
 
- 
withJwkSourcepublic static NimbusJwtDecoder.JwkSourceJwtDecoderBuilder withJwkSource(com.nimbusds.jose.jwk.source.JWKSource<com.nimbusds.jose.proc.SecurityContext> jwkSource) Use the givenJWKSourceto create a JwkSourceJwtDecoderBuilder.- Parameters:
- jwkSource- the JWK Source to use
- Returns:
- a NimbusJwtDecoder.JwkSetUriJwtDecoderBuilderfor further configurations
- Since:
- 7.0
 
 
-