import org.opensaml.saml2.core.AuthnContext;
import org.opensaml.util.storage.ExpiringObject;
import org.opensaml.util.storage.StorageService;
+import org.opensaml.ws.transport.http.HTTPTransportUtils;
import org.opensaml.xml.util.Base64;
import org.opensaml.xml.util.DatatypeHelper;
import org.slf4j.Logger;
}
LOG.debug("Adding IdP session cookie to HTTP response");
- Cookie sessionCookie = new Cookie(IDP_SESSION_COOKIE_NAME, Base64.encodeBytes(remoteAddress,
- Base64.DONT_BREAK_LINES)
- + "|" + Base64.encodeBytes(sessionId, Base64.DONT_BREAK_LINES) + "|" + signature);
+ StringBuilder cookieValue = new StringBuilder();
+ cookieValue.append(Base64.encodeBytes(remoteAddress, Base64.DONT_BREAK_LINES)).append("|");
+ cookieValue.append(Base64.encodeBytes(sessionId, Base64.DONT_BREAK_LINES)).append("|");
+ cookieValue.append(signature);
+ Cookie sessionCookie = new Cookie(IDP_SESSION_COOKIE_NAME, HTTPTransportUtils.urlEncode(cookieValue.toString()));
String contextPath = httpRequest.getContextPath();
if (DatatypeHelper.isEmpty(contextPath)) {
import javax.servlet.http.HttpServletRequest;
import org.joda.time.DateTime;
+import org.opensaml.ws.transport.http.HTTPTransportUtils;
import org.opensaml.xml.util.Base64;
import org.opensaml.xml.util.DatatypeHelper;
import org.slf4j.Logger;
// index 0: remote address
// index 1: session ID
// index 2: Base64(HMAC(index 0 + index 1))
- String[] valueComponents = sessionCookie.getValue().split("\\|");
+ String[] valueComponents = HTTPTransportUtils.urlDecode(sessionCookie.getValue()).split("\\|");
byte[] remoteAddressBytes = Base64.decode(valueComponents[0]);
byte[] sessionIdBytes = Base64.decode(valueComponents[1]);
byte[] signatureBytes = Base64.decode(valueComponents[2]);