Skip to content
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

IgnoreAuthenticationIfAllowAnonymous in HandleAuthenticateAsync specifically doesn't ignore #9

Closed
ghost opened this issue Sep 16, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 16, 2021

Code in question:

if (IgnoreAuthenticationIfAllowAnonymous())
{
Logger.LogInformation("AllowAnonymous found on the endpoint so request was not authenticated.");
return AuthenticateResult.NoResult();
}

Problem:

The log statement at line 56 breaks the promise to ignore authentication if the endpoint is annotated with [AllowAnonymous].

Expected behavior:

When querying an endpoint annotated with [AllowAnonymous], authentication logic should be ignored.

Actual behavior:

When querying an endpoint annotated with [AllowAnonymous], two lines of log output are produced, stating that nothing is going on. (logspam)

Example:

info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.
info: AspNetCore.Authentication.Basic.BasicHandler[0]
No 'Authorization' header found in the request.

Pull request:

#8

@mihirdilip
Copy link
Owner

Hi @hcshmk, your request is updated with 6.0.1 release just published. Sorry it took a while as I was waiting for .net6.0 release and then got busy with other stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant