Module io.jooby
Package io.jooby

Enum Class SameSite

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

public enum SameSite extends Enum<SameSite>
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.
See Also:
  • 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
    Cookies 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 Type
    Method
    Description
    Returns the parameter value used in Set-Cookie.
    static SameSite
    of(String value)
    Returns an instance of this class based on value it uses in Set-Cookie.
    boolean
    Returns whether this value requires the cookie to be flagged as Secure.
    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.Enum

    compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

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

    • LAX

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

      public static final SameSite STRICT
      Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites.
    • NONE

      public static final SameSite NONE
      Cookies will be sent in all contexts, i.e sending cross-origin is allowed. Requires the Secure attribute in latest browser versions.
  • 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
    • getValue

      public String getValue()
      Returns the parameter value used in Set-Cookie.
      Returns:
      the parameter value.
    • requiresSecure

      public boolean requiresSecure()
      Returns whether this value requires the cookie to be flagged as Secure.
      Returns:
      true if the cookie should be secure.
    • of

      public static SameSite of(String value)
      Returns an instance of this class based on value it uses in Set-Cookie.
      Parameters:
      value - the value.
      Returns:
      an instance of this class.
      Throws:
      IllegalArgumentException - if an invalid value is specified.
      See Also: