// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; namespace Microsoft.AspNetCore.Http { /// /// Options used to create a new cookie. /// public class CookieOptions { /// /// Creates a default cookie with a path of '/'. /// public CookieOptions() { Path = "/"; } /// /// Gets or sets the domain to associate the cookie with. /// /// The domain to associate the cookie with. public string Domain { get; set; } /// /// Gets or sets the cookie path. /// /// The cookie path. public string Path { get; set; } /// /// Gets or sets the expiration date and time for the cookie. /// /// The expiration date and time for the cookie. public DateTimeOffset? Expires { get; set; } /// /// Gets or sets a value that indicates whether to transmit the cookie using Secure Sockets Layer (SSL)--that is, over HTTPS only. /// /// true to transmit the cookie only over an SSL connection (HTTPS); otherwise, false. public bool Secure { get; set; } /// /// Gets or sets the value for the SameSite attribute of the cookie. The default value is /// /// The representing the enforcement mode of the cookie. public SameSiteMode SameSite { get; set; } = SameSiteMode.Unspecified; /// /// Gets or sets a value that indicates whether a cookie is accessible by client-side script. /// /// true if a cookie must not be accessible by client-side script; otherwise, false. public bool HttpOnly { get; set; } /// /// Gets or sets the max-age for the cookie. /// /// The max-age date and time for the cookie. public TimeSpan? MaxAge { get; set; } /// /// Indicates if this cookie is essential for the application to function correctly. If true then /// consent policy checks may be bypassed. The default value is false. /// public bool IsEssential { get; set; } } }