DefaultTimestampValidator implements TimestampValidationCallback.TimestampValidator { @Override public void validate(TimestampValidationCallback.Request request) throws TimestampValidationCallback.TimestampValidationException { if (request instanceof TimestampValidationCallback.UTCTimestampRequest) { TimestampValidationCallback.UTCTimestampRequest utcRequest = (TimestampValidationCallback.UTCTimestampRequest) request; Date created = parseDate(utcRequest.getCreated()); validateCreationTime(created, utcRequest.getMaxClockSkew(), utcRequest.getTimestampFreshnessLimit()); if (utcRequest.getExpired() != null) { Date expired = parseDate(utcRequest.getExpired()); validateExpirationTime(expired, utcRequest.getMaxClockSkew()); } } else { throw new TimestampValidationCallback.TimestampValidationException("Unsupport request: [" + request + "]"); } }  @Override void validate(TimestampValidationCallback.Request request);  }
@Test public void testValidate() throws Exception { TimestampValidationCallback.Request request = new TimestampValidationCallback.UTCTimestampRequest( "2006-09-25T20:42:50Z", "2107-09-25T20:42:50Z", 100, Long.MAX_VALUE); validator.validate(request); }
@Test public void testValidateNoExpired() throws Exception { TimestampValidationCallback.Request request = new TimestampValidationCallback.UTCTimestampRequest( "2006-09-25T20:42:50Z", null, 100, Long.MAX_VALUE); validator.validate(request); }