/** * Hex decode string. * * @param data the data * @return the string */ public static String hexDecode(final String data) { if (StringUtils.isNotBlank(data)) { return hexDecode(data.toCharArray()); } return null; }
@Override public Map<String, Object> encodeAttributes(final Map<String, Object> attributes, final RegisteredService service) { val finalAttributes = Maps.<String, Object>newHashMapWithExpectedSize(attributes.size()); attributes.forEach((k, v) -> { val attributeName = EncodingUtils.hexDecode(k); if (StringUtils.isNotBlank(attributeName)) { LOGGER.debug("Decoded SAML attribute [{}] to [{}] with value(s) [{}]", k, attributeName, v); finalAttributes.put(attributeName, v); } else { LOGGER.debug("Unable to decode SAML attribute [{}]; accepting it verbatim", k); finalAttributes.put(k, v); } }); return finalAttributes; } }
throw new IllegalArgumentException("No cookie could be found to determine session state"); val blob = EncodingUtils.hexDecode(value); val session = serializer.from(blob); request.setAttribute(this.themeParamName, session.get(this.themeParamName));
/** * Retrieve. * * @param webContext the web context */ public void restore(final J2EContext webContext) { val value = cookieGenerator.retrieveCookieValue(webContext.getRequest()); if (StringUtils.isNotBlank(value)) { val blob = EncodingUtils.hexDecode(value); val session = serializer.from(blob); session.forEach((k, v) -> webContext.getSessionStore().set(webContext, k, v)); } removeCookie(webContext); }