@Override public void clear() { cookies.clear(); } }
public Client resetCookies() { cookieStore.clear(); return this; }
public static class RegexMatcher extends TypeSafeMatcher<String> { private final String regex; public RegexMatcher(final String regex) { this.regex = regex; } @Override public void describeTo(final Description description) { description.appendText("matches regex=`" + regex + "`"); } @Override public boolean matchesSafely(final String string) { return string.matches(regex); } public static RegexMatcher matchesRegex(final String regex) { return new RegexMatcher(regex); } }
assertEquals(HttpStatus.FOUND, result.getStatusCode()); cookies.clear(); if (result.getHeaders().containsKey("Set-Cookie")) { for (String cookie : result.getHeaders().get("Set-Cookie")) {
assertEquals(HttpStatus.FOUND, result.getStatusCode()); cookies.clear(); if (result.getHeaders().containsKey("Set-Cookie")) { for (String cookie : result.getHeaders().get("Set-Cookie")) {
cookieStore.clear(); setCookiesFromResponse(cookieStore, loginResponse); headers.add(HttpHeaders.ACCEPT, MediaType.TEXT_HTML_VALUE);
assertEquals(HttpStatus.FOUND, result.getStatusCode()); cookies.clear(); if (result.getHeaders().containsKey("Set-Cookie")) { for (String cookie : result.getHeaders().get("Set-Cookie")) {
cookies.clear(); if (result.getHeaders().containsKey("Set-Cookie")) { for (String cookie : result.getHeaders().get("Set-Cookie")) {
@Override public void clear() { cookies.clear(); } }
public void clearCookies() { this.cookieStore.clear(); }
public void invalidate() { lastConnection = null; gerritAuthOptional = Optional.absent(); hostSupportsGerritAuth = true; cookieStore.clear(); }
public HTTPSession clearCookies() { BasicCookieStore cookies = (BasicCookieStore) this.sessioncontext.getCookieStore(); if(cookies != null) cookies.clear(); return this; }
/** * Clear all cookies */ @PublicAtsApi public void clearCookies() { BasicCookieStore cookieStore = (BasicCookieStore) httpContext.getAttribute(HttpClientContext.COOKIE_STORE); if (cookieStore != null) { cookieStore.clear(); } }
@Override public void clear(DriverRequest request) { UserContext userContext = request.getUserContext(); BasicCookieStore cookies = (BasicCookieStore) userContext.getAttribute(COOKIES_LIST_SESSION_KEY); if (cookies != null) { cookies.clear(); userContext.setAttribute(COOKIES_LIST_SESSION_KEY, cookies); } }
private Optional<String> updateGerritAuthWhenRequired(HttpContext httpContext, HttpClientBuilder client) throws IOException, HttpStatusException { if (!loginCache.getHostSupportsGerritAuth()) { // We do not need a cookie here since we are sending credentials as HTTP basic / digest header again. // In fact cookies could hurt: googlesource.com Gerrit instances block requests which send a magic cookie // named "gi" with a 400 HTTP status (as of 2015-01-29). cookieStore.clear(); return Optional.absent(); } if (authData.isHttpPassword()) { // Do not use a Gerrit HTTP password token to authenticate against the // login page. This will cause Gerrit to use the password to authenticate // against the configured authentication source (LDAP, etc) and potentially // lock the account. return Optional.absent(); } Optional<Cookie> gerritAccountCookie = findGerritAccountCookie(); if (!gerritAccountCookie.isPresent() || gerritAccountCookie.get().isExpired(new Date()) || !isSessionValid(client, httpContext)) { return updateGerritAuth(httpContext, client); } return loginCache.getGerritAuthOptional(); }
/** * Remove a Cookie by name and path * * @param name cookie name * @param path cookie path */ @PublicAtsApi public void removeCookie( String name, String path ) { BasicCookieStore cookieStore = (BasicCookieStore) httpContext.getAttribute(HttpClientContext.COOKIE_STORE); if (cookieStore != null) { List<Cookie> cookies = cookieStore.getCookies(); cookieStore.clear(); for (Cookie cookie : cookies) { if (!cookie.getName().equals(name) || !cookie.getPath().equals(path)) { cookieStore.addCookie(cookie); } } } }