public final class NimbusJwtDecoderJwkSupport extends java.lang.Object implements JwtDecoder
JwtDecoder
that "decodes" a
JSON Web Token (JWT) and additionally verifies it's digital signature if the JWT is a
JSON Web Signature (JWS). The public key used for verification is obtained from the
JSON Web Key (JWK) Set URL
supplied via the constructor.
NOTE: This implementation uses the Nimbus JOSE + JWT SDK internally.
JwtDecoder
,
JSON Web Token (JWT),
JSON Web Signature (JWS),
JSON Web Key (JWK),
Nimbus JOSE + JWT SDKConstructor and Description |
---|
NimbusJwtDecoderJwkSupport(java.lang.String jwkSetUrl)
Constructs a
NimbusJwtDecoderJwkSupport using the provided parameters. |
NimbusJwtDecoderJwkSupport(java.lang.String jwkSetUrl,
java.lang.String jwsAlgorithm)
Constructs a
NimbusJwtDecoderJwkSupport using the provided parameters. |
Modifier and Type | Method and Description |
---|---|
Jwt |
decode(java.lang.String token)
Decodes the JWT from it's compact claims representation format and returns a
Jwt . |
void |
setClaimSetConverter(org.springframework.core.convert.converter.Converter<java.util.Map<java.lang.String,java.lang.Object>,java.util.Map<java.lang.String,java.lang.Object>> claimSetConverter)
Use the following
Converter for manipulating the JWT's claim set |
void |
setJwtValidator(OAuth2TokenValidator<Jwt> jwtValidator)
Use this
Jwt Validator |
void |
setRestOperations(org.springframework.web.client.RestOperations restOperations)
Sets the
RestOperations used when requesting the JSON Web Key (JWK) Set. |
public NimbusJwtDecoderJwkSupport(java.lang.String jwkSetUrl)
NimbusJwtDecoderJwkSupport
using the provided parameters.jwkSetUrl
- the JSON Web Key (JWK) Set URL
public NimbusJwtDecoderJwkSupport(java.lang.String jwkSetUrl, java.lang.String jwsAlgorithm)
NimbusJwtDecoderJwkSupport
using the provided parameters.jwkSetUrl
- the JSON Web Key (JWK) Set URL
jwsAlgorithm
- the JSON Web Algorithm (JWA) used for verifying the digital signaturespublic Jwt decode(java.lang.String token) throws JwtException
JwtDecoder
Jwt
.decode
in interface JwtDecoder
token
- the JWT valueJwt
JwtException
- if an error occurs while attempting to decode the JWTpublic void setJwtValidator(OAuth2TokenValidator<Jwt> jwtValidator)
Jwt
ValidatorjwtValidator
- - the Jwt Validator to usepublic final void setClaimSetConverter(org.springframework.core.convert.converter.Converter<java.util.Map<java.lang.String,java.lang.Object>,java.util.Map<java.lang.String,java.lang.Object>> claimSetConverter)
Converter
for manipulating the JWT's claim setclaimSetConverter
- the Converter
to usepublic final void setRestOperations(org.springframework.web.client.RestOperations restOperations)
RestOperations
used when requesting the JSON Web Key (JWK) Set.restOperations
- the RestOperations
used when requesting the JSON Web Key (JWK) Set