Enum Class SameSite

java.lang.Object
java.lang.Enum<SameSite>
de.craftsblock.craftsnet.api.http.cookies.SameSite
All Implemented Interfaces:
Serializable, Comparable<SameSite>, Constable

public enum SameSite extends Enum<SameSite>
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 Constants
    Enum Constant
    Description
    The "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

    Modifier and Type
    Method
    Description
    static SameSite
    Returns the enum constant of this class with the specified name.
    static SameSite[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NONE

      public static final SameSite 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

      public static final SameSite 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

      public static final SameSite 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

      public static SameSite[] 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

      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.)
      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 name
      NullPointerException - if the argument is null