Skip to content

Commit

Permalink
Merge pull request #4837 from fschade/oc-normalise-domain-use-host
Browse files Browse the repository at this point in the history
fix(ocm): use host instead of hostDomain for normalizing ocm providers
  • Loading branch information
butonic authored Sep 5, 2024
2 parents cf5e5eb + f4fefc3 commit 2de6ff3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/ocm-fix-federated-userid.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pkg/ocm/provider/authorizer/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 4 additions & 3 deletions pkg/ocm/provider/authorizer/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2de6ff3

Please sign in to comment.