Class Timestamp
java.lang.Object
org.apache.wss4j.dom.message.token.Timestamp
Timestamp according to SOAP Message Security 1.0,
chapter 10 / appendix A.2
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aTimestampobject according to the defined parameters.Timestamp(boolean milliseconds, Document doc, WSTimeSource timeSource, int ttl) Constructs aTimestampobject according to the defined parameters.Timestamp(Element timestampElement, BSPEnforcer bspEnforcer) Constructs aTimestampobject and parses thewsu:Timestampelement to initialize it. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the WSU Namespace to this T.booleanGet the time of creation.Get the time of creation as a StringReturns the dom element of thisTimestampobject.Get the time of expiration.getID()inthashCode()booleanReturn true if the current Timestamp is expired, meaning if the "Expires" value is before the current time.voidSet wsu:Id attribute of this timestamptoString()Returns the string representation of the token.booleanverifyCreated(int timeToLive, int futureTimeToLive) Return true if the "Created" value is before the current time minus the timeToLive argument, and if the Created value is not "in the future".
-
Constructor Details
-
Timestamp
Constructs aTimestampobject and parses thewsu:Timestampelement to initialize it.- Parameters:
timestampElement- thewsu:Timestampelement that contains the timestamp databspEnforcer- a BSPEnforcer instance to enforce BSP rules- Throws:
WSSecurityException
-
Timestamp
Constructs aTimestampobject according to the defined parameters.- Parameters:
doc- the SOAP envelope asDocumentttl- the time to live (validity of the security semantics) in seconds
-
Timestamp
Constructs aTimestampobject according to the defined parameters.- Parameters:
doc- the SOAP envelope asDocumentttl- the time to live (validity of the security semantics) in seconds
-
-
Method Details
-
addWSUNamespace
public void addWSUNamespace()Add the WSU Namespace to this T. The namespace is not added by default for efficiency purposes. -
getElement
Returns the dom element of thisTimestampobject.- Returns:
- the
wsse:UsernameTokenelement
-
toString
Returns the string representation of the token. -
getCreated
Get the time of creation.- Returns:
- the "created" time
-
getCreatedString
Get the time of creation as a String- Returns:
- the time of creation as a String
-
getExpires
Get the time of expiration.- Returns:
- the "expires" time
-
setID
Set wsu:Id attribute of this timestamp- Parameters:
id-
-
getID
- Returns:
- the value of the wsu:Id attribute
-
isExpired
public boolean isExpired()Return true if the current Timestamp is expired, meaning if the "Expires" value is before the current time. It returns false if there is no Expires value. -
verifyCreated
public boolean verifyCreated(int timeToLive, int futureTimeToLive) Return true if the "Created" value is before the current time minus the timeToLive argument, and if the Created value is not "in the future".- Parameters:
timeToLive- the value in seconds for the validity of the Created timefutureTimeToLive- the value in seconds for the future validity of the Created time- Returns:
- true if the timestamp is before (now-timeToLive), false otherwise
-
hashCode
public int hashCode() -
equals
-