private Date parseDate(String date) throws TimestampValidationCallback.TimestampValidationException { SimpleDateFormat calendarFormatter1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); SimpleDateFormat calendarFormatter2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS'Z'"); try { try { return calendarFormatter1.parse(date); } catch (ParseException ignored) { return calendarFormatter2.parse(date); } } catch (ParseException ex) { throw new TimestampValidationCallback.TimestampValidationException("Could not parse request date: " + date, ex); } }
private Date parseDate(String date) throws TimestampValidationCallback.TimestampValidationException { SimpleDateFormat calendarFormatter1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); SimpleDateFormat calendarFormatter2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS'Z'"); try { try { return calendarFormatter1.parse(date); } catch (ParseException ignored) { return calendarFormatter2.parse(date); } } catch (ParseException ex) { throw new TimestampValidationCallback.TimestampValidationException("Could not parse request date: " + date, ex); } }
private Date parseDate(String date) throws TimestampValidationCallback.TimestampValidationException { SimpleDateFormat calendarFormatter1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); SimpleDateFormat calendarFormatter2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS'Z'"); try { try { return calendarFormatter1.parse(date); } catch (ParseException ignored) { return calendarFormatter2.parse(date); } } catch (ParseException ex) { throw new TimestampValidationCallback.TimestampValidationException("Could not parse request date: " + date, ex); } }
throw new TimestampValidationCallback.TimestampValidationException(ipe.getMessage());
public void validateCreationTime( Date created, long maxClockSkew, long timestampFreshnessLimit) throws TimestampValidationCallback.TimestampValidationException { //System.out.println("Validate Creation time called"); Date current = getFreshnessAndSkewAdjustedDate(maxClockSkew, timestampFreshnessLimit); if (created.before(current)) { log.log(Level.SEVERE, "WSS1515.error.currentTime"); log.log(Level.SEVERE, "Creation time:" + created); log.log(Level.SEVERE, "Current time:" + current); throw new TimestampValidationCallback.TimestampValidationException( "The creation time is older than " + " currenttime - timestamp-freshness-limit - max-clock-skew"); } Date currentTime = getGMTDateWithSkewAdjusted(new GregorianCalendar(), maxClockSkew, true); if (currentTime.before(created)) { log.log(Level.SEVERE, "WSS1516.error.creationAheadCurrent.time"); throw new TimestampValidationCallback.TimestampValidationException( "The creation time is ahead of the current time."); } }
@Override public void validate(TimestampValidationCallback.Request request) throws TimestampValidationCallback.TimestampValidationException { for (int i = 0; i < getCallbackHandlers().length; i++) { CallbackHandler callbackHandler = getCallbackHandlers()[i]; try { callbackHandler.handle(new Callback[]{callback}); callback.getResult(); } catch (IOException e) { throw new TimestampValidationCallback.TimestampValidationException(e); } catch (UnsupportedCallbackException e) { // ignore } } } }
@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 public void validate(TimestampValidationCallback.Request request) throws TimestampValidationCallback.TimestampValidationException { for (int i = 0; i < getCallbackHandlers().length; i++) { CallbackHandler callbackHandler = getCallbackHandlers()[i]; try { callbackHandler.handle(new Callback[]{callback}); callback.getResult(); } catch (IOException e) { throw new TimestampValidationCallback.TimestampValidationException(e); } catch (UnsupportedCallbackException e) { // ignore } } } }
@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 public void validate(TimestampValidationCallback.Request request) throws TimestampValidationCallback.TimestampValidationException { for (int i = 0; i < getCallbackHandlers().length; i++) { CallbackHandler callbackHandler = getCallbackHandlers()[i]; try { callbackHandler.handle(new Callback[]{callback}); callback.getResult(); } catch (IOException e) { throw new TimestampValidationCallback.TimestampValidationException(e); } catch (UnsupportedCallbackException e) { // ignore } } } }
@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 + "]"); } }
private void validateCreationTime(Date created, long maxClockSkew, long timestampFreshnessLimit) throws TimestampValidationCallback.TimestampValidationException { Date current = getFreshnessAndSkewAdjustedDate(maxClockSkew, timestampFreshnessLimit); if (created.before(current)) { throw new TimestampValidationCallback.TimestampValidationException( "The creation time is older than currenttime - timestamp-freshness-limit - max-clock-skew"); } Date currentTime = getGMTDateWithSkewAdjusted(new GregorianCalendar(), maxClockSkew, true); if (currentTime.before(created)) { throw new TimestampValidationCallback.TimestampValidationException( "The creation time is ahead of the current time."); } }
private void validateCreationTime(Date created, long maxClockSkew, long timestampFreshnessLimit) throws TimestampValidationCallback.TimestampValidationException { Date current = getFreshnessAndSkewAdjustedDate(maxClockSkew, timestampFreshnessLimit); if (created.before(current)) { throw new TimestampValidationCallback.TimestampValidationException( "The creation time is older than currenttime - timestamp-freshness-limit - max-clock-skew"); } Date currentTime = getGMTDateWithSkewAdjusted(new GregorianCalendar(), maxClockSkew, true); if (currentTime.before(created)) { throw new TimestampValidationCallback.TimestampValidationException( "The creation time is ahead of the current time."); } }
private void validateCreationTime(Date created, long maxClockSkew, long timestampFreshnessLimit) throws TimestampValidationCallback.TimestampValidationException { Date current = getFreshnessAndSkewAdjustedDate(maxClockSkew, timestampFreshnessLimit); if (created.before(current)) { throw new TimestampValidationCallback.TimestampValidationException( "The creation time is older than currenttime - timestamp-freshness-limit - max-clock-skew"); } Date currentTime = getGMTDateWithSkewAdjusted(new GregorianCalendar(), maxClockSkew, true); if (currentTime.before(created)) { throw new TimestampValidationCallback.TimestampValidationException( "The creation time is ahead of the current time."); } }
private void validateExpirationTime(Date expires, long maxClockSkew) throws TimestampValidationCallback.TimestampValidationException { Date currentTime = getGMTDateWithSkewAdjusted(new GregorianCalendar(), maxClockSkew, false); if (expires.before(currentTime)) { throw new TimestampValidationCallback.TimestampValidationException( "The current time is ahead of the expiration time in Timestamp"); } }
private void validateExpirationTime(Date expires, long maxClockSkew) throws TimestampValidationCallback.TimestampValidationException { Date currentTime = getGMTDateWithSkewAdjusted(new GregorianCalendar(), maxClockSkew, false); if (expires.before(currentTime)) { throw new TimestampValidationCallback.TimestampValidationException( "The current time is ahead of the expiration time in Timestamp"); } }
public void validateExpirationTime( Date expires, long maxClockSkew, long timestampFreshnessLimit) throws TimestampValidationCallback.TimestampValidationException { //System.out.println("Validate Expiration time called"); Date currentTime = getGMTDateWithSkewAdjusted(new GregorianCalendar(), maxClockSkew, false); if (expires.before(currentTime)) { log.log(Level.SEVERE, "WSS1514.error.aheadCurrentTime"); throw new TimestampValidationCallback.TimestampValidationException( "The current time is ahead of the expiration time in Timestamp"); } }
private void validateExpirationTime(Date expires, long maxClockSkew) throws TimestampValidationCallback.TimestampValidationException { Date currentTime = getGMTDateWithSkewAdjusted(new GregorianCalendar(), maxClockSkew, false); if (expires.before(currentTime)) { throw new TimestampValidationCallback.TimestampValidationException( "The current time is ahead of the expiration time in Timestamp"); } }