Repository navigation
Description
Why?
With access control (#62), owners grant roles on their services by user identifier: PUT /services/{serviceId}/permissions/{userId}, where userId is the LS Login sub claim. The sub is the right identifier to store (stable and unique, unlike email addresses, which change and can be reassigned), but nobody knows their own sub, and LS Login offers no lookup from email address to sub for relying parties. Granting a colleague access therefore requires them to find and send their identifier first.
How?
Invitation links: an owner creates an invitation for a service and role and sends the link to a colleague through any channel; the colleague logs in and accepts it, which grants the role to their own sub. No email addresses are involved.
- Endpoints (additions spec, under the cloud-registry tag):
POST /services/{serviceId}/invitationswith{"role": "owner" | "maintainer"}: owners (and admins) create an invitation; returns its identifier, role, expiry and a one-time token.GET /services/{serviceId}/invitations: owners list open and accepted invitations (without tokens), including who accepted them.DELETE /services/{serviceId}/invitations/{invitationId}: owners revoke an open invitation.POST /invitations/acceptwith{"token": "..."}: any authenticated user accepts an invitation. The token goes in the body, not the path, so that it doesn't end up in access logs.
- Storage: collection
invitationswith a hash (SHA-256) of the token, never the token itself; service, role, creator, expiry (default 7 days, configurable) and acceptance (sub, display name, time). Expired invitations are removed by a TTL index. - Accepting is atomic and single-use (
find_one_and_updateon an open, unexpired invitation). It grants the role likePUT .../permissions/{userId}(replacing another role on the service). Accepting an invitation for a deleted service fails with 404; deleting a service deletes its invitations. - Display names: store the display name (and email, if released) from user info when an invitation is accepted, so that owners see who accepted. Coordinate with the open question in Cloud Registry backend: public read access, service ownership, ECP_CLN:ADMIN admin role #62 on exposing owners.
- Tokens:
secrets.token_urlsafe(32). The UI builds the link and should carry the token in the URL fragment (#...), which browsers do not send to servers. - Policies for the new paths in
config.yaml; tests for every path (create, list, revoke, accept, expired, used twice, wrong role, non-owner, deleted service); docs.
A forwarded link grants the role to whoever accepts it first. Expiry, single use, and owners seeing who accepted (and being able to revoke the role) limit this, as with invitations in GitHub or Google Docs.
Acceptance criteria
- An owner can invite a colleague without knowing their
sub; after accepting, the colleague has the role. - Tokens are single-use, expire, can be revoked, and are not stored in plain text.
- Maintainers and other users cannot create, list or revoke invitations of a service.
Dependencies: #62 (access control). The UI part (invite button, accept page) will be tracked in cloud-registry-ui. Related: ownership by groups (e.g., a node's team managed in Perun) needs FOCA support (elixir-cloud-aai/foca#316).
Activity