Enum Class SameSite

All Implemented Interfaces:
Serializable, Comparable<SameSite>, Constable

public enum SameSite extends 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
  • Enum Constant Details

    • 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 Details

    • values

      public static SameSite[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SameSite valueOf(String name)
      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.)
      name - the name of the enum constant to be returned.
      the enum constant with the specified name
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null