Package net.shibboleth.idp.profile.logic
Class DateAttributePredicate
java.lang.Object
net.shibboleth.idp.profile.logic.AbstractAttributePredicate
net.shibboleth.idp.profile.logic.DateAttributePredicate
- All Implemented Interfaces:
Predicate<ProfileRequestContext>
,Predicate<ProfileRequestContext>
Provides a date/time matching predicate that compares a date-based attribute value against
current system time with optional offset. By convention the predicate returns true if and only if
the date represented by the attribute value is after the current system time; false otherwise.
Thus the semantics are well-suited for cases such as evaluation of expiration dates.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
Name of attribute to query for.private DateTimeFormatter
Formatter used to parse string-based date attribute values.private DateTimeFormatter
Deprecated.private final org.slf4j.Logger
Class logger.private boolean
Result of predicate if attribute is missing or has no values.private Duration
Offset from system time used for date comparisons. -
Constructor Summary
ConstructorsConstructorDescriptionDateAttributePredicate
(String attribute) Deprecated.DateAttributePredicate
(String attribute, String formatString) Create a new instance that performs date comparisons against the given attribute using the given date parser.DateAttributePredicate
(String attribute, DateTimeFormatter formatter) Create a new instance that performs date comparisons against the given attribute using the given date parser.DateAttributePredicate
(String attribute, DateTimeFormatter formatter) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Get the result of the predicate in the case the attribute context is null.protected boolean
hasMatch
(Map<String, IdPAttribute> attributeMap) Abstract implementation of the condition to evaluate.void
Set the system time offset, which affects the reference date for comparisons.void
setResultIfMissing
(boolean flag) Set the result to return if the attribute to check is missing or has no values.void
setSystemTimeOffset
(Duration offset) Deprecated.Methods inherited from class net.shibboleth.idp.profile.logic.AbstractAttributePredicate
getAttributeContextLookupStrategy, isUseUnfilteredAttributes, setAttributeContextLookupStrategy, setUseUnfilteredAttributes, test
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
attributeName
Name of attribute to query for. -
dateTimeFormatter
Formatter used to parse string-based date attribute values. -
legacyFormatter
Deprecated.Legacy formatter used to parse string-based date attribute values. -
systemTimeOffset
Offset from system time used for date comparisons. -
resultIfMissing
private boolean resultIfMissingResult of predicate if attribute is missing or has no values.
-
-
Constructor Details
-
DateAttributePredicate
@Deprecated public DateAttributePredicate(@Nonnull @NotEmpty @ParameterName(name="attribute") String attribute) Deprecated.Create a new instance that performs date comparisons against the given attribute using ISO date/time format parser by default.This is deprecated in favor of the Java 8 API version.
- Parameters:
attribute
- Attribute name that provides candidate date values to test.
-
DateAttributePredicate
@Deprecated public DateAttributePredicate(@Nonnull @NotEmpty @ParameterName(name="attribute") String attribute, @Nonnull @ParameterName(name="formatter") DateTimeFormatter formatter) Deprecated.Create a new instance that performs date comparisons against the given attribute using the given date parser.This is deprecated in favor of the Java 8 API version.
- Parameters:
attribute
- Attribute name that provides candidate date values to test.formatter
- Date/time parser.
-
DateAttributePredicate
public DateAttributePredicate(@Nonnull @NotEmpty @ParameterName(name="attribute") String attribute, @Nonnull @ParameterName(name="formatter") DateTimeFormatter formatter) Create a new instance that performs date comparisons against the given attribute using the given date parser.- Parameters:
attribute
- Attribute name that provides candidate date values to test.formatter
- Date/time parser.
-
DateAttributePredicate
public DateAttributePredicate(@Nonnull @NotEmpty @ParameterName(name="attribute") String attribute, @Nonnull @NotEmpty @ParameterName(name="formatString") String formatString) Create a new instance that performs date comparisons against the given attribute using the given date parser.- Parameters:
attribute
- Attribute name that provides candidate date values to test.formatString
- date/time parsing string, currently based onDateTimeFormatter
-
-
Method Details
-
setSystemTimeOffset
Deprecated.Set the system time offset, which affects the reference date for comparisons. By default all comparisons are against system time, i.e. zero offset.- Parameters:
offset
- System time offset. A negative value decreases the target date (sooner); a positive value increases the target date (later).
-
setOffset
Set the system time offset, which affects the reference date for comparisons.By default all comparisons are against system time, i.e. zero offset.
- Parameters:
offset
- System time offset. A negative value decreases the target date (sooner); a positive value increases the target date (later).
-
setResultIfMissing
public void setResultIfMissing(boolean flag) Set the result to return if the attribute to check is missing or has no values.- Parameters:
flag
- flag to set
-
allowNullAttributeContext
protected boolean allowNullAttributeContext()Get the result of the predicate in the case the attribute context is null.- Overrides:
allowNullAttributeContext
in classAbstractAttributePredicate
- Returns:
- null context result
-
hasMatch
Abstract implementation of the condition to evaluate.- Specified by:
hasMatch
in classAbstractAttributePredicate
- Parameters:
attributeMap
- the attributes to evaluate- Returns:
- the condition result
-