public class

PublicSuffixFilter

extends Object
implements CookieAttributeHandler
java.lang.Object
   ↳ org.apache.http.impl.cookie.PublicSuffixFilter

Class Overview

Wraps a CookieAttributeHandler and leverages its match method to never match a suffix from a black list. May be used to provide additional security for cross-site attack types by preventing cookies from apparent domains that are not publicly available. An uptodate list of suffixes can be obtained from publicsuffix.org

Summary

Public Constructors
PublicSuffixFilter(CookieAttributeHandler wrapped)
Public Methods
boolean match(Cookie cookie, CookieOrigin origin)
Never matches if the cookie's domain is from the blacklist.
void parse(SetCookie cookie, String value)
Parse the given cookie attribute value and update the corresponding Cookie property.
void setExceptions(Collection<String> exceptions)
Sets the exceptions from the blacklist.
void setPublicSuffixes(Collection<String> suffixes)
Sets the suffix blacklist patterns.
void validate(Cookie cookie, CookieOrigin origin)
Peforms cookie validation for the given attribute value.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.cookie.CookieAttributeHandler

Public Constructors

public PublicSuffixFilter (CookieAttributeHandler wrapped)

Also: HttpClient

Public Methods

public boolean match (Cookie cookie, CookieOrigin origin)

Also: HttpClient

Never matches if the cookie's domain is from the blacklist.

Parameters
cookie Cookie to match
origin the cookie source to match against
Returns
  • true if the match is successful; false otherwise

public void parse (SetCookie cookie, String value)

Also: HttpClient

Parse the given cookie attribute value and update the corresponding Cookie property.

Parameters
cookie Cookie to be updated
value cookie attribute value from the cookie response header

public void setExceptions (Collection<String> exceptions)

Also: HttpClient

Sets the exceptions from the blacklist. Exceptions can not be patterns. TODO add support for patterns

public void setPublicSuffixes (Collection<String> suffixes)

Also: HttpClient

Sets the suffix blacklist patterns. A pattern can be "com", "*.jp" TODO add support for patterns like "lib.*.us"

public void validate (Cookie cookie, CookieOrigin origin)

Also: HttpClient

Peforms cookie validation for the given attribute value.

Parameters
cookie Cookie to validate
origin the cookie source to validate against