// Copyright (c) André N. Klingsheim. See License.txt in the project root for license information. using System; using NWebsec.Core.Fluent; namespace NWebsec.Middleware { /// /// Fluent interface to configure options for Http Strict Transport Security. /// public interface IFluentHstsOptions : IFluentInterface { /// /// Specifies the max age for the HSTS header. /// /// The number of days added to max age. /// The number of hours added to max age. /// The number of minutes added to max age. /// The number of seconds added to max age. /// The current instance. /// Thrown if a negative value was supplied in any of the parameters. IFluentHstsOptions MaxAge(int days = 0, int hours = 0, int minutes = 0, int seconds = 0); /// /// Enables the IncludeSubdomains directive in the Hsts header. /// /// The current instance. IFluentHstsOptions IncludeSubdomains(); /// /// Enables the Preload directive in the HSTS header. MaxAge must be at least 18 weeks, and IncludeSubdomains must be enabled. /// /// Read more about preloaded HSTS sites at www.chromium.org/sts /// The current instance. IFluentHstsOptions Preload(); /// /// Sets the HSTS header only when the user agent signals that it supports the upgrade-insecure-requests CSP directive. /// /// This setting is intended to be used in combination with the upgrade-insecure-requests CSP directive. /// The current instance. IFluentHstsOptions UpgradeInsecureRequests(); /// /// Specifies that the HSTS header should also be set for HTTP responses. The header is always set for HTTPS responses. /// /// The HSTS standard specifies that the header should only be set over secure connections, which is the default behavior. /// This configuration option exists to accomodate websites running behind an SSL terminator. /// The current instance. IFluentHstsOptions AllResponses(); /// /// Specifies that the HSTS header should be set for HTTPS responses only. /// /// The current instance. [Obsolete("This method is deprecated as the default has been changed to HTTPS only.", false)] IFluentHstsOptions HttpsOnly(); } }