Class SecurityHeadersMiddleware
- Namespace
- ProjectTemplate.Web.Middleware
- Assembly
- ProjectTemplate.Web.dll
Middleware that applies a set of security-related HTTP headers to responses.
public sealed class SecurityHeadersMiddleware
- Inheritance
-
SecurityHeadersMiddleware
- Inherited Members
Remarks
The middleware can be configured via ApplicationSecurityHeadersOptions to enable/disable individual headers and to exclude certain request path prefixes.
Constructors
SecurityHeadersMiddleware(RequestDelegate, IOptions<ApplicationSecurityHeadersOptions>)
Middleware that applies a set of security-related HTTP headers to responses.
public SecurityHeadersMiddleware(RequestDelegate next, IOptions<ApplicationSecurityHeadersOptions> options)
Parameters
nextRequestDelegateoptionsIOptions<ApplicationSecurityHeadersOptions>
Remarks
The middleware can be configured via ApplicationSecurityHeadersOptions to enable/disable individual headers and to exclude certain request path prefixes.
Methods
InvokeAsync(HttpContext)
Invokes the middleware for the given context, applying configured
security headers to the response when appropriate.
public Task InvokeAsync(HttpContext context)
Parameters
contextHttpContextThe current HTTP context.