public class CookieUtils extends Object
Constructor and Description |
---|
CookieUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addCookieToResponse(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.Cookie cookie)
Add cookie to HttpServletResponse as custom header
|
static String |
checkDoubleQuote(String cookie)
Check cookie value whether it has double quote or not.
|
static String |
getAmCookieName()
Gets property value of "com.iplanet.am.cookie.name"
|
static String |
getAmPCookieName()
Returns property value of "com.iplanet.am.pcookie.name"
|
static Set |
getCdssoCookiedomain()
Returns property value of "com.iplanet.services.cdsso.cookiedomain"
|
static javax.servlet.http.Cookie[] |
getCookieArrayFromReq(javax.servlet.http.HttpServletRequest req)
Gets Array of cookie in servlet request.
|
static javax.servlet.http.Cookie |
getCookieFromReq(javax.servlet.http.HttpServletRequest req,
String name)
Gets cookie object that has mached name in servlet request
|
static String |
getCookieSameSite()
Returns property value of "org.openidentityplatform.openam.cookie.samesite"
|
static String |
getCookieValue(javax.servlet.http.Cookie cookie)
Returns normalized value of cookie
|
static String |
getCookieValueFromReq(javax.servlet.http.HttpServletRequest req,
String name)
Returns value of cookie that has mached name in servlet request
|
static String |
getFedCookieName()
Returns property value of "com.sun.identity.federation.fedCookieName"
|
static Set<String> |
getMatchingCookieDomains(javax.servlet.http.HttpServletRequest request,
Collection<String> cookieDomains)
Matches the provided cookie domains against the current request's domain and returns the resulting set of
matching cookie domains if the 'com.sun.identity.authentication.setCookieToAllDomains' advanced property is set
to false.
|
static Map<String,String> |
getRequestCookies(javax.servlet.http.HttpServletRequest request)
This method creates Map from the name values of cookies
present in the given
HttpServletRequest |
static boolean |
isCookieHttpOnly()
Returns property value of "com.sun.identity.cookie.httponly"
|
static boolean |
isCookieSecure()
Returns property value of "com.iplanet.am.cookie.secure"
|
static javax.servlet.http.Cookie |
newCookie(String name,
String value)
Returns a cookie with a specified name and value.
|
static javax.servlet.http.Cookie |
newCookie(String name,
String value,
int maxAge)
Returns a cookie with a specified name and value and sets the maximum
age of the cookie in seconds.
|
static javax.servlet.http.Cookie |
newCookie(String name,
String value,
int maxAge,
String path,
String domain)
Returns a cookie with a specified name and value and sets the maximum
age of the cookie in seconds and sets a path for the cookie to which the
client should return the cookie and sets the domain within which this
cookie should be presented.
|
static javax.servlet.http.Cookie |
newCookie(String name,
String value,
String path)
Returns a cookie with a specified name and value and sets a path for
the cookie to which the client should return the cookie.
|
static javax.servlet.http.Cookie |
newCookie(String name,
String value,
String path,
String domain)
Returns a cookie with a specified name and value and sets a path for
the cookie to which the client should return the cookie and sets the
domain within which this cookie should be presented.
|
public static String getAmCookieName()
public static String getAmPCookieName()
public static Set getCdssoCookiedomain()
public static String getFedCookieName()
public static boolean isCookieSecure()
public static boolean isCookieHttpOnly()
public static String getCookieSameSite()
public static String getCookieValueFromReq(javax.servlet.http.HttpServletRequest req, String name)
req
- HTTP Servlet Request.name
- Name in servlet requestpublic static javax.servlet.http.Cookie getCookieFromReq(javax.servlet.http.HttpServletRequest req, String name)
req
- HTTP Servlet Request.name
- Name in servlet requestpublic static String getCookieValue(javax.servlet.http.Cookie cookie)
cookie
- Cookie object.public static javax.servlet.http.Cookie[] getCookieArrayFromReq(javax.servlet.http.HttpServletRequest req)
req
- HTTP Servlet Request.public static Map<String,String> getRequestCookies(javax.servlet.http.HttpServletRequest request)
HttpServletRequest
request
- reference to HttpServletRequest
public static javax.servlet.http.Cookie newCookie(String name, String value)
name
- Name of the cookie.value
- Value of the cookie.public static javax.servlet.http.Cookie newCookie(String name, String value, int maxAge)
name
- Name of the cookievalue
- Value of the cookiemaxAge
- Maximum age of the cookie in seconds; if negative, means
the cookie is not stored; if zero, deletes the cookie.public static javax.servlet.http.Cookie newCookie(String name, String value, String path)
name
- Name of the cookievalue
- Value of the cookiepath
- Pathpublic static javax.servlet.http.Cookie newCookie(String name, String value, String path, String domain)
name
- Name of the cookievalue
- Value of the cookiepath
- Pathdomain
- Domain name within which this cookie is visible; form is
according to RFC 2109
public static javax.servlet.http.Cookie newCookie(String name, String value, int maxAge, String path, String domain)
name
- Name of the cookievalue
- Value of the cookiemaxAge
- Maximum age of the cookie in seconds; if negative, means
the cookie is not stored; if zero, deletes the cookie.path
- Pathdomain
- Domain name within which this cookie is visible; form is
according to RFC 2109
public static String checkDoubleQuote(String cookie)
cookie
- Value of the Cookiepublic static void addCookieToResponse(javax.servlet.http.HttpServletResponse response, javax.servlet.http.Cookie cookie)
response
- cookie
- public static Set<String> getMatchingCookieDomains(javax.servlet.http.HttpServletRequest request, Collection<String> cookieDomains)
request
- The HTTP request.cookieDomains
- The configured cookie domains to match against.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.