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:
java.io.Serializable
public class JwtValidationException extends BadJwtException
An exception that results from an unsuccessfulOAuth2TokenValidatorResult
- Since:
- 5.1
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JwtValidationException(java.lang.String message, java.util.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<OAuth2Error>
getErrors()
Return the list ofOAuth2Error
s associated with this exception
-
-
-
Constructor Detail
-
JwtValidationException
public JwtValidationException(java.lang.String message, java.util.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:if ( result.hasErrors() ) { Collection
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 Detail
-
getErrors
public java.util.Collection<OAuth2Error> getErrors()
Return the list ofOAuth2Error
s associated with this exception- Returns:
- the list of
OAuth2Error
s associated with this exception
-
-