this.header = header;
}
public void process(Document message, List<Target> targets, String maxAge, String credential, Collection<String> processedIds) throws WSSecurityException
{
Timestamp stamp = header.getTimestamp();
if (stamp == null)
throw new FailedCheckException("Required timestamp not present.");
// If there is no maxAge specified then we are done
if (maxAge == null)
return;
int max = Integer.parseInt(maxAge);
Calendar expired = (Calendar)stamp.getCreated().clone();
expired.add(Calendar.SECOND, max);
if (! Calendar.getInstance().before(expired))
throw new FailedCheckException("Timestamp of message is too old.");
}