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
Modifier and TypeClassDescriptionstatic final class
A builder for creatingNimbusJwtDecoder
instances based on a JWK Set uri.static final class
A builder for creatingNimbusJwtDecoder
instances based on a public key.static final class
A builder for creatingNimbusJwtDecoder
instances based on aSecretKey
. -
Constructor Summary
ConstructorDescriptionNimbusJwtDecoder
(com.nimbusds.jwt.proc.JWTProcessor<com.nimbusds.jose.proc.SecurityContext> jwtProcessor) Configures aNimbusJwtDecoder
with the given parameters -
Method Summary
Modifier and TypeMethodDescriptionDecode and validate the JWT from its compact claims representation formatvoid
setClaimSetConverter
(org.springframework.core.convert.converter.Converter<Map<String, Object>, Map<String, Object>> claimSetConverter) Use the followingConverter
for manipulating the JWT's claim setvoid
setJwtValidator
(OAuth2TokenValidator<Jwt> jwtValidator) Use thisJwt
ValidatorwithIssuerLocation
(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.Use the given public key to validate JWTswithSecretKey
(SecretKey secretKey) Use the givenSecretKey
to 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 aNimbusJwtDecoder
with the given parameters- Parameters:
jwtProcessor
- - theJWTProcessor
to use
-
-
Method Details
-
setJwtValidator
Use thisJwt
Validator- 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 followingConverter
for manipulating the JWT's claim set- Parameters:
claimSetConverter
- theConverter
to use
-
decode
Decode and validate the JWT from its compact claims representation format- Specified by:
decode
in interfaceJwtDecoder
- Parameters:
token
- the JWT value- Returns:
- a validated
Jwt
- Throws:
JwtException
-
withIssuerLocation
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.JwkSetUriJwtDecoderBuilder
that will derive the JWK Set uri whenNimbusJwtDecoder.JwkSetUriJwtDecoderBuilder.build()
is called - Since:
- 6.1
- See Also:
-
withJwkSetUri
Use the given JWK Set uri.- Parameters:
jwkSetUri
- the JWK Set uri to use- Returns:
- a
NimbusJwtDecoder.JwkSetUriJwtDecoderBuilder
for further configurations
-
withPublicKey
Use the given public key to validate JWTs- Parameters:
key
- the public key to use- Returns:
- a
NimbusJwtDecoder.PublicKeyJwtDecoderBuilder
for further configurations
-
withSecretKey
Use the givenSecretKey
to validate the MAC on a JSON Web Signature (JWS).- Parameters:
secretKey
- theSecretKey
used to validate the MAC- Returns:
- a
NimbusJwtDecoder.SecretKeyJwtDecoderBuilder
for further configurations
-