Skip to content

Commit

Permalink
fix basic auth with custom user claim
Browse files Browse the repository at this point in the history
  • Loading branch information
wkloucek committed Nov 11, 2021
1 parent 45c3b07 commit d05df2f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/fix-basic-auth-with-custom-user-claim
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Fix basic auth with custom user claim

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 always
failed and is now working.

https://github.com/owncloud/ocis/pull/2755
1 change: 1 addition & 0 deletions proxy/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config)
middleware.EnableBasicAuth(cfg.EnableBasicAuth),
middleware.UserProvider(userProvider),
middleware.OIDCIss(cfg.OIDC.Issuer),
middleware.UserOIDCClaim(cfg.UserOIDCClaim),
middleware.CredentialsByUserAgent(cfg.Reva.Middleware.Auth.CredentialsByUserAgent),
),
middleware.SignedURLAuth(
Expand Down
1 change: 1 addition & 0 deletions proxy/pkg/middleware/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func newBasicAuth(options Options) func(http.Handler) http.Handler {
EnableBasicAuth(options.EnableBasicAuth),
AccountsClient(options.AccountsClient),
OIDCIss(options.OIDCIss),
UserOIDCClaim(options.UserOIDCClaim),
CredentialsByUserAgent(options.CredentialsByUserAgent),
)
}
1 change: 1 addition & 0 deletions proxy/pkg/middleware/basic_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
oidc.Iss: user.Id.Idp,
oidc.PreferredUsername: user.Username,
oidc.Email: user.Mail,
Expand Down

0 comments on commit d05df2f

Please sign in to comment.