Enum Cookie.SameSiteOptions

    • Enum Constant Detail

      • NONE

        public static final Cookie.SameSiteOptions NONE
        Cookies will be sent in all contexts, i.e sending cross-origin is allowed.

        None used to be the default value, but recent browser versions made Lax the default value to have reasonably robust defense against some classes of cross-site request forgery (CSRF) attacks.

        None requires the Secure attribute in latest browser versions. See below for more information.

      • LAX

        public static final Cookie.SameSiteOptions LAX
        Cookies are allowed to be sent with top-level navigations and will be sent along with GET requests initiated by third party website. This is the default value in modern browsers as of 2020.
      • STRICT

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

      • values

        public static Cookie.SameSiteOptions[] 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 (Cookie.SameSiteOptions c : Cookie.SameSiteOptions.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Cookie.SameSiteOptions valueOf​(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:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null