diff --git a/changelog/unreleased/ocm-fix-federated-userid.md b/changelog/unreleased/ocm-fix-federated-userid.md index eb7843cf17..4fa2dd3efb 100644 --- a/changelog/unreleased/ocm-fix-federated-userid.md +++ b/changelog/unreleased/ocm-fix-federated-userid.md @@ -2,5 +2,6 @@ Bugfix: fix OCM userid encoding We now base64 encode the remote userid and provider as the local federated user id. This allows us to always differentiate them from local users and unpack the encoded user id and provider when making requests to the remote ocm provider. +https://github.com/cs3org/reva/pull/4837 https://github.com/cs3org/reva/pull/4833 https://github.com/owncloud/ocis/issues/9927 diff --git a/pkg/ocm/provider/authorizer/json/json.go b/pkg/ocm/provider/authorizer/json/json.go index a47ef6b778..fc3eb0c891 100644 --- a/pkg/ocm/provider/authorizer/json/json.go +++ b/pkg/ocm/provider/authorizer/json/json.go @@ -104,7 +104,7 @@ func normalizeDomain(d string) (string, error) { return "", err } - return u.Hostname(), nil + return u.Host, nil } func (a *authorizer) GetInfoByDomain(_ context.Context, domain string) (*ocmprovider.ProviderInfo, error) { diff --git a/pkg/ocm/provider/authorizer/json/json_test.go b/pkg/ocm/provider/authorizer/json/json_test.go index 04c9f5b290..52c525733b 100644 --- a/pkg/ocm/provider/authorizer/json/json_test.go +++ b/pkg/ocm/provider/authorizer/json/json_test.go @@ -24,9 +24,10 @@ func TestAuthorizer_GetInfoByDomain(t *testing.T) { expectedDomain string expectedError error }{ - "domain only": {givenDomain: "server-one:9200", expectedDomain: "server-one"}, - "domain with port": {givenDomain: "server-two:9200", expectedDomain: "server-two:9200"}, - "unknown domain": {givenDomain: "unknown-domain", expectedError: errtypes.NotFound("unknown-domain")}, + "domain only": {givenDomain: "server-one", expectedDomain: "server-one"}, + "domain with port": {givenDomain: "server-two:9200", expectedDomain: "server-two:9200"}, + "domain only with port in result": {givenDomain: "server-two", expectedDomain: "server-two:9200"}, + "unknown domain": {givenDomain: "unknown-domain", expectedError: errtypes.NotFound("unknown-domain")}, } { t.Run(name, func(t *testing.T) { info, err := authorizer.GetInfoByDomain(context.Background(), env.givenDomain)