|
| 1 | +:_content-type: PROCEDURE |
| 2 | +[id="oidc-team-sync"] |
| 3 | += Team synchronization for {productname} OIDC deployments |
| 4 | + |
| 5 | +Administrators can leverage an OpenID Connect (OIDC) identity provider that supports group or team synchronization to apply repository permissions to sets of users in {productname}. This allows administrators to avoid having to manually create and sync group definitions between {productname} and the OIDC group. |
| 6 | + |
| 7 | +:_content-type: PROCEDURE |
| 8 | +[id="enabling-oidc-team-sync"] |
| 9 | +== Enabling synchronization for {productname} OIDC deployments |
| 10 | + |
| 11 | +Use the following procedure to enable team synchronization when you {productname} deployment uses an OIDC authenticator. |
| 12 | + |
| 13 | +[IMPORTANT] |
| 14 | +==== |
| 15 | +The following procedure does not use a specific OIDC provider. Instead, it provides a general outline of how best to approach team synchronization between an OIDC provider and {productname}. Any OIDC provider can be used to enable team synchronization, however, setup might vary depending on your provider. |
| 16 | +==== |
| 17 | + |
| 18 | +.Procedure |
| 19 | + |
| 20 | +. Update your `config.yaml` file with the following information: |
| 21 | ++ |
| 22 | +[source,yaml] |
| 23 | +---- |
| 24 | +AUTHENTICATION_TYPE: OIDC |
| 25 | +# ... |
| 26 | +OIDC_LOGIN_CONFIG: |
| 27 | + CLIENT_ID: <1> |
| 28 | + CLIENT_SECRET: <2> |
| 29 | + OIDC_SERVER: <3> |
| 30 | + SERVICE_NAME: <4> |
| 31 | + PREFERRED_GROUP_CLAIM_NAME: <5> |
| 32 | + LOGIN_SCOPES: [ 'openid', '<example_scope>' ] <6> |
| 33 | +# ... |
| 34 | +FEATURE_TEAM_SYNCING: true <7> |
| 35 | +FEATURE_NONSUPERUSER_TEAM_SYNCING_SETUP: true <8> |
| 36 | +FEATURE_V2_UI: true |
| 37 | +# ... |
| 38 | +---- |
| 39 | +<1> Required. The registered OIDC client ID for this {productname} instance. |
| 40 | +<2> Required. The registered OIDC client secret for this {productname} instance. |
| 41 | +<3> Required. The address of the OIDC server that is being used for authentication. This URL should be such that a `GET` request to `<OIDC_SERVER>/.well-known/openid-configuration` returns the provider's configuration information. This configuration information is essential for the relying party (RP) to interact securely with the OpenID Connect provider and obtain necessary details for authentication and authorization processes. |
| 42 | +<4> Required. The name of the service that is being authenticated. |
| 43 | +<5> Required. The key name within the OIDC token payload that holds information about the user's group memberships. This field allows the authentication system to extract group membership information from the OIDC token so that it can be used with {productname}. |
| 44 | +<6> Required. Adds additional scopes that {productname} uses to communicate with the OIDC provider. Must include `'openid'`. Additional scopes are optional. |
| 45 | +<7> Required. Whether to allow for team membership to be synced from a backing group in the authentication engine. |
| 46 | +<8> Optional. If enabled, non-superusers can setup team synchronization. |
| 47 | + |
| 48 | +. Restart your {productname} registry. |
| 49 | + |
| 50 | +[id="setting-up-quay-team-sync"] |
| 51 | +== Setting up your {productname} deployment for team synchronization |
| 52 | + |
| 53 | +. Log in to your {productname} registry via your OIDC provider. |
| 54 | + |
| 55 | +. On the {productname} v2 UI dashboard, click *Create Organization*. |
| 56 | + |
| 57 | +. Enter and Organization name, for example, `test-org`. |
| 58 | + |
| 59 | +. Click the name of the Organization. |
| 60 | + |
| 61 | +. In the navigation pane, click *Teams and membership*. |
| 62 | + |
| 63 | +. Click *Create new team* and enter a name, for example, `testteam`. |
| 64 | + |
| 65 | +. On the *Create team* pop-up: |
| 66 | + |
| 67 | +.. Optional. Add this team to a repository. |
| 68 | +.. Add a team member, for example, `user1`, by typing in the user's account name. |
| 69 | +.. Add a robot account to this team. This page provides the option to create a robot account. |
| 70 | + |
| 71 | +. Click *Next*. |
| 72 | + |
| 73 | +. On the *Review and Finish* page, review the information that you have provided and click *Review and Finish*. |
| 74 | + |
| 75 | +. To enable team synchronization for your {productname} OIDC deployment, click *Enable Directory Sync* on the *Teams and membership* page. Note the message in the popup: |
| 76 | ++ |
| 77 | +[WARNING] |
| 78 | +==== |
| 79 | +Please note that once team syncing is enabled, the membership of users who are already part of the team will be revoked. OIDC group will be the single source of truth. This is a non-reversible action. Team's user membership from within Quay will be ready-only. |
| 80 | +==== |
| 81 | + |
| 82 | +. In the popup box, enter the name of the group to sync membership with. Then, click *Enable Sync*. |
| 83 | + |
| 84 | +. You are returned to the *Teams and membership* page. Note that users of this team are removed and are re-added upon logging back in. At this stage, only the robot account is still part of the team. |
| 85 | ++ |
| 86 | +A banner at the top of the page confirms that the team is synced: |
| 87 | ++ |
| 88 | +[source,text] |
| 89 | +---- |
| 90 | +This team is synchronized with a group in OIDC and its user membership is therefore read-only. |
| 91 | +---- |
| 92 | ++ |
| 93 | +By clicking the *Directory Synchronization Config* accordion, the OIDC group that your deployment is synchronized with appears. |
| 94 | + |
| 95 | +. Log out of your {productname} registry and continue on to the verification steps. |
| 96 | + |
| 97 | +.Verification |
| 98 | + |
| 99 | +Use the following verification procedure to ensure that `user1` appears as a member of the team. |
| 100 | + |
| 101 | +. Log back in to your {productname} registry. |
| 102 | + |
| 103 | +. Click *Organizations* -> *test-org* -> *test-team* *Teams and memberships*. `user1` now appears as a team member for this team. |
| 104 | + |
| 105 | +.Verification |
| 106 | + |
| 107 | +Use the following procedure to remove `user1` from a group via your OIDC provider, and subsequently remove them from the team on {productname}. |
| 108 | + |
| 109 | +. Navigate to your OIDC provider's administration console. |
| 110 | + |
| 111 | +. Navigate to the *Users* page of your OIDC provider. The name of this page varies depending on your provider. |
| 112 | + |
| 113 | +. Click the name of the user associated with {productname}, for example, `user1`. |
| 114 | + |
| 115 | +. Remove the user from group in the configured identity provider. |
| 116 | + |
| 117 | +. Remove, or unassign, the access permissions from the user. |
| 118 | + |
| 119 | +. Log in to your {productname} registry. |
| 120 | + |
| 121 | +. Click *Organizations* -> *test-org* -> *test-team* *Teams and memberships*. `user1` has been removed from this team. |
| 122 | + |
| 123 | +//// |
| 124 | +[id="setting-up-keycloak-oidc-team-sync"] |
| 125 | +== Setting up Keycloak for OIDC team synchronization |
| 126 | +
|
| 127 | +Keycloak is an open source software product to allow single sign-on with identity and access management. It can be leveraged with {productname} as an extra layer of security for your deployment. |
| 128 | +
|
| 129 | +Use the following procedure to setup Keycloak for {productname} team synchronization. |
| 130 | +
|
| 131 | +.Procedure |
| 132 | +
|
| 133 | +. Log in to your Keycloak adminstration console. |
| 134 | +
|
| 135 | +. In the navigation pane, click the drop down menu, and then click *Create realm*. |
| 136 | +
|
| 137 | +. Provide a realm name, for example, `quayrealm`. |
| 138 | +
|
| 139 | +. Click *Clients* -> *Create client*. |
| 140 | +
|
| 141 | +. On the *General settings* page: |
| 142 | +
|
| 143 | +.. Set the Client type to *OpenID Connect*. |
| 144 | +.. Provide a Client ID, for example, `quaydev`. |
| 145 | +.. Optional. Provide a name for the client. |
| 146 | +.. Optional. Provide a description for the client. |
| 147 | +.. Optional. Specify whether the client is always listed in the Account UI. |
| 148 | +
|
| 149 | +. Click *Next*. |
| 150 | +
|
| 151 | +. On the *Capability config* page: |
| 152 | +
|
| 153 | +.. Ensure that *Client authentication* is on. |
| 154 | +.. Optional. Turn *Authorization* on. |
| 155 | +.. For *Authentication flow*, click *Standard flow* and *Direct access grants*. |
| 156 | +
|
| 157 | +. Click *Next*. |
| 158 | +
|
| 159 | +. On the *Login settings* page: |
| 160 | +
|
| 161 | +.. Optional. Provide a Root URL. |
| 162 | +.. Optional. Provide a Home URL. |
| 163 | +.. Optional. Provide Valid redirect URIs. |
| 164 | +.. Optional. Provide Valid post logout redirect URIs. |
| 165 | +.. Optional. Provide Web origins. |
| 166 | +
|
| 167 | +. Click *Save*. You are redirected to the *quaydev* *Settings* page. |
| 168 | +
|
| 169 | +. In the navigation pane, click *Realm roles* -> *Create role*. |
| 170 | +
|
| 171 | +. Enter a role name, for example, `test-team-sync`. Then, click *Save*. |
| 172 | +
|
| 173 | +. In the navigation pane, click *Groups* -> *Create a group*. |
| 174 | +
|
| 175 | +. Enter a name for the group, for example, `oidc-sync-test`. |
| 176 | +
|
| 177 | +. In the navigation pane, click *Users* -> *Create new user*. |
| 178 | +
|
| 179 | +. Enter a username, for example, `test`. |
| 180 | +
|
| 181 | +. Click *Join Groups* and add this user to the `oidc-sync-test` group. |
| 182 | +
|
| 183 | +. Click *Create*. |
| 184 | +
|
| 185 | +. In the navigation pane, click *Clients*. |
| 186 | +
|
| 187 | +. Click the name of the Client ID created earlier, for example, *quay-dev*. |
| 188 | +
|
| 189 | +. On the *Client details* page, click *Client scopes*. |
| 190 | +
|
| 191 | +. Click name of the client scope ID, for example, *quaydev-dedicated*. |
| 192 | +
|
| 193 | +. Click *Configure a new mapper*. This mapper allows groups to be returned from the user information endpoint. |
| 194 | +
|
| 195 | +. Select *User Realm Role*. |
| 196 | +
|
| 197 | +. On the *Add mapper* page, provide the following information: |
| 198 | +
|
| 199 | +.. Enter a name for the mapper, for example, `group`. |
| 200 | +.. Enter a Token Claim Name, for example, `groupName`. User groups are returned under this key name. It is used in your {productname} configuration. |
| 201 | +.. Click to turn Add to ID token `Off`. |
| 202 | +.. Click to turn Add to access token `Off`. |
| 203 | +.. Ensure that Add to userinfo is `On`. |
| 204 | +
|
| 205 | +. Click *Save*. |
| 206 | +
|
| 207 | +
|
| 208 | +[id="configuring-oidc-team-synchronization"] |
| 209 | +== Configuring team synchronization for OIDC deployments |
| 210 | +//// |
0 commit comments