@ThreadSafe public class DefaultJWTDecoder extends Object implements JWTDecoder
Supports:
Not supported: JWS-signed and then JWE-encrypted (nested) objects.
Constructor and Description |
---|
DefaultJWTDecoder()
Creates a new decoder of JSON Web Tokens (JWTs).
|
Modifier and Type | Method and Description |
---|---|
void |
addJWEDecrypter(com.nimbusds.jose.JWEDecrypter decrypter)
Adds the specified JWE decrypter for decoding encrypted JWTs.
|
void |
addJWSVerifier(com.nimbusds.jose.JWSVerifier verifier)
Adds the specified JWS verifier for decoding signed JWTs.
|
com.nimbusds.jwt.ReadOnlyJWTClaimsSet |
decodeJWT(com.nimbusds.jwt.JWT jwt)
Decodes a JWT object, then applies JWS signature validation and / or
JWE decryption if the token is secured.
|
Collection<com.nimbusds.jose.JWEDecrypter> |
getJWEDecrypters()
Gets the JWE decrypters.
|
Collection<com.nimbusds.jose.JWSVerifier> |
getJWSVerifiers()
Gets the JWS verifiers.
|
public DefaultJWTDecoder()
public void addJWSVerifier(com.nimbusds.jose.JWSVerifier verifier)
verifier
- The JWS verifier to add. Must be ready to verify
signed JWTs and not null
.public Collection<com.nimbusds.jose.JWSVerifier> getJWSVerifiers()
public void addJWEDecrypter(com.nimbusds.jose.JWEDecrypter decrypter)
decrypter
- The JWE decrypter to add. Must be ready to decrypt
encrypted JWTs and not null
.public Collection<com.nimbusds.jose.JWEDecrypter> getJWEDecrypters()
public com.nimbusds.jwt.ReadOnlyJWTClaimsSet decodeJWT(com.nimbusds.jwt.JWT jwt) throws com.nimbusds.jose.JOSEException, ParseException
JWTDecoder
decodeJWT
in interface JWTDecoder
jwt
- The JWT to decode. Must not be null
.com.nimbusds.jose.JOSEException
- If decoding, JWS validation and / or JWE
decryption of the JWT failed.ParseException
- If parsing of the JWT claims set failed.Copyright © 2014 Connect2id Ltd.. All Rights Reserved.