Class DateTimeAttributeDefinition
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.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 booleanConvert numeric strings into epoch as seconds.private DateTimeFormatterFormatter for string to date/time conversion.private booleanDo we ignore converstion failures?private org.slf4j.LoggerClass logger. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 voidGet the formatter to use to convert string data into anInstant.booleanGet whether to convert numeric string data into an epoch using seconds instead of milliseconds.booleanGet whether to ignore conversion failures.voidSet 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, setPreRequestedMethods inherited from class net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin
doDestroy, equals, getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, hashCode, isPropagateResolutionExceptions, resolve, setActivationCondition, setAttributeDependencies, setDataConnectorDependencies, setPropagateResolutionExceptionsMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface org.springframework.beans.factory.DisposableBean
destroyMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitializedMethods 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- true if the epoch is in seconds.
-
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:
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
Convert an input value into aDateTimeAttributeValueif possible.- Parameters:
input- input value- Returns:
- converted value or null
-