Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Cookie(name, value, path, maxAge, isSecure, SameSite)

Creates a new instance of the Cookie class using the specified name, value, path, and age, and settings for security and cross-domain behavior.

Google Chrome 80 introduces a new default cookie attribute setting of SameSite, which is set to Lax. Previously, the SameSite cookie attribute defaulted to the value of None. When SameSite is set to None, cookies must be tagged with the isSecure attribute indicating that they require an encrypted HTTPS connection.

Note

Signature

public Cookie(String name, String value, String path, Integer maxAge, Boolean isSecure, String SameSite)

Parameters

  • name:

    Type: String

    The cookie name. It can’t be null.

  • value:

    Type: String

    The cookie data, such as session ID.

  • path:

    Type: String

    The path from where you can retrieve the cookie.

  • maxAge:

    Type: Integer

    A number representing how long a cookie is valid for in seconds. If set to less than zero, a session cookie is issued. If set to zero, the cookie is deleted.

  • isSecure:

    Type: Boolean

    A value indicating whether the cookie can only be accessed through HTTPS (true) or not (false).

  • SameSite:

    Type: String

    The SameSite attribute on a cookie controls its cross-domain behavior. The valid values are None, Lax, and Strict. After the Chrome 80 release, a cookie with a SameSite value of None must also be marked secure by setting a value of None; Secure.