You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 23909aa
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: keycloak/README.md
+68Lines changed: 68 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,73 @@ The realm includes:
24
24
- Test user: `test` / `test`
25
25
- Realm name: `tasks`
26
26
27
+
## Organization Configuration
28
+
29
+
The application uses an organization claim to associate users with organizations. This claim is included in access tokens and is used to determine which locations a user can access.
30
+
31
+
### Setting Up Organization Client Scope
32
+
33
+
The organization client scope should already be configured in the imported realm. To verify or configure it manually:
34
+
35
+
1. Navigate to **Client scopes** in the left sidebar
36
+
2. Find the **organization** client scope
37
+
3. Verify it has the following settings:
38
+
-**Name**: `organization`
39
+
-**Description**: "Additional claims about the organization a subject belongs to"
40
+
-**Include in token scope**: Enabled
41
+
-**Display on consent screen**: Enabled
42
+
43
+
4. Under **Mappers**, verify there is a mapper named **organization** with:
44
+
-**Mapper Type**: User Attribute
45
+
-**User Attribute**: `organization`
46
+
-**Token Claim Name**: `organization`
47
+
-**Claim JSON Type**: String
48
+
-**Multivalued**: Enabled
49
+
-**Add to access token**: Enabled
50
+
-**Add to ID token**: Enabled
51
+
-**Add to userinfo**: Enabled
52
+
53
+
### Adding Organization Scope to Clients
54
+
55
+
The organization scope should be included in the default client scopes for `tasks-backend`. To verify or configure:
56
+
57
+
1. Navigate to **Clients** in the left sidebar
58
+
2. Select the **tasks-backend** client
59
+
3. Go to the **Client scopes** tab
60
+
4. Under **Default Client Scopes**, verify that **organization** is listed
61
+
5. If not present, move it from **Optional Client Scopes** to **Default Client Scopes**
62
+
63
+
### Adding Users to Organizations
64
+
65
+
To assign a user to one or more organizations:
66
+
67
+
1. Navigate to **Users** in the left sidebar
68
+
2. Select the user you want to configure (or create a new user)
69
+
3. Go to the **Attributes** tab
70
+
4. Click **Add** to add a new attribute
71
+
5. Set the **Key** to: `organization`
72
+
6. Set the **Value** to a comma-separated list of organization IDs (e.g., `test-org-1,test-org-2`)
73
+
7. Click **Save**
74
+
75
+
**Note**: The organization attribute is multivalued, so you can add multiple values. Each value should be a single organization ID. For multiple organizations, add them as separate attribute entries or use a comma-separated string.
76
+
77
+
### Verifying Organization Claim in Tokens
78
+
79
+
To verify that the organization claim is being included in tokens:
80
+
81
+
1. Navigate to **Clients** → **tasks-backend** → **Client scopes** tab
82
+
2. Ensure **organization** is in the **Default Client Scopes** list
83
+
3. When a user authenticates, the access token should include an `organization` claim with the values from the user's `organization` attribute
84
+
85
+
### Realm-Level Default Client Scopes
86
+
87
+
To ensure the organization scope is available by default for all clients:
88
+
89
+
1. Navigate to **Client scopes** in the left sidebar
90
+
2. Click on the **Default** tab at the top
91
+
3. Verify that **organization** is listed in the **Default Default Client Scopes**
92
+
4. If not, you can move it from **Optional** to **Default** using the arrow buttons
93
+
27
94
## Production
28
95
29
96
For production deployments, you should:
@@ -32,3 +99,4 @@ For production deployments, you should:
32
99
3. Set up proper redirect URIs
33
100
4. Configure SSL/TLS
34
101
5. Review and adjust security settings
102
+
6. Ensure organization attributes are properly configured for all users
0 commit comments