Skip to content
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(ocm): use host instead of hostDomain for normalizing ocm providers #4837

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading