-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-authIncludes: Authn, Authz, OAuth, OIDC, BearerIncludes: Authn, Authz, OAuth, OIDC, Bearerdesign-proposalThis issue represents a design proposal for a different issue, linked in the descriptionThis issue represents a design proposal for a different issue, linked in the description
Milestone
Description
Summary
In the current version of aspnetcore AuthorizationMiddleware it is pretty hard to determine which authentication schemes or which policy failed. Even if debug logs are enabled, no info gets displayed.
Motivation and goals
- Easier debugging / error finding for false defined policies or bad requests
In scope
- aspnet service with multiple authentication policies defined.
Out of scope
- aspnet service without authentication or authentication policies
Risks / unknowns
- Logger null --> small concern
- Too many logs --> Choose Debug-Level
Examples
Add a logger to AuthorizationMiddleware
private readonly ILogger<AuthorizationMiddleware> _logger;Log if not succeded and a policy is defined
if (authenticateResult != null && !authenticateResult.Succeeded)
{
_logger.LogDebug("Policy authentication schemes {policyName} did not succeed", String.Join(", ", policy.AuthenticationSchemes));
}Metadata
Metadata
Assignees
Labels
area-authIncludes: Authn, Authz, OAuth, OIDC, BearerIncludes: Authn, Authz, OAuth, OIDC, Bearerdesign-proposalThis issue represents a design proposal for a different issue, linked in the descriptionThis issue represents a design proposal for a different issue, linked in the description