Package io.helidon.security.abac.time
Class TimeValidator
- java.lang.Object
-
- io.helidon.security.abac.time.TimeValidator
-
- All Implemented Interfaces:
AbacValidator<TimeValidator.TimeConfig>
public final class TimeValidator extends Object implements AbacValidator<TimeValidator.TimeConfig>
Attribute validator for time based attribute checks. Currently supports:- between times (of a day - e.g. 8:30 - 17:00
- days of week (e.g. MONDAY, TUESDAY)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TimeValidator.DaysOfWeek
Attribute annotation that can limit the days of week the resource is accessible.static class
TimeValidator.TimeConfig
Configuration for time attribute validator.static interface
TimeValidator.TimeOfDay
Constraint for a time of day.static interface
TimeValidator.TimesOfDay
Constraint for a time of day - container for repeatingTimeValidator.TimeOfDay
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<TimeValidator.TimeConfig>
configClass()
Class of the configuration type.String
configKey()
Key of a configuration entry that maps to this validator's configuration.static TimeValidator
create()
Return a new instance of this validator with default configuration.TimeValidator.TimeConfig
fromAnnotations(EndpointConfig endpointConfig)
Load configuration class instance from annotations this validator expects.TimeValidator.TimeConfig
fromConfig(Config config)
Load configuration class instance fromConfig
.Collection<Class<? extends Annotation>>
supportedAnnotations()
Provide extension annotations supported by this validator (e.g.void
validate(TimeValidator.TimeConfig config, Errors.Collector collector, ProviderRequest request)
Validate that the configuration provided would grant access to the resource.
-
-
-
Method Detail
-
create
public static TimeValidator create()
Return a new instance of this validator with default configuration.- Returns:
- new time validator
-
configClass
public Class<TimeValidator.TimeConfig> configClass()
Description copied from interface:AbacValidator
Class of the configuration type.- Specified by:
configClass
in interfaceAbacValidator<TimeValidator.TimeConfig>
- Returns:
- class of the type
-
configKey
public String configKey()
Description copied from interface:AbacValidator
Key of a configuration entry that maps to this validator's configuration.- Specified by:
configKey
in interfaceAbacValidator<TimeValidator.TimeConfig>
- Returns:
- key in a config
Config
-
fromConfig
public TimeValidator.TimeConfig fromConfig(Config config)
Description copied from interface:AbacValidator
Load configuration class instance fromConfig
.- Specified by:
fromConfig
in interfaceAbacValidator<TimeValidator.TimeConfig>
- Parameters:
config
- configuration located on the key this validator expects inAbacValidator.configKey()
- Returns:
- instance of configuration class
-
fromAnnotations
public TimeValidator.TimeConfig fromAnnotations(EndpointConfig endpointConfig)
Description copied from interface:AbacValidator
Load configuration class instance from annotations this validator expects.- Specified by:
fromAnnotations
in interfaceAbacValidator<TimeValidator.TimeConfig>
- Parameters:
endpointConfig
- endpoint config- Returns:
- instance of configuration class
-
validate
public void validate(TimeValidator.TimeConfig config, Errors.Collector collector, ProviderRequest request)
Description copied from interface:AbacValidator
Validate that the configuration provided would grant access to the resource. Update collector with errors, if access should be denied usingErrors.Collector.fatal(Object, String)
.- Specified by:
validate
in interfaceAbacValidator<TimeValidator.TimeConfig>
- Parameters:
config
- configuration of this validatorcollector
- error collector to gather issues with this request (e.g. "service not in role ABC")request
- ABAC context containing subject(s), object(s) and environment
-
supportedAnnotations
public Collection<Class<? extends Annotation>> supportedAnnotations()
Description copied from interface:AbacValidator
Provide extension annotations supported by this validator (e.g.RolesAllowed
). Annotations will be collected according to framework in use. For JAX-RS, annotations from application class, resource class and resource methods will be collected. The annotations will be transformed to configuration byAbacValidator.fromAnnotations(EndpointConfig)
.- Specified by:
supportedAnnotations
in interfaceAbacValidator<TimeValidator.TimeConfig>
- Returns:
- Collection of annotations this provider expects.
-
-