/** * @param uid * @param roles Collection of String. * @param userAttributes Collection of {@link Attribute}. * @param expiration * @param issuer */ public Token(String uid, Collection<String> roles, Collection<Attribute> userAttributes, Date expiration, String issuer) { this(uid, roles, userAttributes, DateUtil.tofullISOString(expiration), issuer); }
/** * Method formats a date to an iso formated string. * It will always produce the utc iso format, e.g.: 2009-11-17T13:28:17.235Z. */ public static String toUTCISOString(final Date date) { TimeZone zone = TimeZone.getTimeZone("UTC"); Calendar cal = Calendar.getInstance(zone); cal.setTime(date); return tofullISOString(cal); }
/** * Method formats a date to an iso formated string. * It will always produce the full iso format, e.g.: 2009-11-17T13:28:17.235+0100. * * @param date * the date. * @return String. */ public static String tofullISOString(final Date date) { TimeZone zone = TimeZone.getTimeZone("UTC"); zone.setRawOffset(-date.getTimezoneOffset() * 60 * 1000); Calendar cal = Calendar.getInstance(zone); cal.setTime(date); return tofullISOString(cal); }