Class CookieUtil
- java.lang.Object
-
- com.broadleafcommerce.auth.user.util.CookieUtil
-
public class CookieUtil extends Object
Basic cookie functionality shared byDefaultOAuth2AuthorizedClientRepository
andBroadleafAuthorizationRequestRepository
- Author:
- Cade Rea (cade-rea)
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static javax.servlet.http.Cookie
createCookie(String cookieName, String content, int maxAge)
Deprecated.since 1.6, replaced bycreateResponseCookie(String, String, int, String)
static javax.servlet.http.Cookie
createDeleteCookie(String cookieName)
Deprecated.since 1.6, replaced bycreateSessionRemovalResponseCookie(String, String)
static org.springframework.http.ResponseCookie
createResponseCookie(String cookieName, String content, int maxAge, String sameSite)
Creates an HTTP-only, secure cookie with the given name, content, maxAge, and SameSite attributes.static javax.servlet.http.Cookie
createSessionCookie(String cookieName, String content)
Deprecated.since 1.6, replaced bycreateSessionResponseCookie(String, String, String)
static org.springframework.http.ResponseCookie
createSessionRemovalResponseCookie(String cookieName, String sameSite)
Creates a cookie which will cause deletion of a previously set cookie.static org.springframework.http.ResponseCookie
createSessionResponseCookie(String cookieName, String content, String sameSite)
Creates a cookie with attributes appropriate for a session cookie.static String
getCookieValue(String name, javax.servlet.http.HttpServletRequest request)
-
-
-
Method Detail
-
getCookieValue
public static String getCookieValue(String name, javax.servlet.http.HttpServletRequest request)
-
createSessionCookie
@Deprecated public static javax.servlet.http.Cookie createSessionCookie(String cookieName, String content)
Deprecated.since 1.6, replaced bycreateSessionResponseCookie(String, String, String)
Creates a cookie with attributes appropriate for a session cookie.- Parameters:
cookieName
- the name of the cookie to createcontent
- the value of the cookie- Returns:
- the created cookie
-
createDeleteCookie
@Deprecated public static javax.servlet.http.Cookie createDeleteCookie(String cookieName)
Deprecated.since 1.6, replaced bycreateSessionRemovalResponseCookie(String, String)
Creates a cookie which will cause deletion of a previously set cookie.- Parameters:
cookieName
- the name of the cookie- Returns:
- the created cookie
-
createCookie
@NonNull @Deprecated public static javax.servlet.http.Cookie createCookie(String cookieName, String content, int maxAge)
Deprecated.since 1.6, replaced bycreateResponseCookie(String, String, int, String)
Creates an HTTP-only, secure cookie with the given name, content, and max-age.- Parameters:
cookieName
- the name of the cookie to createcontent
- the cookie valuemaxAge
- the max age for the cookie- Returns:
- the created cookie
-
createSessionResponseCookie
public static org.springframework.http.ResponseCookie createSessionResponseCookie(String cookieName, String content, String sameSite)
Creates a cookie with attributes appropriate for a session cookie.- Parameters:
cookieName
- the name of the cookie to createcontent
- the value of the cookiesameSite
- the SameSite attribute value for the cookie, ex: 'Lax', 'Strict', 'None'- Returns:
- the created cookie
- See Also:
createResponseCookie(String, String, int, String)
-
createSessionRemovalResponseCookie
public static org.springframework.http.ResponseCookie createSessionRemovalResponseCookie(String cookieName, String sameSite)
Creates a cookie which will cause deletion of a previously set cookie.- Parameters:
cookieName
- the name of the cookiesameSite
- the SameSite attribute value for the cookie, ex: 'Lax', 'Strict', 'None'- Returns:
- the created cookie
- See Also:
createResponseCookie(String, String, int, String)
-
createResponseCookie
public static org.springframework.http.ResponseCookie createResponseCookie(String cookieName, String content, int maxAge, @Nullable String sameSite)
Creates an HTTP-only, secure cookie with the given name, content, maxAge, and SameSite attributes.- Parameters:
cookieName
- the name of the cookie to createcontent
- the cookie valuemaxAge
- the max age for the cookiesameSite
- the SameSite attribute value for the cookie, ex: 'Lax', 'Strict', 'None'- Returns:
- the created cookie
-
-