- All Implemented Interfaces:
Serializable
,Comparable<SameSite>
,Constable
The SameSite attribute of the Set-Cookie HTTP response header allows you to declare if your
cookie should be restricted to a first-party or same-site context.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionCookies are allowed to be sent with top-level navigations and will be sent along with GET request initiated by third party website.Cookies will be sent in all contexts, i.e sending cross-origin is allowed.Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites. -
Method Summary
Modifier and TypeMethodDescriptiongetValue()
Returns the parameter value used inSet-Cookie
.static SameSite
Returns an instance of this class based on value it uses inSet-Cookie
.boolean
Returns whether this value requires the cookie to be flagged asSecure
.static SameSite
Returns the enum constant of this class with the specified name.static SameSite[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
LAX
Cookies are allowed to be sent with top-level navigations and will be sent along with GET request initiated by third party website. This is the default value in modern browsers. -
STRICT
Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites. -
NONE
Cookies will be sent in all contexts, i.e sending cross-origin is allowed. Requires theSecure
attribute in latest browser versions.
-
-
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
-
getValue
Returns the parameter value used inSet-Cookie
.- Returns:
- the parameter value.
-
requiresSecure
public boolean requiresSecure()Returns whether this value requires the cookie to be flagged asSecure
.- Returns:
true
if the cookie should be secure.
-
of
Returns an instance of this class based on value it uses inSet-Cookie
.- Parameters:
value
- the value.- Returns:
- an instance of this class.
- Throws:
IllegalArgumentException
- if an invalid value is specified.- See Also:
-