Class AddTimestampHandler
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.messaging.handler.AbstractMessageHandler
-
- org.opensaml.soap.messaging.AbstractHeaderGeneratingMessageHandler
-
- org.opensaml.soap.wssecurity.messaging.impl.AddTimestampHandler
-
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,MessageHandler
public class AddTimestampHandler extends AbstractHeaderGeneratingMessageHandler
Handler implementation that adds a wsse:Timestamp header to the wsse:Security header of the outbound SOAP envelope.
-
-
Field Summary
Fields Modifier and Type Field Description private Function<MessageContext,Instant>createdLookupContext lookup function for the Created time.private InstantcreatedValueThe effective Created value to use.private Function<MessageContext,Instant>expiresLookupContext lookup function for the Expires time.private DurationexpiresOffsetFromCreatedParameter indicating the offset from Created used to calculate the Expires time, if no Expires value is explicitly supplied via the other supported mechanisms.private InstantexpiresValueThe effective Expires value to use.private org.slf4j.LoggerlogLogger.private booleanuseCurrentTimeAsDefaultCreatedFlag indicating whether to use the current time as the Created time, if no value is explicitly supplied by the other supported mechanisms.
-
Constructor Summary
Constructors Constructor Description AddTimestampHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoInvoke(MessageContext messageContext)protected booleandoPreInvoke(MessageContext messageContext)Function<MessageContext,Instant>getCreatedLookup()Get the context lookup function for the Created time.protected InstantgetCreatedValue(MessageContext messageContext)Get the Created value.Function<MessageContext,Instant>getExpiresLookup()Get the context lookup function for the Expires time.DurationgetExpiresOffsetFromCreated()Get the parameter indicating the offset from Created used to calculate the Expires time, if no Expires value is explicitly supplied via the other supported mechanisms.protected InstantgetExpiresValue(MessageContext messageContext, Instant created)Get the Expires value.booleanisUseCurrentTimeAsDefaultCreated()Get the flag indicating whether to use the current time as the Created time, if no value is explicitly supplied by the other supported mechanisms.voidsetCreatedLookup(Function<MessageContext,Instant> lookup)Set the context lookup function for the Created time.voidsetExpiresLookup(Function<MessageContext,Instant> lookup)Set the context lookup function for the Expires time.voidsetExpiresOffsetFromCreated(Duration value)Set the parameter indicating the offset from Created used to calculate the Expires time, if no Expires value is explicitly supplied via the other supported mechanisms.voidsetUseCurrentTimeAsDefaultCreated(boolean flag)Set the flag indicating whether to use the current time as the Created time, if no value is explicitly supplied by the other supported mechanisms.-
Methods inherited from class org.opensaml.soap.messaging.AbstractHeaderGeneratingMessageHandler
decorateGeneratedHeader, getEffectiveTargetNode, isEffectiveMustUnderstand, setMustUnderstand, setMustUnderstandStrategy, setTargetNode, setTargetNodeStrategy
-
Methods inherited from class org.opensaml.messaging.handler.AbstractMessageHandler
doPostInvoke, doPostInvoke, getActivationCondition, getLogPrefix, invoke, setActivationCondition
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
-
-
-
Field Detail
-
log
@Nonnull private org.slf4j.Logger log
Logger.
-
createdLookup
@Nullable private Function<MessageContext,Instant> createdLookup
Context lookup function for the Created time.
-
expiresLookup
@Nullable private Function<MessageContext,Instant> expiresLookup
Context lookup function for the Expires time.
-
useCurrentTimeAsDefaultCreated
private boolean useCurrentTimeAsDefaultCreated
Flag indicating whether to use the current time as the Created time, if no value is explicitly supplied by the other supported mechanisms.
-
expiresOffsetFromCreated
@Nullable private Duration expiresOffsetFromCreated
Parameter indicating the offset from Created used to calculate the Expires time, if no Expires value is explicitly supplied via the other supported mechanisms.
-
createdValue
@Nullable private Instant createdValue
The effective Created value to use.
-
expiresValue
@Nullable private Instant expiresValue
The effective Expires value to use.
-
-
Method Detail
-
getCreatedLookup
@Nullable public Function<MessageContext,Instant> getCreatedLookup()
Get the context lookup function for the Created time.- Returns:
- the lookup function
-
setCreatedLookup
public void setCreatedLookup(@Nullable Function<MessageContext,Instant> lookup)Set the context lookup function for the Created time.- Parameters:
lookup- the lookup function
-
getExpiresLookup
@Nullable public Function<MessageContext,Instant> getExpiresLookup()
Get the context lookup function for the Expires time.- Returns:
- the lookup function
-
setExpiresLookup
public void setExpiresLookup(@Nullable Function<MessageContext,Instant> lookup)Set the context lookup function for the Expires time.- Parameters:
lookup- the lookup function
-
isUseCurrentTimeAsDefaultCreated
public boolean isUseCurrentTimeAsDefaultCreated()
Get the flag indicating whether to use the current time as the Created time, if no value is explicitly supplied by the other supported mechanisms.- Returns:
- true if should use current time, false if not
-
setUseCurrentTimeAsDefaultCreated
public void setUseCurrentTimeAsDefaultCreated(boolean flag)
Set the flag indicating whether to use the current time as the Created time, if no value is explicitly supplied by the other supported mechanisms.- Parameters:
flag- true if should use currnet time, false if not
-
getExpiresOffsetFromCreated
@Nullable public Duration getExpiresOffsetFromCreated()
Get the parameter indicating the offset from Created used to calculate the Expires time, if no Expires value is explicitly supplied via the other supported mechanisms.- Returns:
- the expires offset, or null
-
setExpiresOffsetFromCreated
public void setExpiresOffsetFromCreated(@Nullable Duration value)Set the parameter indicating the offset from Created used to calculate the Expires time, if no Expires value is explicitly supplied via the other supported mechanisms.- Parameters:
value- the expires offset, or null
-
doPreInvoke
protected boolean doPreInvoke(@Nonnull MessageContext messageContext) throws MessageHandlerException- Overrides:
doPreInvokein classAbstractHeaderGeneratingMessageHandler- Throws:
MessageHandlerException
-
doInvoke
protected void doInvoke(@Nonnull MessageContext messageContext) throws MessageHandlerException- Specified by:
doInvokein classAbstractMessageHandler- Throws:
MessageHandlerException
-
getCreatedValue
@Nullable protected Instant getCreatedValue(@Nonnull MessageContext messageContext)
Get the Created value.- Parameters:
messageContext- the current message context- Returns:
- the effective Created DateTime value to use
-
getExpiresValue
@Nullable protected Instant getExpiresValue(@Nonnull MessageContext messageContext, @Nullable Instant created)
Get the Expires value.- Parameters:
messageContext- the current message contextcreated- the created value, if any- Returns:
- the effective Expires DateTime value to use
-
-