Class JwtValidationException

All Implemented Interfaces:
Serializable

public class JwtValidationException extends BadJwtException
An exception that results from an unsuccessful OAuth2TokenValidatorResult
Since:
5.1
See Also:
  • Constructor Details

    • JwtValidationException

      public JwtValidationException(String message, Collection<OAuth2Error> errors)
      Constructs a JwtValidationException using the provided parameters While each OAuth2Error 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 message
      errors - - a list of OAuth2Errors with extra detail about the validation result
  • Method Details