-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API Proposal]: AuthN/AuthZ metrics #59818
Comments
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
API approved! Microsoft.AspNetCore.Authentication
Microsoft.AspNetCore.Authorization
|
@lmolkova, would you mind giving this API a look (described in the comment just above this one) and letting us know if you think there's anything else that needs revision? The main things that need confirmation are:
Thanks! |
Background and Motivation
This is a collection of metrics for ASP.NET Core Authentication and Authorization.
Implemented in #59557.
Proposed API
Microsoft.AspNetCore.Authentication
aspnetcore.authentication.request.duration
aspnetcore.authentication.request.duration
{request}
aspnetcore.authentication.scheme
Bearer
;Cookies
Conditionally Required
if the request did not end with an erroraspnetcore.authentication.result
success
;failure
;none
;_OTHER
Conditionally Required
if the request did not end with an errorerror.type
System.InvalidOperationException
;Contoso.MyException
Conditionally Required
if the request has ended with an erroraspnetcore.authentication.challenges
aspnetcore.authentication.challenges
{request}
aspnetcore.authentication.scheme
Bearer
;Cookies
Conditionally Required
if the request did not end with an errorerror.type
System.InvalidOperationException
;Contoso.MyException
Conditionally Required
if the request has ended with an erroraspnetcore.authentication.forbids
aspnetcore.authentication.forbids
{request}
aspnetcore.authentication.scheme
Bearer
;Cookies
Conditionally Required
if the request did not end with an errorerror.type
System.InvalidOperationException
;Contoso.MyException
Conditionally Required
if the request has ended with an erroraspnetcore.authentication.sign_ins
aspnetcore.authentication.sign_ins
{request}
aspnetcore.authentication.scheme
Bearer
;Cookies
Conditionally Required
if the request did not end with an errorerror.type
System.InvalidOperationException
;Contoso.MyException
Conditionally Required
if the request has ended with an erroraspnetcore.authentication.sign_outs
aspnetcore.authentication.sign_ins
{request}
aspnetcore.authentication.scheme
Bearer
;Cookies
Conditionally Required
if the request did not end with an errorerror.type
System.InvalidOperationException
;Contoso.MyException
Conditionally Required
if the request has ended with an errorMicrosoft.AspNetCore.Authorization
aspnetcore.authorization.requests
aspnetcore.authorization.requests
{request}
user.is_authenticated
true
Required
aspnetcore.authorization.policy
AtLeast21
;EmployeeOnly
Conditionally required
if an authorization policy is usedaspnetcore.authorization.result
success
;failure
Conditionally Required
if an exception is not thrown during authorizationerror.type
System.InvalidOperationException
;Contoso.MyException
Conditionally Required
if the request has ended with an errorAlternative Designs
Currently,
error.type
is just the exception type name. This isn't very descriptive. We could also consider a way to allow authentication handlers to specify a failure reason (maybe in some kind ofaspnetcore.authentication.failure_reason
attribute). This can be added in the future as a non-breaking change.Also,
error.type
is only populated if an unhandled exception is thrown by a handler. This excludes cases where authentication fails by returning anAuthenticationResult
indicating failure (even though theAuthenticateResult
contains anException
describing the failure). We could changeerror.type
to contain the type of any exception in theAuthenticateResult
, but this would be inconsistent with authorization becauseAuthorizationResult
does not contain an exception to be reported on.Risks
None that I'm aware of.
The text was updated successfully, but these errors were encountered: