@Override protected String buildCompoundCookieValue(final String givenCookieValue, final HttpServletRequest request) { val clientInfo = ClientInfoHolder.getClientInfo(); val builder = new StringBuilder(givenCookieValue); if (cookieProperties.isPinToSession()) { builder.append(COOKIE_FIELD_SEPARATOR).append(clientInfo.getClientIpAddress()); val userAgent = HttpRequestUtils.getHttpServletRequestUserAgent(request); if (StringUtils.isBlank(userAgent)) { throw new IllegalStateException("Request does not specify a user-agent"); } builder.append(COOKIE_FIELD_SEPARATOR).append(userAgent); } else { LOGGER.debug("Cookie session-pinning is disabled"); } return builder.toString(); }
if (!cookieProperties.isPinToSession()) { LOGGER.debug("Cookie session-pinning is disabled. Returning cookie value as it was provided"); return value;