public HstsMiddleware(AppFunc next, HstsOptions options)
            : base(next)
        {
            _config = options;

            var headerGenerator = new HeaderGenerator();
            _headerResult = headerGenerator.CreateHstsResult(_config);
        }
 public void Setup()
 {
     _options = new HstsOptions();
 }
 /// <summary>
 /// Add middleware that sets HSTS response header for ensuring subsequent requests are made over HTTPS only.
 /// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security for more details.
 /// </summary>
 /// <param name="builder">The <see cref="IApplicationBuilder"/>.</param>
 /// <param name="options">The <see cref="HstsOptions"/> to use.</param>
 /// <returns>The <see cref="IApplicationBuilder"/>.</returns>
 public static IApplicationBuilder UseHsts(this IApplicationBuilder builder, HstsOptions options)
 {
     return(builder.UseMiddleware <HstsMiddleware>(options));
 }
Exemple #4
0
 public void Setup()
 {
     _options = new HstsOptions();
 }