Пример #1
0
        public static IApplicationBuilder UseHttpStrictTransportSecurity(this IApplicationBuilder app, Action <HttpStrictTransportSecurityOptions> configure)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            var options = new HttpStrictTransportSecurityOptions();

            configure?.Invoke(options);

            return(UseHttpStrictTransportSecurity(app, options));
        }
Пример #2
0
        public HttpStrictTransportSecurityMiddleware(RequestDelegate next, HttpStrictTransportSecurityOptions options, ILogger <HttpStrictTransportSecurityMiddleware> logger)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _logger  = logger;
            _next    = next;
            _options = options;
        }
Пример #3
0
        public static IApplicationBuilder UseHttpStrictTransportSecurity(this IApplicationBuilder app, HttpStrictTransportSecurityOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(app.UseMiddleware <HttpStrictTransportSecurityMiddleware>(options));
        }