public class InvalidJwtException extends Exception
| Constructor and Description |
|---|
InvalidJwtException(String message,
ErrorCodeValidator.Error detail,
Throwable cause,
JwtContext jwtContext) |
InvalidJwtException(String message,
List<ErrorCodeValidator.Error> details,
JwtContext jwtContext) |
| Modifier and Type | Method and Description |
|---|---|
List<ErrorCodeValidator.Error> |
getErrorDetails()
Returns a list of reasons the JWT was considered invalid.
|
JwtContext |
getJwtContext()
Returns a
JwtContext object including the JwtClaims
representing the JWT processed
up to the point of this InvalidJwtException being thrown. |
String |
getMessage() |
String |
getOriginalMessage()
Returns the original message of this exception without the details.
|
boolean |
hasErrorCode(int code)
Provides programmatic access to (some) specific reasons for JWT invalidity
by indicating if the given error code was one of the reasons for the
JWT being considered invalid.
|
boolean |
hasExpired()
Indicates if the JWT was invalid because it had expired
(i.e.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic InvalidJwtException(String message, List<ErrorCodeValidator.Error> details, JwtContext jwtContext)
public InvalidJwtException(String message, ErrorCodeValidator.Error detail, Throwable cause, JwtContext jwtContext)
public boolean hasErrorCode(int code)
Provides programmatic access to (some) specific reasons for JWT invalidity by indicating if the given error code was one of the reasons for the JWT being considered invalid.
Error codes used by this library are defined in ErrorCodes.
code - the given error codepublic boolean hasExpired()
hasErrorCode(ErrorCodes.EXPIRED)public List<ErrorCodeValidator.Error> getErrorDetails()
public JwtContext getJwtContext()
JwtContext object including the JwtClaims
representing the JWT processed
up to the point of this InvalidJwtException being thrown.
Some care should be taken when using this because, depending on what kind
of error was encountered in processing the JWT and
when it was encountered, the JwtContext may not be complete.JwtContextpublic String getMessage()
getMessage in class Throwablepublic String getOriginalMessage()
Copyright © 2022. All rights reserved.