Setup and Installation of Zen Firewall for Dotnet
1
Install Zen Firewall by Aikido
dotnet add package Aikido.Zen.DotNetCoredotnet add package Zen.Aikido.DotNetFrameworkInstall-Package Zen.Aikido.DotNetFrameworkpublic void ConfigureServices(IServiceCollection services)
{
// other services
services.AddZenFirewall(Configuration);
// other services
}
public void Configure(IApplicationBuilder app)
{
// other middleware
app.UseZenFirewall(); // place this after userouting, or after authorization, but high enough in the pipeline to catch all requests
// other middleware
}protected void Application_Start()
{
// other code
Zen.Start();
}
# If you are using OWIN, you can add the following to your Startup.cs file:
public void Configuration(IAppBuilder app)
{
// other code
Zen.Start();
}2
3
5
Enable Rate limiting and User blocking
.UseRouting()
.Use((context, next) =>
{
// Identify users to the Zen platform
var id = context.User?.Identity?.Name ?? "-1";
var name = context.User?.Identity?.Name ?? "Anonymous";
if (!string.IsNullOrEmpty(id))
Zen.SetUser(id, name, context);
return next();
})
.UseZenFireWall()public void Application_Start()
{
// ...
Zen.SetUser(context => new User(context.User.Identity.Name, context.User.Identity.Name));
Zen.Start();
}public void Configuration(IAppBuilder app)
{
// ...
Zen.SetUser(context => new User(context.User.Identity.Name, context.User.Identity.Name));
Zen.Start();
}6
Last updated
Was this helpful?




