/** * Get the timestamp element generated during <code>prepare()</code>. */ public Element getElement() { if (ts == null) { return null; } return ts.getElement(); }
/** * Creates a Timestamp element. * * The method prepares and initializes a WSSec Timestamp structure after the * relevant information was set. Before calling <code>prepare()</code> the * parameter such as <code>timeToLive</code> can be set if the default * value is not suitable. */ public void prepare() { ts = new Timestamp(precisionInMilliSeconds, getDocument(), wsTimeSource, timeToLive); String tsId = getIdAllocator().createId("TS-", ts); ts.setID(tsId); }
@Override public boolean equals(Object object) { if (!(object instanceof Timestamp)) { return false; } Timestamp timestamp = (Timestamp)object; if (!compare(timestamp.getCreated(), getCreated())) { return false; } if (!compare(timestamp.getExpires(), getExpires())) { return false; } return true; }
&& WSConstants.TIMESTAMP_TOKEN_LN.equals(sibling.getLocalName()) && WSConstants.WSU_NS.equals(sibling.getNamespaceURI())) { timeStamp = new Timestamp((Element)sibling, requestData.getBSPEnforcer()); break; String identifier = timeStamp.getCreatedString() + "" + Arrays.hashCode(signatureValue) + "" + Arrays.hashCode(key.getEncoded()); if (timeStamp.getExpires() != null) { replayCache.add(identifier, 1L + Duration.between(Instant.now(), timeStamp.getExpires()).getSeconds()); } else { replayCache.add(identifier);
if (timeStampStrict && timeStamp.isExpired()) { throw new WSSecurityException( WSSecurityException.ErrorCode.MESSAGE_EXPIRED, if (!timeStamp.verifyCreated(timeStampTTL, futureTimeToLive)) { throw new WSSecurityException( WSSecurityException.ErrorCode.MESSAGE_EXPIRED, if (data.isRequireTimestampExpires() && timeStamp.getExpires() == null) { throw new WSSecurityException( WSSecurityException.ErrorCode.SECURITY_ERROR,
public List<WSSecurityEngineResult> handleToken( Element elem, RequestData data ) throws WSSecurityException { LOG.debug("Found Timestamp list element"); // // Decode Timestamp, add the found time (created/expiry) to result // Timestamp timestamp = new Timestamp(elem, data.getBSPEnforcer()); Credential credential = new Credential(); credential.setTimestamp(timestamp); WSSecurityEngineResult result = new WSSecurityEngineResult(WSConstants.TS, timestamp); String tokenId = timestamp.getID(); if (!"".equals(tokenId)) { result.put(WSSecurityEngineResult.TAG_ID, tokenId); } Validator validator = data.getValidator(WSConstants.TIMESTAMP); if (validator != null) { validator.validate(credential, data); result.put(WSSecurityEngineResult.TAG_VALIDATED_TOKEN, Boolean.TRUE); } data.getWsDocInfo().addTokenElement(elem); data.getWsDocInfo().addResult(result); return java.util.Collections.singletonList(result); }
/** * Get the id generated during <code>prepare()</code>. * * Returns the the value of wsu:Id attribute of this Timestamp. * * @return Return the wsu:Id of this token or null if * <code>prepareToken()</code> was not called before. */ public String getId() { if (ts == null) { return null; } return ts.getID(); }
/** * Prepends the Timestamp element to the elements already in the Security * header. * * The method can be called any time after <code>prepare()</code>. This * allows to insert the Timestamp element at any position in the Security * header. */ public void prependToHeader() { Element securityHeaderElement = getSecurityHeader().getSecurityHeaderElement(); WSSecurityUtil.prependChildElement(securityHeaderElement, ts.getElement()); }
CastUtils.cast((List<?>)signedResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS)); for (WSDataRef dataRef : dataRefs) { if (timestamp.getElement() == dataRef.getProtectedElement()) { return true;
public WSSecurityEngineResult(int act, Timestamp tstamp) { put(TAG_ACTION, act); put(TAG_TIMESTAMP, tstamp); put(TAG_VALIDATED_TOKEN, Boolean.FALSE); put(TAG_TOKEN_ELEMENT, tstamp.getElement()); }
CastUtils.cast((List<?>)signedResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS)); for (WSDataRef dataRef : dataRefs) { if (timestamp.getElement() == dataRef.getProtectedElement()) { return true;
if (tsResult != null) { Timestamp ts = (Timestamp)tsResult.get(WSSecurityEngineResult.TAG_TIMESTAMP); timestamp = ts.getElement();
if (tsResult != null) { Timestamp ts = (Timestamp)tsResult.get(WSSecurityEngineResult.TAG_TIMESTAMP); timestamp = ts.getElement();