Class JwtValidationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.security.oauth2.jwt.JwtException
org.springframework.security.oauth2.jwt.BadJwtException
org.springframework.security.oauth2.jwt.JwtValidationException
- All Implemented Interfaces:
Serializable
An exception that results from an unsuccessful
OAuth2TokenValidatorResult
- Since:
- 5.1
- See Also:
-
Constructor Summary
ConstructorDescriptionJwtValidationException
(String message, Collection<OAuth2Error> errors) Constructs aJwtValidationException
using the provided parameters While eachOAuth2Error
does contain an error description, this constructor can take an overarching description that encapsulates the composition of failures That said, it is appropriate to pass one of the messages from the error list in as the exception description, for example: -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
JwtValidationException
Constructs aJwtValidationException
using the provided parameters While eachOAuth2Error
does contain an error description, this constructor can take an overarching description that encapsulates the composition of failures That said, it is appropriate to pass one of the messages from the error list in as the exception description, for example:if ( result.hasErrors() ) { Collection<OAuth2Error> errors = result.getErrors(); throw new JwtValidationException(errors.iterator().next().getDescription(), errors); }
- Parameters:
message
- - the exception messageerrors
- - a list ofOAuth2Error
s with extra detail about the validation result
-
-
Method Details
-
getErrors
Return the list ofOAuth2Error
s associated with this exception- Returns:
- the list of
OAuth2Error
s associated with this exception
-