public XDownloadOptionsMiddleware(AppFunc next) : base(next) { _config = new SimpleBooleanConfiguration { Enabled = true }; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateXDownloadOptionsResult(_config); }
public XDownloadOptionsMiddleware(RequestDelegate next) : base(next) { _config = new SimpleBooleanConfiguration { Enabled = true }; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateXDownloadOptionsResult(_config); }
public XContentTypeOptionsMiddleware(AppFunc next) : base(next) { _config = new SimpleBooleanConfiguration { Enabled = true }; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateXContentTypeOptionsResult(_config); }
internal void SetNoCacheHeadersOverride(HttpContextBase context, ISimpleBooleanConfiguration setNoCacheHeadersConfig) { var headerList = GetHeaderListFromContext(context); const string headerKey = SetNoCacheHeadersKey; if (headerList.ContainsKey(headerKey)) headerList.Remove(headerKey); headerList.Add(headerKey, setNoCacheHeadersConfig); }
internal void SetXContentTypeOptionsOverride(HttpContextBase context, ISimpleBooleanConfiguration xContentTypeOptionsConfig) { var headerList = GetHeaderListFromContext(context); var headerKey = HeaderConstants.XContentTypeOptionsHeader; if (headerList.ContainsKey(headerKey)) headerList.Remove(headerKey); headerList.Add(headerKey, xContentTypeOptionsConfig); }
internal void SetXContentTypeOptionsOverride(HttpContext context, ISimpleBooleanConfiguration xContentTypeOptionsConfig) { var headerList = GetHeaderListFromContext(context); var headerKey = HeaderConstants.XContentTypeOptionsHeader; if (headerList.ContainsKey(headerKey)) { headerList.Remove(headerKey); } headerList.Add(headerKey, xContentTypeOptionsConfig); }
internal void SetNoCacheHeadersOverride(HttpContext context, ISimpleBooleanConfiguration setNoCacheHeadersConfig) { var headerList = GetHeaderListFromContext(context); const string headerKey = SetNoCacheHeadersKey; if (headerList.ContainsKey(headerKey)) { headerList.Remove(headerKey); } headerList.Add(headerKey, setNoCacheHeadersConfig); }
public HeaderResult CreateXDownloadOptionsResult(ISimpleBooleanConfiguration xDownloadOptionsConfig, ISimpleBooleanConfiguration oldXDownloadOptionsConfig = null) { if (oldXDownloadOptionsConfig != null && oldXDownloadOptionsConfig.Enabled && !xDownloadOptionsConfig.Enabled) { return(new HeaderResult(HeaderResult.ResponseAction.Remove, HeaderConstants.XDownloadOptionsHeader)); } return(xDownloadOptionsConfig.Enabled ? new HeaderResult(HeaderResult.ResponseAction.Set, HeaderConstants.XDownloadOptionsHeader, "noopen") : null); }
public HeaderResult CreateXDownloadOptionsResult(ISimpleBooleanConfiguration xDownloadOptionsConfig, ISimpleBooleanConfiguration oldXDownloadOptionsConfig = null) { if (oldXDownloadOptionsConfig != null && oldXDownloadOptionsConfig.Enabled && !xDownloadOptionsConfig.Enabled) { return new HeaderResult(HeaderResult.ResponseAction.Remove, HeaderConstants.XDownloadOptionsHeader); } return xDownloadOptionsConfig.Enabled ? new HeaderResult(HeaderResult.ResponseAction.Set, HeaderConstants.XDownloadOptionsHeader, "noopen") : null; }
public HeaderResult CreateXContentTypeOptionsResult(ISimpleBooleanConfiguration xContentTypeOptionsConfig, ISimpleBooleanConfiguration oldXContentTypeOptionsConfig = null) { if (oldXContentTypeOptionsConfig != null && oldXContentTypeOptionsConfig.Enabled && !xContentTypeOptionsConfig.Enabled) { return(new HeaderResult(HeaderResult.ResponseAction.Remove, HeaderConstants.XContentTypeOptionsHeader)); } return(xContentTypeOptionsConfig.Enabled ? new HeaderResult(HeaderResult.ResponseAction.Set, HeaderConstants.XContentTypeOptionsHeader, "nosniff") : null); }
public HeaderResult CreateXContentTypeOptionsResult(ISimpleBooleanConfiguration xContentTypeOptionsConfig, ISimpleBooleanConfiguration oldXContentTypeOptionsConfig = null) { if (oldXContentTypeOptionsConfig != null && oldXContentTypeOptionsConfig.Enabled && !xContentTypeOptionsConfig.Enabled) { return new HeaderResult(HeaderResult.ResponseAction.Remove, HeaderConstants.XContentTypeOptionsHeader); } return xContentTypeOptionsConfig.Enabled ? new HeaderResult(HeaderResult.ResponseAction.Set, HeaderConstants.XContentTypeOptionsHeader, "nosniff") : null; }
internal void SetXDownloadOptionsOverride(IHttpContextWrapper context, ISimpleBooleanConfiguration xDownloadOptionsConfig) { context.GetNWebsecOverrideContext().XDownloadOptions = xDownloadOptionsConfig; }
internal void SetXContentTypeOptionsOverride(IHttpContextWrapper context, ISimpleBooleanConfiguration xContentTypeOptionsConfig) { context.GetNWebsecOverrideContext().XContentTypeOptions = xContentTypeOptionsConfig; }
internal void SetNoCacheHeadersOverride(IHttpContextWrapper context, ISimpleBooleanConfiguration setNoCacheHeadersConfig) { context.GetNWebsecOverrideContext().NoCacheHeaders = setNoCacheHeadersConfig; }