Exemplo n.º 1
0
        internal void SetHstsHeader(HttpResponseBase response, bool isHttps)
        {
            if (!isHttps && WebConfig.SecurityHttpHeaders.Hsts.HttpsOnly)
            {
                return;
            }

            var result = _headerGenerator.CreateHstsResult(WebConfig.SecurityHttpHeaders.Hsts);

            _headerResultHandler.HandleHeaderResult(response, result);
        }
Exemplo n.º 2
0
        internal void SetHstsHeader(IHttpContextWrapper httpContext, bool isHttps, bool upgradeSupported)
        {
            if (!isHttps && WebConfig.SecurityHttpHeaders.Hsts.HttpsOnly)
            {
                return;
            }

            if (!upgradeSupported && WebConfig.SecurityHttpHeaders.Hsts.UpgradeInsecureRequests)
            {
                return;
            }

            var result = _headerGenerator.CreateHstsResult(WebConfig.SecurityHttpHeaders.Hsts);

            _headerResultHandler.HandleHeaderResult(httpContext, result);
        }
Exemplo n.º 3
0
        public void SetXRobotsTagHeader(HttpContext context)
        {
            var config = _headerConfigurationOverrideHelper.GetXRobotsTagWithOverride(context);

            if (config == null)
            {
                return;
            }

            var oldConfig = _contextConfigurationHelper.GetXRobotsTagConfiguration(context);

            var result = _headerGenerator.CreateXRobotsTagResult(config, oldConfig);

            _headerResultHandler.HandleHeaderResult(context.Response, result);
        }