Converts Selenium cookies to Apache http client ones.
@param browserCookies cookies in Selenium format.
@param cookieStore store to place coverted cookies in.
333415
public void copySeleniumCookies(Set<Cookie> browserCookies, CookieStore cookieStore) {
        for (Cookie browserCookie : browserCookies) {
            ClientCookie cookie = convertCookie(browserCookie);
            cookieStore.addCookie(cookie);
        }
    }
634410
public final static Map<String, Cookie> readCookieMap(HttpServletRequest httpServletRequest) {
		Map<String, Cookie> cookieMap = new HashMap<String, Cookie>();
		Cookie[] cookies = httpServletRequest.getCookies();
		if (null == cookies) {
			return null;
		}
		for (Cookie cookie : cookies) {
			cookieMap.put(cookie.getName().toLowerCase(), cookie);
		}
		return cookieMap;
	}
818627
public void deleteCookie(HttpServletRequest request, HttpServletResponse response, String cookieName, WebAppSecurityConfig webAppSecConfig) {
        ReferrerURLCookieHandler referrerURLCookieHandler = getCookieHandler();
        referrerURLCookieHandler.clearReferrerURLCookie(request, response, cookieName);

        Cookie paramCookie = createExpiredCookie(request, cookieName, webAppSecConfig);
        response.addCookie(paramCookie);
    }
156219
public final HttpServer cookieCodec(ServerCookieEncoder encoder, ServerCookieDecoder decoder) {
		return tcpConfiguration(tcp -> tcp.bootstrap(
				b -> HttpServerConfiguration.cookieCodec(b, encoder, decoder)));
	}
1160984
public String setCookie(final String cookie) {
        final String prev = this.cookie;
        this.cookie = cookie;
        return prev;
    }
750094
private Cookie convertHttpCookie(HttpCookie cookie)
  {
    Cookie rc = new Cookie(cookie.getName(), cookie.getValue());
    rc.setVersion(cookie.getVersion());
    if (null != cookie.getPath())
    {
      rc.setPath(cookie.getPath());
    }
    if (null != cookie.getDomain())
    {
      rc.setDomain(cookie.getDomain());
    }
    rc.setMaxAge(cookie.getMaxAge());
    rc.setSecure(cookie.isSecure());
    return rc;
  }
6248
public static BasicClientCookie convertToHttpClientCookie(final Cookie seleniumCookie) {
        BasicClientCookie httpClientCookie
                = new BasicClientCookie(seleniumCookie.getName(), seleniumCookie.getValue());
        httpClientCookie.setDomain(seleniumCookie.getDomain());
        httpClientCookie.setPath(seleniumCookie.getPath());
        httpClientCookie.setExpiryDate(seleniumCookie.getExpiry());
        httpClientCookie.setSecure(seleniumCookie.isSecure());

        if (seleniumCookie.isHttpOnly()) {
            httpClientCookie.setAttribute(HTTP_ONLY_ATTRIBUTE, StringUtils.EMPTY);
        }

        return httpClientCookie;
    }
136529
def add_cookies_to_web_driver(driver, cookies):
    
    for cookie in cookies:
        driver.add_cookie(convert_cookie_to_dict(cookie))
    return driver
589816
public void setCookie(String name, String value, String path, Date expirationDate, boolean secure, boolean httpOnly) {
        if (remote == null)
            throw new IllegalStateException("Cannot setCookie since remote == null");
        if (path == null || path.length() == 0)
            path = remote.getPath();
        Cookie.Builder builder = new Cookie.Builder();
        builder.name(name).value(value).domain(remote.getHost()).path(path);
        if (expirationDate != null)
            builder.expiresAt(expirationDate.getTime());
        List<Cookie> cookies = Collections.singletonList(builder.build());
        this.clientFactory.addCookies(cookies);
    }
1177823
public URLConnectionRequestPropertiesBuilder withCookie(String cookieName, String cookieValue) {
        if (requestProperties.containsKey("Cookie")) {
            // there are existing cookies so just append the new cookie at the end
            final String cookies = requestProperties.get("Cookie");
            requestProperties.put("Cookie", cookies + COOKIES_SEPARATOR + buildCookie(cookieName, cookieValue));
        } else {
            // this is the first cookie to be added
            requestProperties.put("Cookie", buildCookie(cookieName, cookieValue));
        }
        return this;
    }
728845
private static boolean pathMatches(URI uri, HttpCookie cookie) {
        return normalizePath(uri.getPath()).startsWith(normalizePath(cookie.getPath()));
    }
285625
@Override
    public boolean setCookie(HttpCookie cookie, HttpHeaderKeys header) {
        if (null == cookie || null == header) {
            return false;
        }

        // only cookie versions 0 and 1 are supported
        if (1 < cookie.getVersion()) {
            throw new IllegalArgumentException("Invalid cookie version: " + cookie.getVersion());
        }

        if (header.equals(HttpHeaderKeys.HDR_COOKIE) || header.equals(HttpHeaderKeys.HDR_COOKIE2)) {
            return addCookie(cookie, header);
        }
        return false;
    }
1325280
private void performAdjustCookies(HttpServletRequest request, HttpServletResponse response) throws Exception {

		boolean loggedIn = false;
		User user = null;
		try {
			Cookie cookie = getCookieFromRequest(request);
			if( null != cookie ) {
				user = CookieAuthentication.verifyCookieString(userRepository, cookie.getValue());
				loggedIn = true;
			}
		} catch(Exception e) {
			// Ignore
		}
		
		if( null == user ) {
			user = userRepository.getDefaultUser();
		}
		
		acceptRequest(response, loggedIn, user);
	}
1266700
function convertCookie (value, converter) {
  if (value.indexOf('"') === 0) {
    // this is a quoted cookied according to RFC2068
    // remove enclosing quotes and internal quotes and backslashes
    value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  }

  let parsedValue;
  try {
    parsedValue = decodeURIComponent(value.replace(/\+/g, ' '));
  } catch (e) {
    // no need to fail if we can't decode
    log.warn(e);
  }

  return converter ? converter(parsedValue) : parsedValue;
}
728751
protected Cookie convertToCookie(IPortalCookie portalCookie, boolean secure) {
        final Cookie cookie = new Cookie(this.cookieName, portalCookie.getValue());

        // Set the cookie's fields
        cookie.setComment(this.comment);
        cookie.setMaxAge(this.maxAge);
        cookie.setSecure(secure);
        cookie.setHttpOnly(true);
        if (this.domain != null) {
            cookie.setDomain(this.domain);
        }

        cookie.setPath(this.path);

        return cookie;
    }
405043
public void updateDomaincookies(Boolean domainCookies) throws SecurityException {
	checkWriteAccess();
	boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
	if (!hasAccess) throw new SecurityException("no access to update scope setting");

	Element scope = _getRootElement("scope");
	scope.setAttribute("setdomaincookies", Caster.toString(domainCookies, ""));
    }
1097595
@Override
    public boolean allowToAddCookieToResponse(HttpServletRequest req) {
        if (!config.isSingleSignonEnabled()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "SSO is not enabled. Not setting the SSO Cookie");
            }
            return false;
        }
        boolean secureRequest = req.isSecure();
        if (config.getSSORequiresSSL() && !secureRequest) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "SSO requires SSL. The cookie will not be sent back because the request is not over https.");
            }
            return false;
        }
        return true;
    }