On IIS my web application responds with 403 Forbidden. To troubleshoot the issue I'd like to log events of Windows Authentication.
The setup in Startup.cs
is as following:
services.AddAuthentication(IISDefaults.AuthenticationScheme);
services.AddAuthorization(options =>
{
options.AddPolicy("Editor", policy =>
{
var sid = "my-sid";
policy.RequireRole(sid);
});
});
services.AddMvc((options) =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.Filters.Add(new AuthorizeFilter(policy));
});
Is it possible to attach any event listeners or hooks to the authentication or authorization process so that I can log what's happening?
I know that it's possible for JwtBearer middleware
, see How do I log authorization attempts in .net core