Package io.micronaut.http.cookie
Enum SameSite
- java.lang.Object
-
- java.lang.Enum<SameSite>
-
- io.micronaut.http.cookie.SameSite
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<SameSite>
public enum SameSite extends java.lang.Enum<SameSite>
Asserts that a cookie must not be sent with cross-origin requests, providing some protection against cross-site request forgery attacks (CSRF). Possible values for the SameSite attribute. See changes to RFC6265bis- Since:
- 1.3.4
-
-
Enum Constant Summary
Enum Constants Enum Constant Description Lax
The cookie will be sent along with the GET request initiated by third party website.None
Allows third-party cookies to track users across sites.Strict
When the SameSite attribute is set as Strict, the cookie will not be sent along with requests initiated by third party websites.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SameSite
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static SameSite[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
Lax
public static final SameSite Lax
The cookie will be sent along with the GET request initiated by third party website.
-
Strict
public static final SameSite Strict
When the SameSite attribute is set as Strict, the cookie will not be sent along with requests initiated by third party websites.
-
None
public static final SameSite None
Allows third-party cookies to track users across sites. The None directive requires the Secure attribute.
-
-
Method Detail
-
values
public static SameSite[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SameSite c : SameSite.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SameSite valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
-