Enum Class SameSite
- All Implemented Interfaces:
Serializable,Comparable<SameSite>,Constable
Enumeration representing the SameSite attribute of a cookie.
The SameSite attribute allows you to declare if your cookie should be restricted to a first-party or same-site context. This attribute helps to protect against Cross-Site Request Forgery (CSRF) attacks.
- Since:
- 3.0.6
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe "Lax" value allows the cookie to be sent with same-site requests and with top-level cross-site navigation.The "None" value allows the cookie to be sent with both cross-site and same-site requests.The "Strict" value ensures that the cookie is sent only in a first-party context (same-site requests). -
Method Summary
-
Enum Constant Details
-
NONE
The "None" value allows the cookie to be sent with both cross-site and same-site requests. Cookies with the SameSite=None attribute must also be marked as Secure. -
LAX
The "Lax" value allows the cookie to be sent with same-site requests and with top-level cross-site navigation. It provides a reasonable balance between security and usability. -
STRICT
The "Strict" value ensures that the cookie is sent only in a first-party context (same-site requests). This provides the highest level of protection against CSRF attacks but can affect the usability of some applications.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-