diff --git a/proxy/pkg/command/server.go b/proxy/pkg/command/server.go index 40ec611a859..50376b362c9 100644 --- a/proxy/pkg/command/server.go +++ b/proxy/pkg/command/server.go @@ -221,6 +221,7 @@ func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config) middleware.UserProvider(userProvider), middleware.OIDCIss(cfg.OIDC.Issuer), middleware.UserOIDCClaim(cfg.UserOIDCClaim), + middleware.UserCS3Claim(cfg.UserCS3Claim), middleware.CredentialsByUserAgent(cfg.Reva.Middleware.Auth.CredentialsByUserAgent), ), middleware.SignedURLAuth( diff --git a/proxy/pkg/middleware/authentication.go b/proxy/pkg/middleware/authentication.go index 79a6746f479..b2b63c45fae 100644 --- a/proxy/pkg/middleware/authentication.go +++ b/proxy/pkg/middleware/authentication.go @@ -127,6 +127,7 @@ func newBasicAuth(options Options) func(http.Handler) http.Handler { AccountsClient(options.AccountsClient), OIDCIss(options.OIDCIss), UserOIDCClaim(options.UserOIDCClaim), + UserCS3Claim(options.UserCS3Claim), CredentialsByUserAgent(options.CredentialsByUserAgent), ) } diff --git a/proxy/pkg/middleware/basic_auth.go b/proxy/pkg/middleware/basic_auth.go index 14e4ef59d6f..e7106365150 100644 --- a/proxy/pkg/middleware/basic_auth.go +++ b/proxy/pkg/middleware/basic_auth.go @@ -85,11 +85,14 @@ 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, } + if options.UserCS3Claim == "userid" { + claims[options.UserOIDCClaim] = user.Id.OpaqueId + // OpaqueId contains the userid configured in STORAGE_LDAP_USER_SCHEMA_UID + } next.ServeHTTP(w, req.WithContext(oidc.NewContext(req.Context(), claims))) },