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
@ThreadSafe public class DateTimeAttributeDefinition extends AbstractAttributeDefinition
AnAttributeDefinitionthat creates an attribute whose values are the values of all its dependencies, passed through or converted into aDateTimeAttributeValue.Values already of this type are simple passed through, while
StringAttributeValueobjects are converted. It is optional whether to omit incompatible values or raise an error.- Since:
- 4.3.0
-
-
Field Summary
Fields Modifier and Type Field Description private booleanepochInSecondsConvert numeric strings into epoch as seconds.private DateTimeFormatterformatterFormatter for string to date/time conversion.private booleanignoreConversionErrorsDo we ignore converstion failures?private org.slf4j.LoggerlogClass logger.
-
Constructor Summary
Constructors Constructor Description DateTimeAttributeDefinition()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DateTimeAttributeValueconvert(IdPAttributeValue input)Convert an input value into aDateTimeAttributeValueif possible.protected IdPAttributedoAttributeDefinitionResolve(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext)Creates and populates the values for the resolved attribute.protected voiddoInitialize()DateTimeFormattergetDateTimeFormatter()Get the formatter to use to convert string data into anInstant.booleanisEpochInSeconds()Get whether to convert numeric string data into an epoch using seconds instead of milliseconds.booleanisIgnoreConversionErrors()Get whether to ignore conversion failures.voidsetDateTimeFormatter(DateTimeFormatter f)Set a formatter to use to convert string data into anInstant.voidsetEpochInSeconds(boolean flag)Set whether to convert numeric string data into an epoch using seconds instead of milliseconds.voidsetIgnoreConversionErrors(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 Detail
-
log
@Nonnull private org.slf4j.Logger log
Class logger.
-
formatter
@Nullable private DateTimeFormatter formatter
Formatter for string to date/time conversion.
-
epochInSeconds
private boolean epochInSeconds
Convert numeric strings into epoch as seconds.
-
ignoreConversionErrors
private boolean ignoreConversionErrors
Do we ignore converstion failures?
-
-
Method Detail
-
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
public void setDateTimeFormatter(@Nullable DateTimeFormatter f)Set a formatter to use to convert string data into anInstant.- Parameters:
f- formatter
-
getDateTimeFormatter
@Nullable public DateTimeFormatter getDateTimeFormatter()
Get the formatter to use to convert string data into anInstant.- Returns:
- formatter
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein 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:
doAttributeDefinitionResolvein 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
@Nullable protected DateTimeAttributeValue convert(@Nonnull IdPAttributeValue input)
Convert an input value into aDateTimeAttributeValueif possible.- Parameters:
input- input value- Returns:
- converted value or null
-
-