@Component(value="blCookieUtils") public class GenericCookieUtilsImpl extends Object implements CookieUtils
Modifier and Type | Field and Description |
---|---|
protected String |
COOKIE_INVALIDATION_PLACEHOLDER_VALUE |
CUSTOMER_COOKIE_NAME
Constructor and Description |
---|
GenericCookieUtilsImpl() |
Modifier and Type | Method and Description |
---|---|
String |
getCookieValue(javax.servlet.http.HttpServletRequest request,
String cookieName) |
void |
invalidateCookie(javax.servlet.http.HttpServletResponse response,
String cookieName) |
void |
setCookieValue(javax.servlet.http.HttpServletResponse response,
String cookieName,
String cookieValue) |
void |
setCookieValue(javax.servlet.http.HttpServletResponse response,
String cookieName,
String cookieValue,
String path,
Integer maxAge,
Boolean isSecure)
Uses a cookie value of "CookieInvalidationPlaceholderValue" because the later call to
ESAPI#httpUtilities()#addHeader(HttpServletResponse, String, String)
fails if the value is null or an empty String. |
Boolean |
shouldUseSecureCookieIfApplicable()
Checks
cookies.use.secure System Property, which determines whether to use HTTPS cookie over
HTTPS connection or HTTP only. |
protected final String COOKIE_INVALIDATION_PLACEHOLDER_VALUE
public Boolean shouldUseSecureCookieIfApplicable()
CookieUtils
cookies.use.secure
System Property, which determines whether to use HTTPS cookie over
HTTPS connection or HTTP only.shouldUseSecureCookieIfApplicable
in interface CookieUtils
cookies.use.secure
public String getCookieValue(javax.servlet.http.HttpServletRequest request, String cookieName)
getCookieValue
in interface CookieUtils
public void setCookieValue(javax.servlet.http.HttpServletResponse response, String cookieName, String cookieValue, String path, Integer maxAge, Boolean isSecure)
CookieUtils
ESAPI#httpUtilities()#addHeader(HttpServletResponse, String, String)
fails if the value is null
or an empty String. If an empty cookie value is passed,
this is considered a request to remove the cookie and maxAge
is set to 0 to force the removal.
In addition, calls to ESAPI#httpUtilities()#killCookie(HttpServletRequest, HttpServletResponse, String)
have shown to be ineffective while this approach for removing cookies works.setCookieValue
in interface CookieUtils
public void setCookieValue(javax.servlet.http.HttpServletResponse response, String cookieName, String cookieValue)
setCookieValue
in interface CookieUtils
public void invalidateCookie(javax.servlet.http.HttpServletResponse response, String cookieName)
invalidateCookie
in interface CookieUtils
Copyright © 2022. All rights reserved.