/** * Gets the current date and time * formatted by the pattern specified. * * @return the current date and time */ public String getCurrentDateAndTime() { return format(ZonedDateTime.now(ZoneOffset.UTC)); }
val dateFormat = new ISOStandardDateFormat(); getNonExpiredTicketGrantingTickets().stream().map(TicketGrantingTicket.class::cast) .filter(tgt -> !(option == SsoSessionReportOptions.DIRECT && tgt.getProxiedBy() != null)) sso.put(SsoSessionAttributeKeys.AUTHENTICATION_DATE.toString(), authentication.getAuthenticationDate()); sso.put(SsoSessionAttributeKeys.AUTHENTICATION_DATE_FORMATTED.toString(), dateFormat.format(DateTimeUtils.dateOf(authentication.getAuthenticationDate()))); sso.put(SsoSessionAttributeKeys.NUMBER_OF_USES.toString(), tgt.getCountOfUses()); sso.put(SsoSessionAttributeKeys.TICKET_GRANTING_TICKET.toString(), tgt.getId());
@Override public SingleLogoutMessage create(final SingleLogoutRequest request) { val logoutRequest = String.format(LOGOUT_REQUEST_TEMPLATE, GENERATOR.getNewTicketId("LR"), new ISOStandardDateFormat().getCurrentDateAndTime(), request.getTicketGrantingTicket().getAuthentication().getPrincipal().getId(), request.getTicketId()); val builder = SingleLogoutMessage.builder(); if (request.getLogoutType() == RegisteredServiceLogoutType.FRONT_CHANNEL) { LOGGER.trace("Attempting to deflate the logout message [{}]", logoutRequest); return builder.payload(CompressionUtils.deflate(logoutRequest)).build(); } return builder.payload(logoutRequest).build(); } }
final ISOStandardDateFormat dateFormat = new ISOStandardDateFormat(); sso.put(SsoSessionAttributeKeys.AUTHENTICATION_DATE.toString(), authentication.getAuthenticationDate()); sso.put(SsoSessionAttributeKeys.AUTHENTICATION_DATE_FORMATTED.toString(), dateFormat.format(DateTimeUtils.dateOf(authentication.getAuthenticationDate()))); sso.put(SsoSessionAttributeKeys.NUMBER_OF_USES.toString(), tgt.getCountOfUses()); sso.put(SsoSessionAttributeKeys.TICKET_GRANTING_TICKET.toString(), tgt.getId());
/** * Format the datetime given. * * @param dt the datetime * @return the date and time */ public String format(final Instant dt) { return format(DateTimeUtils.dateOf(dt)); } }
/** * Format the datetime given. * * @param dt the datetime * @return the date and time */ public String format(final ZonedDateTime dt) { return format(DateTimeUtils.dateOf(dt)); }