- java.lang.Object
-
- io.helidon.security.jwt.Jwt.FieldValidator
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Jwt.FieldValidatorcreate(Function<Jwt,Optional<String>> fieldAccessor, String name, String expectedValue)A generic optional field validator based on a function to get the field.static Jwt.FieldValidatorcreate(Function<Jwt,Optional<String>> fieldAccessor, String name, String expectedValue, boolean mandatory)A generic field validator based on a function to get the field.static Jwt.FieldValidatorcreateForHeader(String fieldKey, String name, String expectedValue)An optional header field validator.static Jwt.FieldValidatorcreateForHeader(String fieldKey, String name, String expectedValue, boolean mandatory)A header field validator.static Jwt.FieldValidatorcreateForPayload(String fieldKey, String name, String expectedValue)An optional payload field validator.static Jwt.FieldValidatorcreateForPayload(String fieldKey, String name, String expectedValue, boolean mandatory)A payload field validator.voidvalidate(Jwt token, Errors.Collector collector)Validate the object against this class's configuration.
-
-
-
Method Detail
-
create
public static Jwt.FieldValidator create(Function<Jwt,Optional<String>> fieldAccessor, String name, String expectedValue)
A generic optional field validator based on a function to get the field.- Parameters:
fieldAccessor- function to extract field from JWTname- descriptive name of the fieldexpectedValue- value to expect- Returns:
- validator instance
-
create
public static Jwt.FieldValidator create(Function<Jwt,Optional<String>> fieldAccessor, String name, String expectedValue, boolean mandatory)
A generic field validator based on a function to get the field.- Parameters:
fieldAccessor- function to extract field from JWTname- descriptive name of the fieldexpectedValue- value to expectmandatory- true for mandatory, false for optional- Returns:
- validator instance
-
createForHeader
public static Jwt.FieldValidator createForHeader(String fieldKey, String name, String expectedValue)
An optional header field validator.- Parameters:
fieldKey- name of the header claimname- descriptive name of the fieldexpectedValue- value to expect- Returns:
- validator instance
-
createForHeader
public static Jwt.FieldValidator createForHeader(String fieldKey, String name, String expectedValue, boolean mandatory)
A header field validator.- Parameters:
fieldKey- name of the header claimname- descriptive name of the fieldexpectedValue- value to expectmandatory- whether the field is mandatory or optional- Returns:
- validator instance
-
createForPayload
public static Jwt.FieldValidator createForPayload(String fieldKey, String name, String expectedValue)
An optional payload field validator.- Parameters:
fieldKey- name of the payload claimname- descriptive name of the fieldexpectedValue- value to expect- Returns:
- validator instance
-
createForPayload
public static Jwt.FieldValidator createForPayload(String fieldKey, String name, String expectedValue, boolean mandatory)
A payload field validator.- Parameters:
fieldKey- name of the payload claimname- descriptive name of the fieldexpectedValue- value to expectmandatory- whether the field is mandatory or optional- Returns:
- validator instance
-
validate
public void validate(Jwt token, Errors.Collector collector)
Description copied from interface:ValidatorValidate the object against this class's configuration.- Specified by:
validatein interfaceValidator<Jwt>- Parameters:
token- object to validatecollector- collector of error messages to add problems to. UseErrors.Collector.fatal(Object, String)to mark the validation as a failure
-
-