Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (s *service) ForwardInvite(ctx context.Context, req *invitepb.ForwardInvite
RecipientProvider: s.conf.ProviderDomain,
// The UserID is only a string here. To not lose the IDP information we use the LocalUserFederatedID encoding
// i.e. UserID@IDP
UserID: ocmuser.LocalUserFederatedID(user.GetId(), "").GetOpaqueId(),
UserID: ocmuser.FormatOCMUser(user.GetId()),
Email: user.GetMail(),
Name: user.GetDisplayName(),
})
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/ocmd/invites.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (h *invitesHandler) AcceptInvite(w http.ResponseWriter, r *http.Request) {
}

if err := json.NewEncoder(w).Encode(&user{
UserID: ocmuser.LocalUserFederatedID(acceptInviteResponse.UserId, "").GetOpaqueId(),
UserID: ocmuser.FormatOCMUser(acceptInviteResponse.UserId),
Email: acceptInviteResponse.Email,
Name: acceptInviteResponse.DisplayName,
}); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/grpc/ocm_invitation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var _ = Describe("ocm invitation workflow", func() {
Id: &userpb.UserId{
Type: userpb.UserType_USER_TYPE_FEDERATED,
Idp: "cernbox.cern.ch",
OpaqueId: "4c510ada-c86b-4815-8820-42cdf82c3d51",
OpaqueId: "4c510ada-c86b-4815-8820-42cdf82c3d51@https://cernbox.cern.ch",
},
Username: "einstein",
Mail: "einstein@cern.ch",
Expand All @@ -138,7 +138,7 @@ var _ = Describe("ocm invitation workflow", func() {
Id: &userpb.UserId{
Type: userpb.UserType_USER_TYPE_FEDERATED,
Idp: "cesnet.cz",
OpaqueId: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c",
OpaqueId: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c@https://cesnet.cz",
},
Username: "marie",
Mail: "marie@cesnet.cz",
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/grpc/ocm_share_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ var _ = Describe("ocm share", func() {
}
federatedEinsteinID = &userpb.UserId{
Type: userpb.UserType_USER_TYPE_FEDERATED,
Idp: "cernbox.cern.ch",
OpaqueId: "4c510ada-c86b-4815-8820-42cdf82c3d51",
Idp: "cernbox.cern.ch", // the provider is stored in the idp property
OpaqueId: "4c510ada-c86b-4815-8820-42cdf82c3d51@https://cernbox.cern.ch", // the original idp becomes part of the opaqueid
}
marie = &userpb.User{
Id: &userpb.UserId{
Expand All @@ -140,8 +140,8 @@ var _ = Describe("ocm share", func() {
}
federatedMarieID = &userpb.UserId{
Type: userpb.UserType_USER_TYPE_FEDERATED,
Idp: "cesnet.cz",
OpaqueId: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c",
Idp: "cesnet.cz", // the provider is stored in the idp property
OpaqueId: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c@https://cesnet.cz", // the original idp becomes part of the opaqueid
}
)

Expand Down Expand Up @@ -214,7 +214,7 @@ var _ = Describe("ocm share", func() {
Expect(invRes.UserId.Type).To(Equal(userpb.UserType_USER_TYPE_FEDERATED))
// Federated users use the OCM provider id which MUST NOT contain the protocol
Expect(invRes.UserId.Idp).To(Equal("cernbox.cern.ch"))
// The OpaqueId is the base64 encoded user id and the provider id to prevent collisions with other users on the graph API
// The OpaqueId follows the pattern{user opaque id}@{user ipd}@{provider id} to prevent collisions with other users on the graph API
Expect(invRes.UserId.OpaqueId).To(Equal(federatedEinsteinID.OpaqueId))
})

Expand Down