@@ -8,7 +8,12 @@ IdP sync is an Enterprise and Premium feature.
8
8
9
9
</blockquote >
10
10
11
- ## Confirm that OIDC provider sends claims
11
+ IdP (Identity provider) sync allows you to use OpenID Connect (OIDC) to
12
+ synchronize Coder groups, roles, and organizations based on claims from your IdP.
13
+
14
+ ## Prerequisites
15
+
16
+ ### Confirm that OIDC provider sends claims
12
17
13
18
To confirm that your OIDC provider is sending claims, log in with OIDC and visit
14
19
the following URL with an ` Owner ` account:
@@ -23,7 +28,7 @@ both followed by a list of the user's OIDC groups in the response.
23
28
This is the [ claim] ( https://openid.net/specs/openid-connect-core-1_0.html#Claims )
24
29
sent by the OIDC provider.
25
30
26
- Depending on the OIDC provider, this claim may be called something else.
31
+ Depending on the OIDC provider, this claim might be called something else.
27
32
Common names include ` groups ` , ` memberOf ` , and ` roles ` .
28
33
29
34
See the [ troubleshooting section] ( #troubleshooting-grouproleorganization-sync )
@@ -42,77 +47,36 @@ If group sync is enabled, the user's groups will be controlled by the OIDC
42
47
provider. This means manual group additions/removals will be overwritten on the
43
48
next user login.
44
49
45
- There are two ways you can configure group sync:
50
+ For deployments with multiple [ organizations] ( ./organizations.md ) , configure
51
+ group sync at the organization level.
46
52
47
53
<div class =" tabs " >
48
54
49
- ### Server Flags
50
-
51
- <blockquote class =" admonition note " >
52
-
53
- This method is deprecated.
54
-
55
- You can use the dashboard to configure group sync instead.
56
-
57
- </blockquote >
58
-
59
- 1 . Configure the Coder server to read groups from the claim name with the
60
- [ OIDC group field] ( ../../reference/cli/server.md#--oidc-group-field ) server
61
- flag:
62
-
63
- - Environment variable:
64
-
65
- ``` sh
66
- CODER_OIDC_GROUP_FIELD=groups
67
- ```
68
-
69
- - As a flag:
70
-
71
- ` ` ` sh
72
- --oidc-group-field groups
73
- ` ` `
74
-
75
- On login, users will automatically be assigned to groups that have matching
76
- names in Coder and removed from groups that the user no longer belongs to.
77
-
78
- For cases when an OIDC provider only returns group IDs or you want to have
79
- different group names in Coder than in your OIDC provider, you can configure
80
- mapping between the two with the
81
- [OIDC group mapping](../../reference/cli/server.md#--oidc-group-mapping) server
82
- flag:
55
+ ### Dashboard
83
56
84
- - Environment variable :
57
+ 1 . Fetch the corresponding group IDs using the following endpoint :
85
58
86
- ` ` ` sh
87
- CODER_OIDC_GROUP_MAPPING= ' {"myOIDCGroupID": "myCoderGroupName"} '
88
- ` ` `
59
+ ``` text
60
+ https://[coder.example.com]/api/v2/groups
61
+ ```
89
62
90
- - As a flag:
63
+ 1 . As an Owner or Organization Admin, go to ** Admin settings** , select
64
+ ** Organizations** , then ** IdP Sync** :
91
65
92
- ` ` ` sh
93
- --oidc-group-mapping ' {"myOIDCGroupID": "myCoderGroupName"}'
94
- ` ` `
66
+ ![ IdP Sync - Group sync settings] ( ../../images/admin/users/organizations/group-sync-empty.png )
95
67
96
- Below is an example mapping in the Coder Helm chart:
68
+ 1 . Enter the ** Group sync field** and an optional ** Regex filter** , then select
69
+ ** Save** .
97
70
98
- ` ` ` yaml
99
- coder:
100
- env:
101
- - name: CODER_OIDC_GROUP_MAPPING
102
- value: >
103
- {" myOIDCGroupID" : " myCoderGroupName" }
104
- ` ` `
71
+ 1 . Select ** Auto create missing groups** to automatically create groups
72
+ returned by the OIDC provider if they do not exist in Coder.
105
73
106
- From the example above, users that belong to the ` myOIDCGroupID` group in your
107
- OIDC provider will be added to the ` myCoderGroupName` group in Coder.
74
+ 1 . Enter the ** IdP group name** and ** Coder group** , then ** Add IdP group** .
108
75
109
- # ## Runtime (Organizations)
110
-
111
- For deployments with multiple [organizations](./organizations.md), you must
112
- configure group sync at the organization level.
76
+ ### CLI
113
77
114
78
1 . Confirm you have the [ Coder CLI] ( ../../install/index.md ) installed and are
115
- logged in with a user who is an Owner or Organization Admin role.
79
+ logged in with a user who is an Owner or has an Organization Admin role.
116
80
117
81
1 . To fetch the current group sync settings for an organization, run the
118
82
following:
@@ -148,7 +112,7 @@ Below is an example that uses the `groups` claim and maps all groups prefixed by
148
112
149
113
<blockquote class =" admonition note " >
150
114
151
- You much specify Coder group IDs instead of group names. The fastest way to find
115
+ You must specify Coder group IDs instead of group names. The fastest way to find
152
116
the ID for a corresponding group is by visiting
153
117
` https://coder.example.com/api/v2/groups ` .
154
118
@@ -185,6 +149,66 @@ Visit the Coder UI to confirm these changes:
185
149
186
150
![ IdP Sync] ( ../../images/admin/users/organizations/group-sync.png )
187
151
152
+ ### Server Flags
153
+
154
+ <blockquote class =" admonition note " >
155
+
156
+ Use server flags only with Coder deployments with a single organization.
157
+
158
+ You can use the dashboard to configure group sync instead.
159
+
160
+ </blockquote >
161
+
162
+ 1 . Configure the Coder server to read groups from the claim name with the
163
+ [ OIDC group field] ( ../../reference/cli/server.md#--oidc-group-field ) server
164
+ flag:
165
+
166
+ - Environment variable:
167
+
168
+ ``` sh
169
+ CODER_OIDC_GROUP_FIELD=groups
170
+ ```
171
+
172
+ - As a flag:
173
+
174
+ ` ` ` sh
175
+ --oidc-group-field groups
176
+ ` ` `
177
+
178
+ 1. On login, users will automatically be assigned to groups that have matching
179
+ names in Coder and removed from groups that the user no longer belongs to.
180
+
181
+ 1. For cases when an OIDC provider only returns group IDs or you want to have
182
+ different group names in Coder than in your OIDC provider, you can configure
183
+ mapping between the two with the
184
+ [OIDC group mapping](../../reference/cli/server.md#--oidc-group-mapping) server
185
+ flag:
186
+
187
+ - Environment variable:
188
+
189
+ ` ` ` sh
190
+ CODER_OIDC_GROUP_MAPPING=' {"myOIDCGroupID": "myCoderGroupName"}'
191
+ ` ` `
192
+
193
+ - As a flag:
194
+
195
+ ` ` ` sh
196
+ --oidc-group-mapping ' {"myOIDCGroupID": "myCoderGroupName"}'
197
+ ` ` `
198
+
199
+ Below is an example mapping in the Coder Helm chart:
200
+
201
+ ` ` ` yaml
202
+ coder:
203
+ env:
204
+ - name: CODER_OIDC_GROUP_MAPPING
205
+ value: >
206
+ {" myOIDCGroupID" : " myCoderGroupName" }
207
+ ` ` `
208
+
209
+ From this example, users that belong to the ` myOIDCGroupID` group in your
210
+ OIDC provider will be added to the ` myCoderGroupName` group in Coder.
211
+
188
212
< /div>
189
213
190
214
# ## Group allowlist
@@ -200,40 +224,33 @@ Users who are not in a matching group will see the following error:
200
224
If your OpenID Connect provider supports roles claims, you can configure Coder
201
225
to synchronize roles in your auth provider to roles within Coder.
202
226
203
- < div class=" tabs" >
227
+ For deployments with multiple [organizations](./organizations.md), configure
228
+ role sync at the organization level.
204
229
205
- # ## Server Flags
230
+ < div class= " tabs " >
206
231
207
- < blockquote class= " admonition note " >
232
+ # ## Dashboard
208
233
209
- This method is deprecated.
234
+ 1. As an Owner or Organization Admin, go to ** Admin settings** , select
235
+ ** Organizations** , then ** IdP Sync** .
210
236
211
- You can use the dashboard to configure role sync instead.
237
+ 1. Select the ** Role sync settings ** tab:
212
238
213
- < /blockquote >
239
+ ! [IdP Sync - Role sync settings](../../images/admin/users/organizations/role-sync-empty.png)
214
240
215
- 1. Configure the Coder server to read groups from the claim name with the
216
- [OIDC role field](../../reference/cli/server.md#--oidc-user-role-field)
217
- server flag:
241
+ 1. Enter the ** Role sync field** , then select **Save**.
218
242
219
- 1. Set the following in your Coder server [configuration](../setup/index.md) .
243
+ 1. Enter the ** IdP role name ** and ** Coder role ** , then ** Add IdP role ** .
220
244
221
- ` ` ` env
222
- # Depending on your identity provider configuration, you may need to explicitly request a "roles" scope
223
- CODER_OIDC_SCOPES=openid,profile,email,roles
245
+ To add a new custom role, select **Roles** from the sidebar, then
246
+ ** Create custom role** .
224
247
225
- # The following fields are required for role sync:
226
- CODER_OIDC_USER_ROLE_FIELD=roles
227
- CODER_OIDC_USER_ROLE_MAPPING=' {"TemplateAuthor":["template-admin","user-admin"]}'
228
- ` ` `
248
+ Visit the [groups and roles documentation](./groups-roles.md) for more information.
229
249
230
- One role from your identity provider can be mapped to many roles in Coder. The
231
- example above maps to two roles in Coder.
232
-
233
- # ## Runtime (Organizations)
250
+ # ## CLI
234
251
235
- For deployments with multiple [organizations ](./organizations. md), you can
236
- configure role sync at the organization level .
252
+ 1. Confirm you have the [Coder CLI ](../../install/index. md) installed and are
253
+ logged in with a user who is an Owner or has an Organization Admin role .
237
254
238
255
1. To fetch the current group sync settings for an organization, run the
239
256
following:
@@ -270,7 +287,7 @@ role:
270
287
< blockquote class=" admonition note" >
271
288
272
289
Be sure to use the ` name` field for each role, not the display name. Use
273
- ` coder organization roles show --org=< your-org> ` to see roles for your
290
+ ` coder organization roles show --org=< your-org> ` to see roles for your
274
291
organization.
275
292
276
293
< /blockquote>
@@ -287,6 +304,34 @@ Visit the Coder UI to confirm these changes:
287
304
288
305
! [IdP Sync](../../images/admin/users/organizations/role-sync.png)
289
306
307
+ # ## Server Flags
308
+
309
+ < blockquote class=" admonition note" >
310
+
311
+ Use server flags only with Coder deployments with a single organization.
312
+
313
+ You can use the dashboard to configure role sync instead.
314
+
315
+ < /blockquote>
316
+
317
+ 1. Configure the Coder server to read groups from the claim name with the
318
+ [OIDC role field](../../reference/cli/server.md#--oidc-user-role-field)
319
+ server flag:
320
+
321
+ 1. Set the following in your Coder server [configuration](../setup/index.md).
322
+
323
+ ` ` ` env
324
+ # Depending on your identity provider configuration, you may need to explicitly request a "roles" scope
325
+ CODER_OIDC_SCOPES=openid,profile,email,roles
326
+
327
+ # The following fields are required for role sync:
328
+ CODER_OIDC_USER_ROLE_FIELD=roles
329
+ CODER_OIDC_USER_ROLE_MAPPING=' {"TemplateAuthor":["template-admin","user-admin"]}'
330
+ ` ` `
331
+
332
+ One role from your identity provider can be mapped to many roles in Coder. The
333
+ example above maps to two roles in Coder.
334
+
290
335
< /div>
291
336
292
337
# # Organization Sync
@@ -301,8 +346,7 @@ Organization sync works across all organizations. On user login, the sync will
301
346
add and remove the user from organizations based on their IdP claims. After the
302
347
sync, the user' s state should match that of the IdP.
303
348
304
- You can initiate an organization sync through the CLI or through the Coder
305
- dashboard:
349
+ You can initiate an organization sync through the Coder dashboard or CLI:
306
350
307
351
<div class="tabs">
308
352
0 commit comments