Class JwtTypeValidator

java.lang.Object
org.springframework.security.oauth2.jwt.JwtTypeValidator
All Implemented Interfaces:
OAuth2TokenValidator<Jwt>

public final class JwtTypeValidator extends Object implements OAuth2TokenValidator<Jwt>
A validator for the typ header. Specifically for indicating the header values that a given JwtDecoder will support.
Since:
6.5
  • Constructor Details

    • JwtTypeValidator

      public JwtTypeValidator(Collection<String> validTypes)
    • JwtTypeValidator

      public JwtTypeValidator(String... validTypes)
  • Method Details

    • jwt

      public static JwtTypeValidator jwt()
      Require that the typ header be JWT or absent
    • setAllowEmpty

      public void setAllowEmpty(boolean allowEmpty)
      Whether to allow the typ header to be empty. The default value is false
    • validate

      public OAuth2TokenValidatorResult validate(Jwt token)
      Description copied from interface: OAuth2TokenValidator
      Verify the validity and/or constraints of the provided OAuth 2.0 Token.
      Specified by:
      validate in interface OAuth2TokenValidator<Jwt>
      Parameters:
      token - an OAuth 2.0 token
      Returns:
      OAuth2TokenValidationResult the success or failure detail of the validation