Class CookieUtil
java.lang.Object
com.broadleafcommerce.auth.user.util.CookieUtil
Basic cookie functionality shared by
DefaultOAuth2AuthorizedClientRepository
and
BroadleafAuthorizationRequestRepository
- Author:
- Cade Rea (cade-rea)
-
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.servlet.http.Cookie
createCookie
(String cookieName, String content, int maxAge) Deprecated.static jakarta.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 jakarta.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, jakarta.servlet.http.HttpServletRequest request)
-
Method Details
-
getCookieValue
-
createSessionCookie
@Deprecated public static jakarta.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.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 jakarta.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:
-
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
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
-
createResponseCookie(String, String, int, String)