diff --git a/docs/admin/users/idp-sync.md b/docs/admin/users/idp-sync.md index 123384c963ce7..f9547cb85af6e 100644 --- a/docs/admin/users/idp-sync.md +++ b/docs/admin/users/idp-sync.md @@ -17,35 +17,40 @@ There are two ways you can configure group sync: ## Server Flags -First, confirm that your OIDC provider is sending claims by logging in with OIDC -and visiting the following URL with an `Owner` account: +1. Confirm that your OIDC provider is sending claims. -```text -https://[coder.example.com]/api/v2/debug/[your-username]/debug-link -``` + Log in with OIDC and visit the following URL with an `Owner` account: -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. + ```text + https://[coder.example.com]/api/v2/debug/[your-username]/debug-link + ``` -> Depending on the OIDC provider, this claim may be named differently. Common -> ones include `groups`, `memberOf`, and `roles`. + 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. -Next configure the Coder server to read groups from the claim name with the -[OIDC group field](../../reference/cli/server.md#--oidc-group-field) server -flag: + See [Troubleshooting](#troubleshooting-grouproleorganization-sync) to debug + this. -```sh -# as an environment variable -CODER_OIDC_GROUP_FIELD=groups -``` + Depending on the OIDC provider, this claim may be called something else. + Common names include `groups`, `memberOf`, and `roles`. -```sh -# as a flag ---oidc-group-field groups -``` +1. Configure the Coder server to read groups from the claim name with the + [OIDC group field](../../reference/cli/server.md#--oidc-group-field) server + flag: + + - Environment variable: + + ```sh + CODER_OIDC_GROUP_FIELD=groups + ``` + + - As a flag: + + ```sh + --oidc-group-field groups + ``` On login, users will automatically be assigned to groups that have matching names in Coder and removed from groups that the user no longer belongs to. @@ -54,17 +59,19 @@ For cases when an OIDC provider only returns group IDs ([Azure AD][azure-gids]) or you want to have different group names in Coder than in your OIDC provider, you can configure mapping between the two with the [OIDC group mapping](../../reference/cli/server.md#--oidc-group-mapping) server -flag. +flag: -```sh -# as an environment variable -CODER_OIDC_GROUP_MAPPING='{"myOIDCGroupID": "myCoderGroupName"}' -``` +- Environment variable: -```sh -# as a flag ---oidc-group-mapping '{"myOIDCGroupID": "myCoderGroupName"}' -``` + ```sh + CODER_OIDC_GROUP_MAPPING='{"myOIDCGroupID": "myCoderGroupName"}' + ``` + +- As a flag: + + ```sh + --oidc-group-mapping '{"myOIDCGroupID": "myCoderGroupName"}' + ``` Below is an example mapping in the Coder Helm chart: @@ -84,49 +91,58 @@ OIDC provider will be added to the `myCoderGroupName` group in Coder. ## Runtime (Organizations) -> Note: You must have a Premium license with Organizations enabled to use this. -> [Contact your account team](https://coder.com/contact) for more details +
+ +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: @@ -304,58 +339,110 @@ 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 -OIDC and visiting the following URL with an `Owner` account: +Viewing and editing the organization settings requires deployment admin +permissions (UserAdmin or Owner). -```text -https://[coder.example.com]/api/v2/debug/[your-username]/debug-link -``` +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 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. +You can initiate an organization sync through the CLI or through the Coder +dashboard: -> Depending on the OIDC provider, this claim may be named differently. Common -> ones include `groups`, `memberOf`, and `roles`. +` to see roles for your +organization. + +