@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } return !cookie.isSecure() || origin.isSecure(); }
/** * The function iterates through the list of cookies in the cookiestore and tries to * match them with the cookieName. If there is a match, the cookieStore already * has a valid cookie and the client need not send Credentials for validation purpose. * @param cookieStore The cookie Store * @param cookieName Name of the cookie which needs to be validated * @param isSSL Whether this is a http/https connection * @return true or false based on whether the client needs to send the credentials or * not to the server. */ static boolean needToSendCredentials(CookieStore cookieStore, String cookieName, boolean isSSL) { if (cookieName == null || cookieStore == null) { return true; } List<Cookie> cookies = cookieStore.getCookies(); for (Cookie c : cookies) { // If this is a secured cookie and the current connection is non-secured, // then, skip this cookie. We need to skip this cookie because, the cookie // replay will not be transmitted to the server. if (c.isSecure() && !isSSL) { continue; } if (c.getName().equals(cookieName)) { return false; } } return true; }
line.append(cookie.getPath() != null ? cookie.getPath() : "/"); line.append(tab); line.append(cookie.isSecure() ? "TRUE" : "FALSE"); line.append(tab); line.append(cookie.getExpiryDate() != null ? cookie.getExpiryDate().getTime() / 1000 : -1);
@Override public boolean isSecure() { return delegate.isSecure(); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } return !cookie.isSecure() || origin.isSecure(); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } return !cookie.isSecure() || origin.isSecure(); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } return !cookie.isSecure() || origin.isSecure(); }
/** * @param cookieName name of cookie. * @return whether cookie in the cookie store requires a secure connection. */ public Boolean cookieIsSecure(String cookieName) { Boolean result = null; Cookie cookie = getCookie(cookieName); if (cookie != null) { result = cookie.isSecure(); } return result; }
private void writeObject(ObjectOutputStream out) throws IOException { out.writeObject(cookie.getName()); out.writeObject(cookie.getValue()); out.writeObject(cookie.getComment()); out.writeObject(cookie.getDomain()); out.writeObject(cookie.getExpiryDate()); out.writeObject(cookie.getPath()); out.writeInt(cookie.getVersion()); out.writeBoolean(cookie.isSecure()); }
private void writeObject(ObjectOutputStream out) throws IOException { out.writeObject(cookie.getName()); out.writeObject(cookie.getValue()); out.writeObject(cookie.getComment()); out.writeObject(cookie.getDomain()); out.writeObject(cookie.getExpiryDate()); out.writeObject(cookie.getPath()); out.writeInt(cookie.getVersion()); out.writeBoolean(cookie.isSecure()); }
private void writeObject(ObjectOutputStream out) throws IOException { out.writeObject(cookie.getName()); out.writeObject(cookie.getValue()); out.writeObject(cookie.getComment()); out.writeObject(cookie.getDomain()); out.writeObject(cookie.getExpiryDate()); out.writeObject(cookie.getPath()); out.writeInt(cookie.getVersion()); out.writeBoolean(cookie.isSecure()); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); return !cookie.isSecure() || origin.isSecure(); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); return !cookie.isSecure() || origin.isSecure(); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); return !cookie.isSecure() || origin.isSecure(); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); return !cookie.isSecure() || origin.isSecure(); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); return !cookie.isSecure() || origin.isSecure(); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); return !cookie.isSecure() || origin.isSecure(); }
@Override public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); return !cookie.isSecure() || origin.isSecure(); }
Cookie(org.apache.http.cookie.Cookie cookie) { this.name = cookie.getName(); this.value = cookie.getValue(); this.expires = cookie.getExpiryDate(); this.path = cookie.getPath(); this.domain = cookie.getDomain(); this.httpOnly = false; this.secure = cookie.isSecure(); }
private static Cookie convert(org.apache.http.cookie.Cookie in) { return new Cookie(in.getName(), in.getValue(), in.getDomain(), in.getPath(), in.getExpiryDate(), in.isSecure()); }