-
Notifications
You must be signed in to change notification settings - Fork 189
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
fix basic auth with custom user claim #2755
Conversation
proxy/pkg/middleware/basic_auth.go
Outdated
@@ -85,6 +85,7 @@ func BasicAuth(optionSetters ...Option) func(next http.Handler) http.Handler { | |||
// fake oidc claims | |||
claims := map[string]interface{}{ | |||
oidc.OwncloudUUID: user.Id.OpaqueId, | |||
options.UserOIDCClaim: user.Id.OpaqueId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this give you a dupliacte key here? E.g. when options.UserOIDCClaim == oidc.Email
(which AFAIU even is the default)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It indeed duplicates the key in some cases... But Go is fine with duplicate key as long as one of the duplicate keys is a variable... (https://play.golang.org/p/juVyt9SRnUf).
While looking at this I noticed, that options.UserOIDCClaim
should only be set if use the userid
to search for users on the CS3apis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for clarifying. Didn't know that.
e67a759
to
7dca7b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nitpick about the comment. Otherwise lgtm.
Kudos, SonarCloud Quality Gate passed! |
Description
We've fixed authentication with basic if oCIS is configured to use a non-standard claim
as user claim (
PROXY_USER_OIDC_CLAIM
). Prior to this bugfix the authentication alwaysfailed and is now working.
Related Issue
Motivation and Context
Make basic auth login work.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: