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 Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder for creatingNimbusJwtDecoderinstances based on a JWK Set uri.static final classA builder for creatingNimbusJwtDecoderinstances based on a public key.static final classA builder for creatingNimbusJwtDecoderinstances based on aSecretKey. -
Constructor Summary
ConstructorsConstructorDescriptionNimbusJwtDecoder(com.nimbusds.jwt.proc.JWTProcessor<com.nimbusds.jose.proc.SecurityContext> jwtProcessor) Configures aNimbusJwtDecoderwith the given parameters -
Method Summary
Modifier 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(OAuth2TokenValidator<Jwt> jwtValidator) Use thisJwtValidatorwithJwkSetUri(String jwkSetUri) Use the given JWK Set uri.Use the given public key to validate JWTswithSecretKey(SecretKey secretKey) Use the givenSecretKeyto validate the MAC on a JSON Web Signature (JWS).
-
Constructor Details
-
NimbusJwtDecoder
public NimbusJwtDecoder(com.nimbusds.jwt.proc.JWTProcessor<com.nimbusds.jose.proc.SecurityContext> jwtProcessor) Configures aNimbusJwtDecoderwith the given parameters- Parameters:
jwtProcessor- - theJWTProcessorto use
-
-
Method Details
-
setJwtValidator
Use thisJwtValidator- Parameters:
jwtValidator- - the Jwt Validator to use
-
setClaimSetConverter
public 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- theConverterto use
-
decode
Decode and validate the JWT from its compact claims representation format- Specified by:
decodein interfaceJwtDecoder- Parameters:
token- the JWT value- Returns:
- a validated
Jwt - Throws:
JwtException
-
withJwkSetUri
Use the given JWK Set uri.- Parameters:
jwkSetUri- the JWK Set uri to use- Returns:
- a
NimbusJwtDecoder.JwkSetUriJwtDecoderBuilderfor further configurations
-
withPublicKey
Use the given public key to validate JWTs- Parameters:
key- the public key to use- Returns:
- a
NimbusJwtDecoder.PublicKeyJwtDecoderBuilderfor further configurations
-
withSecretKey
Use the givenSecretKeyto validate the MAC on a JSON Web Signature (JWS).- Parameters:
secretKey- theSecretKeyused to validate the MAC- Returns:
- a
NimbusJwtDecoder.SecretKeyJwtDecoderBuilderfor further configurations
-