From 960d399c7dc8256b75a77c28e3a433dbb060974e Mon Sep 17 00:00:00 2001 From: EdwardAngert <2408959-EdwardAngert@users.noreply.gitlab.com> Date: Wed, 27 Nov 2024 16:58:01 +0000 Subject: [PATCH 1/7] add cli steps for org sync --- docs/admin/users/idp-sync.md | 63 +++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/docs/admin/users/idp-sync.md b/docs/admin/users/idp-sync.md index 123384c963ce7..921d66a7766d3 100644 --- a/docs/admin/users/idp-sync.md +++ b/docs/admin/users/idp-sync.md @@ -304,13 +304,66 @@ Visit the Coder UI to confirm these changes: ## Organization Sync (Premium) -> Note: In a future Coder release, this can be managed via the Coder UI instead -> of server flags. - If your OpenID Connect provider supports groups/role claims, you can configure Coder to synchronize claims in your auth provider to organizations within Coder. -First, confirm that your OIDC provider is sending clainms by logging in with +Viewing and editing the organization settings requires deployment admin permissions (UserAdmin or Owner). + +Organization sync works across all organizations. On user login, the sync will add and remove the user from organizations based on their IdP claims. After the sync, the user's state should match that of the IdP. + +You can initiate an organization sync through the CLI or through the Coder dashboard: + +
+ +You must have a Premium license with Organizations enabled to use this. +[Contact your account team](https://coder.com/contact) for more details. + +For deployments with multiple [organizations](./organizations.md), you must configure group sync at the organization level. In future Coder versions, you will be able to configure this in the UI. For now, you must use CLI commands. -First confirm you have the [Coder CLI](../../install/index.md) installed and are -logged in with a user who is an Owner or Organization Admin role. Next, confirm -that your OIDC provider is sending a groups claim by logging in with OIDC and -visiting the following URL: +1. Confirm you have the [Coder CLI](../../install/index.md) installed and are + logged in with a user who is an Owner or Organization Admin role. -```text -https://[coder.example.com]/api/v2/debug/[your-username]/debug-link -``` +1. Confirm that your OIDC provider is sending a groups claim. -You should see a field in either `id_token_claims`, `user_info_claims` or both -followed by a list of the user's OIDC groups in the response. This is the -[claim](https://openid.net/specs/openid-connect-core-1_0.html#Claims) sent by -the OIDC provider. See -[Troubleshooting](#troubleshooting-grouproleorganization-sync) to debug this. + Log in with OIDC and visit the following URL: -> Depending on the OIDC provider, this claim may be named differently. Common -> ones include `groups`, `memberOf`, and `roles`. + ```text + https://[coder.example.com]/api/v2/debug/[your-username]/debug-link + ``` -To fetch the current group sync settings for an organization, run the following: + You should see a field in either `id_token_claims`, `user_info_claims` or + both followed by a list of the user's OIDC groups in the response. This is + the [claim](https://openid.net/specs/openid-connect-core-1_0.html#Claims) + sent by the OIDC provider. -```sh -coder organizations settings show group-sync \ - --org
+ +You much specify Coder group IDs instead of group names. The fastest way to find +the ID for a corresponding group is by visiting +`https://coder.example.com/api/v2/groups`. + +Here is another example which maps `coder-admins` from the identity provider to -2 groups in Coder and `coder-users` from the identity provider to another group: +two groups in Coder and `coder-users` from the identity provider to another +group: ```json { @@ -182,7 +203,7 @@ You can limit which groups from your identity provider can log in to Coder with [CODER_OIDC_ALLOWED_GROUPS](https://coder.com/docs/cli/server#--oidc-allowed-groups). Users who are not in a matching group will see the following error: - +
+ +You must have a Premium license with Organizations enabled to use this. +[Contact your account team](https://coder.com/contact) for more details. + ++
+ +Be sure to use the `name` field for each role, not the display name. Use +`coder organization roles show --org=To set these role sync settings, use the following command: @@ -424,18 +459,21 @@ Some common issues when enabling group/role sync. ### General guidelines -If you are running into issues with group/role sync, is best to view your Coder -server logs and enable -[verbose mode](../../reference/cli/index.md#-v---verbose). To reduce noise, you -can filter for only logs related to group/role sync: +If you are running into issues with group/role sync: -```sh -CODER_VERBOSE=true -CODER_LOG_FILTER=".*userauth.*|.*groups returned.*" -``` +1. View your Coder server logs and enable + [verbose mode](../../reference/cli/index.md#-v---verbose). -Be sure to restart the server after changing these configuration values. Then, -attempt to log in, preferably with a user who has the `Owner` role. +1. To reduce noise, you can filter for only logs related to group/role sync: + + ```sh + CODER_VERBOSE=true + CODER_LOG_FILTER=".*userauth.*|.*groups returned.*" + ``` + +1. Restart the server after changing these configuration values. + +1. Attempt to log in, preferably with a user who has the `Owner` role. The logs for a successful group sync look like this (human-readable): @@ -459,9 +497,11 @@ https://[coder.example.com]/api/v2/debug/[username]/debug-link ### User not being assigned / Group does not exist If you want Coder to create groups that do not exist, you can set the following -environment variable. If you enable this, your OIDC provider might be sending -over many unnecessary groups. Use filtering options on the OIDC provider to -limit the groups sent over to prevent creating excess groups. +environment variable. + +If you enable this, your OIDC provider might be sending over many unnecessary +groups. Use filtering options on the OIDC provider to limit the groups sent over +to prevent creating excess groups. ```env # as an environment variable From b336e3bc95422f44ce4aaed69a1b07d6c8305de0 Mon Sep 17 00:00:00 2001 From: Edward Angert` to see roles for your +organization. + +
4%kq(jW?(PQZhP~<9#0EFD;k)ph=lPuHoIl|GKzLMsDgSB)MN)KlP%MTR6GHYY75eR@KV7L-Gx*iq@!alcd
zLAY+8^n7*cSP_RBiOXAEgqBQo{}1N(%SL-(;uM)cgOcdnE@ssKOkVjrwkWK~ln?y6nONWJSL>D8Hi6`DoqoGdnKHE~svk-=zP
VDT5Gn1ith9#@^yNART(~#k
z!k+8zh&b5*vxTJ~=8|>+WLPKSqQdXvX!rbg$M;(RZv1d{R5Aw^}f`cWG?Ayu2*m
z6ocA1eSJfbNj-FZwdCtSbKZ4MJmN`(c1x8FES|)c8W3+jAzxZ}B`i6(s`v0=pTm)Hm&?bc
z+K+R-nG;58lvm5waH!e`6`}4VO%9p*g1>P7q^3uRidq11q_J7TX)FH-KTeFIp-;$`
zKeC!M70X&?BAd?wky&JMIQbyUIm2{i+GC-vaLght3#1gr6q(vd1=$^t2J4F%6@=vi
zBg^8H+w_r+GU%?NSE+XqI_Z{Trjp7_Gp46yT^3AYeSl
zyM_Vv{3g@yuH6xez9L05