Skip to content

alexalok/PathProtectionMiddleware

Repository files navigation

Nuget

Installation

Install-Package PathProtectionMiddleware

Sample usage

app.UseAuthentication();
app.UseAuthorization();

if (!env.IsDevelopment())
{
    app.UsePathProtection(opt => 
    {
        opt.PathStartsWith = "/admin"; // Mandatory
        opt.PolicyName = "Staff"; // Mandatory
        opt.AuthenticationSchemeName = CookieAuthenticationDefaults.AuthenticationScheme; // Optional
    });
}

app.UseEndpoints(endpoints =>
{
	endpoints.MapControllers();
});

About

Protect resources in your ASP.NET Core application by their path (route).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages