Add Users and Claims in Keycloak
Give colleagues their own sign-in to the Nodinite Docker sandbox, and decide what each of them sees. The sandbox signs users in through Keycloak, an OAuth 2.0 and OpenID Connect identity provider, so access works with Claims, Policies, and Roles instead of Windows accounts. This is the same model as any Nodinite installation in OAuth 2.0 mode (Install Nodinite v7 - OpenID), which makes the sandbox a good place to learn it.
- ✅ Add users in the Keycloak admin console, with their own password
- ✅ Give a user a value in the token, as a user attribute or a realm role
- ✅ Match that value with a Nodinite Claim, group Claims in a Policy, and grant Roles

Animated walkthrough: a new Keycloak user with a password and a realm role, which reaches the token as roles. Steps 1 and 2 below.
Understanding How a Keycloak User Gets Access
Nodinite never stores sandbox users. At sign-in, Keycloak issues an access token with claims about the user, and the Web API matches those claims with the Claims of every Policy. A user who matches all Claims of a Policy gets that Policy's Roles, and the Roles decide what the user sees.
Diagram: a Keycloak user attribute or realm role becomes a claim in the access token; Nodinite matches it with a Claim, and the Policy that holds the Claim grants its Roles.
What Reaches the Token
The sandbox's Keycloak realm is called dev, and the Web Client signs in through its webclient client. That client puts these values in the token:
| In Keycloak | Claim in the token | Key of the Nodinite Claim | Example value |
|---|---|---|---|
User attribute Group |
Group |
Group |
Admin |
| Realm roles | roles |
http://schemas.microsoft.com/ws/2008/06/identity/claims/role |
nodinite-finance |
The Key of a roles claim is the long name, not roles: .NET renames the standard role claim before Nodinite compares, so a Claim with the Key roles never matches. See How the Key is matched.
The Sample Administrator
The sandbox ships with the user Administrator, whose attribute Group is Admin. The token therefore carries Group = Admin, the Claim that the sandbox's Policy for the Administrators Role requires. Give another user the same attribute, and that user is an administrator too.
Membership of the Keycloak group Admin is not the same thing. Keycloak writes group membership into the token as the group's full path, Group = /Admin, which doesn't match the Claim Group = Admin, so such a user gets no Role. Use the attribute.
Attribute or Realm Role?
| User attribute | Realm role | |
|---|---|---|
| Set on | Each user, as a key and a value | The realm, then assigned to users |
| Best for | Making a user an administrator, as Administrator is |
Groups of users with the same access, such as a team |
| Claim Key in Nodinite | Group |
http://schemas.microsoft.com/ws/2008/06/identity/claims/role |
| Rename later | Change it on every user | Change it once on the role |
Before You Start
- The sandbox is running; see Install the Docker Sandbox.
- You can sign in to the Web Client as
Administrator(passwordP1ngP0ng). - You know what the new user should see: which Roles to grant, or which Role to create with Add or manage Role.
Step 1: Add the User in Keycloak
Open the Keycloak admin console at
http://<environment name>.localhost:8080/admin, for examplehttp://demosandbox.localhost:8080/admin, with the Keycloak (sign-in) port you chose. Sign in with the Keycloak administrator: usernameadmin, passwordP1ngP0ng. This account manages Keycloak only; it is not a Nodinite user. The console's yellow banner, You are logged in as a temporary admin user, is expected in the sandbox.In the menu on the left, click Manage realms, then the realm dev. The master realm, marked Current realm at first, is Keycloak's own; Nodinite users never go there.

Open dev: it holds the Nodinite users and thewebclientclient.Open Users and click Add user. Enter the Username, and optionally the Email, First name, and Last name, then click Create.
Open the Credentials tab and click Set password. Enter the password twice, and switch Temporary off unless the user should choose a new password at the first sign-in. Click Save, then Save password in the Set password? dialog.

With Temporary off, the user signs in with this password, without a password change.
Important
Keycloak keeps what you change in its admin console, such as users and passwords, inside its container. When the container is recreated, for example by an update that brings a new Keycloak, Keycloak imports the shipped realm again and your changes are gone. Note the users you add, so you can add them again.
Step 2: Give the User a Value in the Token
Do one of these, depending on your choice in Attribute or Realm Role?.
Make the User an Administrator
On the user, open the Attributes tab.
Click Add attributes, enter the Key
Groupand the ValueAdmin, and click Save.
The attributeGroup=Adminis what makesAdministratoran administrator, too.
The user now matches the same Claim as Administrator. Skip to Step 4.
Give the User a Realm Role
- Open Realm roles, click Create role, enter a Role name such as
nodinite-finance, and save. Skip this when the role exists. - Open the user, then the Role mapping tab, and click Assign role.
- In the menu that opens, choose Realm roles, tick the role, and click Assign.
Step 3: Match the Value in Nodinite
Sign in to the Web Client as Administrator, and in Administration:
- Add the Claim: under Claims, add a Claim with the Key
http://schemas.microsoft.com/ws/2008/06/identity/claims/roleand the Valuenodinite-finance. See Add or manage Claim. - Add the Policy: under Policies, add a Policy, such as Contoso: Finance Users, that holds the Claim and grants the Role the user should have. See Add or manage Policy.
- Check the Role: its permission sets decide what the user sees: Log Views, Monitor Views, the Repository Model, and C4 Diagram Sets. A Role with Log Views but without the Log permission gives the user 403 Forbidden, Access level Log Views is required on Log. See Add or manage Role.

Animated walkthrough: the Claim and Policy in Nodinite, then the new user's view: exactly the Log Views of the Role.
Warning
Policies can lock everyone out. A Policy matches only when the token carries all its Claims, so a Claim that Keycloak never sends matches nobody, administrators included. A Policy with no Claims matches everyone. Never change the Policy that makes
Administratoran administrator, and keepAdministratorsigned in while you test. Details: What is a Policy?
Step 4: Sign In as the New User
- Open a private browser window, so you stay signed in as
Administratorin the other one. - Open the Web Client address, such as
http://demosandbox.localhost:8081, and sign in with the new user's username and password. - Check that the user sees what the Role grants, and nothing more.
Nodinite keeps each user's Policies and Roles for about 15 seconds, so a Claim or Policy change reaches a signed-in user quickly, without a new sign-in. A change in Keycloak, such as a new attribute or realm role, reaches Nodinite with the user's next token: sign out and in again.
The User Signs In but Sees Nothing
- The token doesn't carry the value: check the attribute key (
Group, case as shown) or the realm role assignment in Keycloak. Membership of the Keycloak group Admin gives/Admin, notAdmin. - The user sees Access level Log Views is required: the Role has Log Views, but not the Log permission.
- The Claim Key is
rolesinstead of the long role Key; see How the Key is matched. - The Policy holds a second Claim that the user doesn't match.