What this is about
Anna administers the tenant nordbau. She wants to bring Bea in. CIAS has no separate mechanism for that: an invitation is an ordinary registration, only in the variant TENANT_ADMIN – the administrator starts it, and the invited person finishes it.
Who may invite
| Condition | Where it comes from |
|---|---|
The variant TENANT_ADMIN is switched on | the installation’s configuration |
The caller holds every role in required-caller-roles | configuration; in cias-runtime that is tenant-admin |
| The caller has a tenant in the token | the token itself |
The tenant of the invitation is the caller’s tenant. A tenantKey in the payload is discarded without being checked. That way nobody can invite into somebody else’s tenant.
The flow
sequenceDiagram
participant A as Anna (tenant-admin, nordbau)
participant C as CIAS
participant K as Keycloak
participant M as Email
participant B as Bea
A->>C: POST /cias/tenant/registrations<br/>email, firstName, lastName
C->>C: check the role, tenant from the token: nordbau
C->>C: is there already an account for that address?
C->>K: only if not: create the account disabled
C->>M: mail with a one-time link to /registration/verify
C-->>A: 202 accepted
M-->>B: mail
B->>C: opens the link and redeems it
C->>K: membership in nordbau, attributes, member roles
C->>C: user record, registration COMPLETED
C->>M: welcome mail
B->>K: signs in
Anna does not learn from the answer whether Bea already has an account: both cases answer 202 accepted. Only the mail differs, and only Bea sees it.
The two cases
When: There is no account for Bea's address, at most the leftover of an abandoned attempt (disabled in Keycloak and the address never verified).
-
1CIAS→Keycloakcreates the account disabled and unverified
-
2CIAS→Emailsends the mail "confirm your address" with the one-time link
-
3User→CIASredeems the link
-
4CIAS→Keycloakaddress verified, enable the account, require "set a password"
-
5CIAS→Keycloakmember of
nordbau, attributestenantandallowedTenants, member roles
Result: Bea sets her password at Keycloak and signs in. Registration kind NEW_ACCOUNT.
When: Bea's address already belongs to an account, because she works for suedlogistik for instance.
-
1CIAScreates no second account and changes nothing about the existing one, not even the password
-
2CIAS→Emailsends the mail "invitation to another tenant" with the one-time link
-
3User→CIASredeems the link
-
4CIAS→Keycloakmember of
nordbau, in addition to her existing memberships. The attributestenantandallowedTenantsare set tonordbau -
5CIAS→Keycloakmember roles, inside the organization
nordbau
Result: Bea signs in as usual, with her old password, and now works in two tenants. Registration kind ADDITIONAL_MEMBERSHIP. See One person in two tenants.
| colleague is new | colleague already has an account | |
|---|---|---|
| Kind of registration | NEW_ACCOUNT | ADDITIONAL_MEMBERSHIP |
| Account in Keycloak | created disabled and enabled after the click | stays untouched |
| "confirm your address" | "invitation to another tenant" | |
| Password | has to be set, CIAS never sees it | stays as it is; no password link is sent |
| After redeeming | member of nordbau | member of nordbau and of her existing tenants |
| User record in CIAS | created, with nordbau as the home tenant | stays as it is, the home tenant does not change |
What Bea does from the mail
In both cases the link in the mail points at the same page: /registration/verify?token=…. That page can do two things:
-
1User→Frontendopens the link from the mail
-
2Frontend→CIAS
GET /cias/registration/invitations/{token}/formshows which fields Anna left open -
3Frontend→CIAS
POST /cias/registration/verifywith the token – the endpoint/invitations/acceptdoes exactly the same -
4CIASDoes the token exist, and has it not expired?no: 404
cias.registration.not-found -
5CIASregistration →
VERIFIED, then provisioning right away. The flowTENANT_ADMINrequires no approvalResult:202 accepted, then the welcome mail
Redeeming takes only the token. Details Anna did not provide stay empty; the display name in the user record is built from first and last name and otherwise falls back to the address.
How long the link is valid is set by the flow’s configuration (token-ttl). In cias-runtime it is 14 days.
What Bea may see afterwards
On redeeming, Bea gets the roles of the situation TENANT_MEMBER – not those of a founder. An invitation must not hand out tenant administration.
| Level | What applies |
|---|---|
| Initial roles | the rule of the tenant nordbau, else the installation rule, else the default. Shipped: tenant-user |
| Where the roles sit | nordbau is a dynamic tenant, so inside the organization. With a static tenant they are granted globally |
| Effective roles | if Bea has roles in nordbau, they replace her global client roles. Realm roles always apply |
| Data in CDMS | model roles decide which models she sees at all; attribute filters and the owner filter cut the rows down |
-
CIASResolve the tenantIs Bea in several organizations? Then the client has to select one↳ no 403
cias.authentication.tenant-unresolved -
CIASTenant gateIs
nordbauserved?↳ no 403cias.authentication.tenant-not-served -
CIASEffective rolesRoles in
nordbaureplace the global ones -
CDMSModel roleDoes one of her effective roles allow this model?↳ no 403
-
CDMSRow filterattribute filter, owner filter, tenant isolation
- Bea sees nordbau's data, as far as her roles reach
More on that: Effective roles, Initial roles as a rule set, The three levels at a glance.
If Anna wants to give Bea more than the initial roles, she grants a role through POST /cias/admin/role-assignments. That works only if the role is a tenant role, is delegated to a role Anna holds, is granted in her own tenant, and Anna holds it herself. See Grant a role.
When the invitation does not work
roles from required-caller-roles | tenant in the caller's token | token of the invitation | What happens |
|---|---|---|---|
| missing | – | – | 403 cias.registration.not-authorized |
| present | missing | – | 403 cias.registration.not-authorized – without a tenant it is unclear where the invitation leads |
| present | present | unknown or expired | 404 cias.registration.not-found – both cases look the same |
| present | present | already redeemed | 202, as the first time. A second click must not produce an error |
| present | present | valid | Bea becomes a member |