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

HTTP request fails with 401 if more than one IdentityProvider produced no SecurityIdentity but is allowed if a single one is used #17591

Closed
sberyozkin opened this issue Jun 1, 2021 · 2 comments · Fixed by #29479
Assignees
Labels
area/security kind/bug Something isn't working
Milestone

Comments

@sberyozkin
Copy link
Member

sberyozkin commented Jun 1, 2021

Describe the bug

Bill @patriot1burke has spotted that when a matching HttpAuthenticationMechanism requests the request credentials be converted to SecurityIdentity then if only a single IdentityProvider returns null then the request is allowed to continue with an anonymous identity, despite the credentials being available - but will fail with 401 if more than one IdentityProvider has not provided SecurityIdentity

Expected behavior

It has to be consistent in both cases.

And IMHO it has to be 401 because it should be a responsibility of HttpAuthenticationMechanism to decide whether a null SecurityIdentity is returned or not: if it does not recognize the credentials - return null, if it does - then it has to be converted.

Allowing the request to proceed where for example the provided Basic Auth credentials, with the proactive autentication enabled, are represented as an anonymous identity and eventually returning 403 at the RBAC level (as opposed to 401 if the name or password are wrong) is not quite correct.

See also #17192

CC @patriot1burke @stuartwdouglas

@sberyozkin sberyozkin added the kind/bug Something isn't working label Jun 1, 2021
@sberyozkin sberyozkin changed the title HTTP request fails wit 401 if more than one IdentityProvider produced no SecurityIdentity but is allowed if a single one is used HTTP request fails with 401 if more than one IdentityProvider produced no SecurityIdentity but is allowed if a single one is used Jun 1, 2021
@sberyozkin sberyozkin self-assigned this Feb 16, 2022
@sberyozkin
Copy link
Member Author

@michalvavrik Have a look at this one if it can be of interest please

@michalvavrik
Copy link
Member

Will do, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants