private static String sha512ConsentAttributeNames(final Map<String, Object> attributes) { val allNames = String.join("|", attributes.keySet()); return DigestUtils.sha512(allNames); }
private static String sha512ConsentAttributeValues(final Map<String, Object> attributes) { val allValues = attributes.values().stream() .map(CollectionUtils::toCollection) .map(c -> c.stream().map(Object::toString).collect(Collectors.joining())) .collect(Collectors.joining("|")); return DigestUtils.sha512(allValues); }
/** * Encode ticket id into a SHA-512. * * @param ticketId the ticket id * @return the ticket */ protected String encodeTicketId(final String ticketId) { if (!isCipherExecutorEnabled()) { LOGGER.trace(MESSAGE); return ticketId; } if (StringUtils.isBlank(ticketId)) { return ticketId; } val encodedId = DigestUtils.sha512(ticketId); LOGGER.debug("Encoded original ticket id [{}] to [{}]", ticketId, encodedId); return encodedId; }
/** * Build registered service cache key string. * * @param service the service * @return the string */ public static String buildRegisteredServiceCacheKey(final SamlRegisteredService service) { val key = service.getMetadataLocation(); LOGGER.trace("Determined cache key for service [{}] as [{}]", service.getName(), key); val hashedKey = DigestUtils.sha512(key); LOGGER.trace("Hashed service cache key as [{}]", hashedKey); return hashedKey; } }