Access: Roles, Groups, And Tenants
Who may do what on the Klok platform is decided in one place: Keycloak, the platform's login service (KlokAuth,
realm klok on auth.ipaas.se). klok.dev has no users, passwords or roles of its own. You sign in through Keycloak, and
what you may see and do follows the Keycloak groups you are a member of.
The Roles
Each scope, the platform, a tenant and a domain, has three roles: an owner, admins and developers.
| Role | What it lets you do |
|---|---|
| Klok Framework Owner | The platform's main contact; everything a Klok Framework Admin may do |
| Klok Framework Admin | Everything, in every tenant: create tenants, run platform administration (such as Ensure missing), manage documentation projects |
| Klok Framework Developer | Work in every tenant, as platform staff |
| Tenant Owner | The tenant's main contact; everything a Tenant Admin may do, and appointing the owners of its domains |
| Tenant Admin | Run one tenant: create domains, see and work on everything in the tenant, write its integration context, change its documentation settings, decide who reads its documentation |
| Tenant Developer | Work on everything in one tenant: read all its domains, start pipelines, write ODL data and tasks |
| Domain Owner | The domain's main contact; everything a Domain Admin may do |
| Domain Admin | Run one domain: create and administer its projects, write the integration context for that domain, decide who reads its documentation |
| Domain Developer | Work in one domain: see its data models and integration projects, and start their pipelines |
In klok.dev's code and logs the roles are called KlokOwner, KlokAdmin, KlokDeveloper, TenantOwner,
TenantAdmin, TenantDeveloper, DomainOwner, DomainAdmin and DomainDeveloper.
Domain roles also see the tenant's shared domains, common and public. Tenant roles see all domains of the tenant.
Who reads which documentation on docs.klok.dev is described in Who Can Read
Documentation: every member of a tenant reads all of its documentation unless its
owners narrow it.
Owners
An owner is the main contact of a tenant or a domain: the person to ask about it, and the one klok.dev tells when something needs a decision. A tenant or a domain has one or more owners. An owner is always also an admin of the same scope, so an owner may do everything an admin may.
| Owner of | Appointed by | Where it is recorded |
|---|---|---|
| The platform | the platform | the Keycloak group /klok/owners |
| A tenant | a Klok Framework Admin | owners: next to admins: in tenants.yml of klok-environment-setup, every owner also listed as admin, applied by Ansible |
| A domain | the tenant's owners and admins | klok.dev, Tenant → People; making someone a domain owner makes them a domain admin too |
What owners get:
- They are named as the contact on klok.dev: on Tenant → Domains, on Tenant → People, and on a project's page (the domain's owners, else the tenant's).
- A mailbox in Secure Mail,
<tenant>/ownersor<tenant>/<domain>/owners, where klok.dev writes what needs them: a request for access (from klok.dev's Ask for access, which docs.klok.dev links to), a change to the people of their tenant or domain made by someone else, another tenant's or domain's request to read their topics, a change to who reads their documentation, and what Ensure finds that a person must fix. Each comes with the e-mail notice Secure Mail sends, which carries no content, at most once an hour per mailbox. - A tenant or domain without an owner sends these to its admins' mailbox instead, and Ensure reports the missing owner.
Groups Give You Roles
Each role is a group in Keycloak. The group's path names the role and its scope:
| Keycloak group | Role |
|---|---|
/klok/owners |
Klok Framework Owner |
/klok/admins |
Klok Framework Admin |
/klok/developers |
Klok Framework Developer |
/tenants/<tenant>/owners |
Tenant Owner of <tenant> |
/tenants/<tenant>/admins |
Tenant Admin in <tenant> |
/tenants/<tenant>/developers |
Tenant Developer in <tenant> |
/tenants/<tenant>/domains/<domain>/owners |
Domain Owner of <domain> in <tenant> |
/tenants/<tenant>/domains/<domain>/admins |
Domain Admin for <domain> in <tenant> |
/tenants/<tenant>/domains/<domain>/developers |
Domain Developer for <domain> in <tenant> |
A person can be in as many groups as needed, for example /tenants/acme/admins and
/tenants/other/domains/finance/developers. Roles add up; no group takes a right away. An owner is in the owners group
and the admins group of the same scope; a person only in an owners group still counts as an admin there.
Your Tenant
Most pages in klok.dev work inside one tenant, your working tenant, shown in the header next to Ask Kloker:
- If your groups give you roles in several tenants, the header's tenant button switches between them. klok.dev checks your choice against your groups on every request and remembers it in your browser, so it is still there tomorrow. It never adds a tenant: a tenant you have no group in cannot be chosen, and one whose group you lose drops out within one access-token lifetime.
- Until you choose, it is the tenant your login's
tenantclaim names, when the claim names one of the tenants your groups give you (a claim naming a tenant you have no group in is ignored). Otherwise it is your only tenant, or the first of your tenants by name. - With no tenant group at all you belong to no tenant. Tenant pages then answer not a member of any tenant. klok.dev has no default tenant.
Klok Framework Owners, Admins and Developers can choose any tenant in the header's tenant button.
When Changes Take Effect
A change in Keycloak reaches klok.dev within one access-token lifetime, normally about five minutes. Sign out and in again to see it at once. Someone who is disabled in Keycloak, or whose Keycloak session ends, is signed out of klok.dev within that same time, at the first click after their access token has expired.
Giving Someone Access
- Tenant owners and admins are set in Git by the platform:
owners:andadmins:intenants.ymlof klok-environment-setup, merged and applied with Ansible. A tenant admin's power is the largest a customer tenant has, so it is reviewed and recorded. - Everyone else is given access on klok.dev, Tenant → People (Tenant): the tenant's owners and admins give any other role, domain owners included; a domain's admins give developer access to their own domains. Add person finds or creates the person's account and gives their roles, and Change gives and takes them. Every change goes straight to Keycloak, and the person's GitLab memberships follow from the roles.
A Klok Framework role is given by hand in the Keycloak admin console, and a Keycloak administrator can give every other role the same way when klok.dev is not at hand:
- Open the realm
klokand go to Users, then the person, then Groups. - Choose Join group, and pick the group from the table above. For an owner, join both the owners group and the admins group of the scope.
- The person signs out of klok.dev and in again. Tenant → People sets the person's GitLab memberships at the next change or Sync GitLab.
Do not use Role mapping for this. Older realm roles such as klok-admin and klok-tenant-admin still count in
klok.dev, but they are being phased out. Move people from them to the matching group, then remove the role.
You never create the groups yourself. klok.dev makes a tenant's groups when the tenant is created, and a domain's groups when the domain is created. A tenant or domain that was made directly in GitLab gets its groups the next time a Klok Framework Admin runs Ensure missing.
A domain cannot be deleted while anyone is still in its groups. klok.dev names the people who would lose access, so taking access away is always something someone does on purpose.
Checking What Someone Gets
In the Keycloak admin console, go to Clients, then klok-frontend-v2, then Client scopes, then Evaluate.
Pick the person and open Generated access token. It must contain the person's groups with their full path, for
example:
"groups": ["/klok/admins", "/tenants/acme/domains/finance/developers"]
If groups is missing, the client lacks its group mapper. That mapper is part of Keycloak's configuration, which is
kept in Git (Keycloak clients in the klok-environment-setup documentation).
Not People
Integration projects, pipelines and agents do not sign in as people and are not in these groups. Each has its own identity with exactly the rights it was configured with. How that works is described in the Klok framework development guide, chapter Identity and access.