class 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 + "]");
		}
	}

}