T - the type of value returned from the subclass handler method implementation.public class SupportedJwtVisitor<T> extends Object implements JwtVisitor<T>
JwtVisitor that guarantees only supported JWT instances are handled, rejecting
all other (unsupported) JWTs with UnsupportedJwtExceptions. A JWT is considered supported
only if the type-specific handler method is overridden by a subclass.| Constructor and Description |
|---|
SupportedJwtVisitor()
Default constructor, does not initialize any internal state.
|
| Modifier and Type | Method and Description |
|---|---|
T |
onDecryptedClaims(Jwe<Claims> jwe)
Handles an encountered JWE message that has been authenticated and decrypted, and has a
Claims payload. |
T |
onDecryptedContent(Jwe<byte[]> jwe)
Handles an encountered JWE message that has been authenticated and decrypted, and has byte[] array payload.
|
T |
onUnsecuredClaims(Jwt<Header,Claims> jwt)
Handles an encountered unsecured Claims JWT - one that is not cryptographically signed nor
encrypted, and has a
Claims payload. |
T |
onUnsecuredContent(Jwt<Header,byte[]> jwt)
Handles an encountered unsecured content JWT - one that is not cryptographically signed nor
encrypted, and has a byte[] array payload.
|
T |
onVerifiedClaims(Jws<Claims> jws)
Handles an encountered JWS message that has been cryptographically verified/authenticated and has a
Claims payload. |
T |
onVerifiedContent(Jws<byte[]> jws)
Handles an encountered JWS message that has been cryptographically verified/authenticated and has
a byte[] array payload.
|
T |
visit(Jwe<?> jwe)
Handles an encountered JSON Web Encryption (aka 'JWE') message that has been authenticated and decrypted by
delegating to either
onDecryptedContent(Jwe) or onDecryptedClaims(Jwe) depending on the
payload type. |
T |
visit(Jws<?> jws)
Handles an encountered JSON Web Token (aka 'JWS') message that has been cryptographically verified/authenticated
by delegating to either
onVerifiedContent(Jws) or onVerifiedClaims(Jws) depending on the payload
type. |
T |
visit(Jwt<?,?> jwt)
Handles an encountered unsecured JWT by delegating to either
onUnsecuredContent(Jwt) or
onUnsecuredClaims(Jwt) depending on the payload type. |
public SupportedJwtVisitor()
public T visit(Jwt<?,?> jwt)
onUnsecuredContent(Jwt) or
onUnsecuredClaims(Jwt) depending on the payload type.visit in interface JwtVisitor<T>jwt - the parsed unsecured JWTonUnsecuredContent(Jwt) or onUnsecuredClaims(Jwt)
depending on the payload type.UnsupportedJwtException - if the payload is neither a byte[] nor Claims, or either
delegate method throws the same.public T onUnsecuredContent(Jwt<Header,byte[]> jwt) throws UnsupportedJwtException
Header.getContentType() value, the application may inspect that value to determine how to convert
the byte array to the final type as desired.
The default implementation immediately throws an UnsupportedJwtException; it is expected that
subclasses will override this method if the application needs to support this type of JWT.
jwt - the parsed unsecured content JWTnull if no return value is necessary.UnsupportedJwtException - by default, expecting the subclass implementation to override as necessary.public T onUnsecuredClaims(Jwt<Header,Claims> jwt)
Claims payload.
The default implementation immediately throws an UnsupportedJwtException; it is expected that
subclasses will override this method if the application needs to support this type of JWT.
jwt - the parsed unsecured content JWTnull if no return value is necessary.UnsupportedJwtException - by default, expecting the subclass implementation to override as necessary.public T visit(Jws<?> jws)
onVerifiedContent(Jws) or onVerifiedClaims(Jws) depending on the payload
type.visit in interface JwtVisitor<T>jws - the parsed verified/authenticated JWS.onVerifiedContent(Jws) or onVerifiedClaims(Jws)
depending on the payload type.UnsupportedJwtException - if the payload is neither a byte[] nor Claims, or either
delegate method throws the same.public T onVerifiedContent(Jws<byte[]> jws)
Header.getContentType() value, the
application may inspect that value to determine how to convert the byte array to the final type as desired.
The default implementation immediately throws an UnsupportedJwtException; it is expected that
subclasses will override this method if the application needs to support this type of JWT.
jws - the parsed verified/authenticated JWS.null if no return value is necessary.UnsupportedJwtException - by default, expecting the subclass implementation to override as necessary.public T onVerifiedClaims(Jws<Claims> jws)
Claims payload.
The default implementation immediately throws an UnsupportedJwtException; it is expected that
subclasses will override this method if the application needs to support this type of JWT.
jws - the parsed signed (and verified) Claims JWSnull if no return value is necessary.UnsupportedJwtException - by default, expecting the subclass implementation to override as necessary.public T visit(Jwe<?> jwe)
onDecryptedContent(Jwe) or onDecryptedClaims(Jwe) depending on the
payload type.visit in interface JwtVisitor<T>jwe - the parsed authenticated and decrypted JWE.onDecryptedContent(Jwe) or onDecryptedClaims(Jwe)
depending on the payload type.UnsupportedJwtException - if the payload is neither a byte[] nor Claims, or either
delegate method throws the same.public T onDecryptedContent(Jwe<byte[]> jwe)
Header.getContentType() value, the application may inspect that
value to determine how to convert the byte array to the final type as desired.
The default implementation immediately throws an UnsupportedJwtException; it is expected that
subclasses will override this method if the application needs to support this type of JWT.
jwe - the parsed authenticated and decrypted content JWE.null if no return value is necessary.UnsupportedJwtException - by default, expecting the subclass implementation to override as necessary.public T onDecryptedClaims(Jwe<Claims> jwe)
Claims payload.
The default implementation immediately throws an UnsupportedJwtException; it is expected that
subclasses will override this method if the application needs to support this type of JWT.
jwe - the parsed authenticated and decrypted content JWE.null if no return value is necessary.UnsupportedJwtException - by default, expecting the subclass implementation to override as necessary.Copyright © 2014–2023 jsonwebtoken.io. All rights reserved.