Class DateTimeAttributeDefinition
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin<IdPAttribute>
net.shibboleth.idp.attribute.resolver.AbstractAttributeDefinition
net.shibboleth.idp.attribute.resolver.ad.impl.DateTimeAttributeDefinition
- All Implemented Interfaces:
AttributeDefinition
,ResolverPlugin<IdPAttribute>
,Component
,DestructableComponent
,IdentifiableComponent
,IdentifiedComponent
,InitializableComponent
,UnmodifiableComponent
,DisposableBean
An
AttributeDefinition
that creates an attribute whose values are the values
of all its dependencies, passed through or converted into a DateTimeAttributeValue
.
Values already of this type are simple passed through, while StringAttributeValue
objects
are converted. It is optional whether to omit incompatible values or raise an error.
- Since:
- 4.3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
Convert numeric strings into epoch as seconds.private DateTimeFormatter
Formatter for string to date/time conversion.private boolean
Do we ignore converstion failures?private org.slf4j.Logger
Class logger. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DateTimeAttributeValue
convert
(IdPAttributeValue input) Convert an input value into aDateTimeAttributeValue
if possible.protected IdPAttribute
doAttributeDefinitionResolve
(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext) Creates and populates the values for the resolved attribute.protected void
Get the formatter to use to convert string data into anInstant
.boolean
Get whether to convert numeric string data into an epoch using seconds instead of milliseconds.boolean
Get whether to ignore conversion failures.void
Set a formatter to use to convert string data into anInstant
.void
setEpochInSeconds
(boolean flag) Set whether to convert numeric string data into an epoch using seconds instead of milliseconds.void
setIgnoreConversionErrors
(boolean flag) Set whether to ignore conversion failures.Methods inherited from class net.shibboleth.idp.attribute.resolver.AbstractAttributeDefinition
doResolve, getLogPrefix, isDependencyOnly, isPreRequested, setDependencyOnly, setPreRequested
Methods inherited from class net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin
addDisplayInformation, doDestroy, equals, getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, getProfileContextStrategy, hashCode, isPropagateResolutionExceptions, isSuppressDisplayInformation, resolve, setActivationCondition, setAttributeDependencies, setDataConnectorDependencies, setProfileContextStrategy, setPropagateResolutionExceptions, setSuppressDisplayInformation
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
Methods inherited from interface org.springframework.beans.factory.DisposableBean
destroy
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
Methods inherited from interface net.shibboleth.idp.attribute.resolver.ResolverPlugin
getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, isPropagateResolutionExceptions, resolve
-
Field Details
-
log
@Nonnull private org.slf4j.Logger logClass logger. -
formatter
Formatter for string to date/time conversion. -
epochInSeconds
private boolean epochInSecondsConvert numeric strings into epoch as seconds. -
ignoreConversionErrors
private boolean ignoreConversionErrorsDo we ignore converstion failures?
-
-
Constructor Details
-
DateTimeAttributeDefinition
public DateTimeAttributeDefinition()Constructor.
-
-
Method Details
-
setEpochInSeconds
public void setEpochInSeconds(boolean flag) Set whether to convert numeric string data into an epoch using seconds instead of milliseconds.Defaults to true.
- Parameters:
flag
-
-
isEpochInSeconds
public boolean isEpochInSeconds()Get whether to convert numeric string data into an epoch using seconds instead of milliseconds.- Returns:
- true iff epoch conversion should be based on seconds
-
setIgnoreConversionErrors
public void setIgnoreConversionErrors(boolean flag) Set whether to ignore conversion failures.- Parameters:
flag
- flag to set
-
isIgnoreConversionErrors
public boolean isIgnoreConversionErrors()Get whether to ignore conversion failures.- Returns:
- whether to ignore conversion failures
-
setDateTimeFormatter
Set a formatter to use to convert string data into anInstant
.- Parameters:
f
- formatter
-
getDateTimeFormatter
Get the formatter to use to convert string data into anInstant
.- Returns:
- formatter
-
doInitialize
- Overrides:
doInitialize
in classAbstractAttributeDefinition
- Throws:
ComponentInitializationException
-
doAttributeDefinitionResolve
@Nonnull protected IdPAttribute doAttributeDefinitionResolve(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException Creates and populates the values for the resolved attribute. Implementations should not set, or otherwise manage, the resolved attribute's display name, description or encoders. Nor should the resultant attribute be recorded in the given resolution context.- Specified by:
doAttributeDefinitionResolve
in classAbstractAttributeDefinition
- Parameters:
resolutionContext
- current attribute resolution contextworkContext
- current resolver work context- Returns:
- resolved attribute or null if nothing to resolve.
- Throws:
ResolutionException
- thrown if there is a problem resolving and creating the attribute
-
convert
Convert an input value into aDateTimeAttributeValue
if possible.- Parameters:
input
- input value- Returns:
- converted value or null
-