Class GenericCookieUtilsImpl
java.lang.Object
org.broadleafcommerce.common.security.util.GenericCookieUtilsImpl
- All Implemented Interfaces:
CookieUtils
@Component("blCookieUtils")
public class GenericCookieUtilsImpl
extends Object
implements CookieUtils
-
Field Summary
FieldsFields inherited from interface org.broadleafcommerce.common.security.util.CookieUtils
CUSTOMER_COOKIE_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCookieValue(javax.servlet.http.HttpServletRequest request, String cookieName) voidinvalidateCookie(javax.servlet.http.HttpServletResponse response, String cookieName) voidsetCookieValue(javax.servlet.http.HttpServletResponse response, String cookieName, String cookieValue) voidsetCookieValue(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 {@link ESAPI#httpUtilities()#addHeader(HttpServletResponse, String, String)} fails if the value isnullor an empty String.Checkscookies.use.secureSystem Property, which determines whether to use HTTPS cookie over HTTPS connection or HTTP only.
-
Field Details
-
COOKIE_INVALIDATION_PLACEHOLDER_VALUE
- See Also:
-
-
Constructor Details
-
GenericCookieUtilsImpl
public GenericCookieUtilsImpl()
-
-
Method Details
-
shouldUseSecureCookieIfApplicable
Description copied from interface:CookieUtilsCheckscookies.use.secureSystem Property, which determines whether to use HTTPS cookie over HTTPS connection or HTTP only.- Specified by:
shouldUseSecureCookieIfApplicablein interfaceCookieUtils- Returns:
- value of
cookies.use.secure
-
getCookieValue
- Specified by:
getCookieValuein interfaceCookieUtils
-
setCookieValue
public void setCookieValue(javax.servlet.http.HttpServletResponse response, String cookieName, String cookieValue, String path, Integer maxAge, Boolean isSecure) Description copied from interface:CookieUtilsUses a cookie value of "CookieInvalidationPlaceholderValue" because the later call to {@link ESAPI#httpUtilities()#addHeader(HttpServletResponse, String, String)} fails if the value isnullor an empty String. If an empty cookie value is passed, this is considered a request to remove the cookie andmaxAgeis set to 0 to force the removal. In addition, calls to {@link ESAPI#httpUtilities()#killCookie(HttpServletRequest, HttpServletResponse, String)} have shown to be ineffective while this approach for removing cookies works.- Specified by:
setCookieValuein interfaceCookieUtils
-
setCookieValue
public void setCookieValue(javax.servlet.http.HttpServletResponse response, String cookieName, String cookieValue) - Specified by:
setCookieValuein interfaceCookieUtils
-
invalidateCookie
- Specified by:
invalidateCookiein interfaceCookieUtils
-