|
| 1 | +:_mod-docs-content-type: SNIPPET |
| 2 | + |
| 3 | +. Register GitLab OAuth 2 application to allow {product-very-short} to authenticate with GitLab. You must use the required callback URL and permissions. |
| 4 | +.. link:https://docs.gitlab.com/integration/oauth_provider/[Register a GitLab OAuth 2 application] using the following configuration: |
| 5 | ++ |
| 6 | +-- |
| 7 | +GitLab OAuth 2 application name:: |
| 8 | +Enter a unique name, such as `authenticating-with-rhdh-_<GUID>_`. |
| 9 | + |
| 10 | +Redirect URI:: |
| 11 | +Enter your {product-short} URL: `pass:c,a,q[{my-product-url}]`. |
| 12 | + |
| 13 | +Authorization callback URL:: |
| 14 | +Enter your authentication backend URL: `pass:c,a,q[{my-product-url}/api/auth/gitlab/handler/frame]`. |
| 15 | + |
| 16 | +Authorized application scope:: |
| 17 | +Enable `email`, `profile`, `openid`, and `read_user`. |
| 18 | +-- |
| 19 | +.. Save the application and record these values for the next step: |
| 20 | + |
| 21 | +* **OAuth 2 Client ID**, available in the *Application ID* field |
| 22 | +* **OAuth 2 Client secret**, accessible by selecting *Copy* in the *Secret* field |
| 23 | +
|
| 24 | +. Add your GitLab credentials to {configuring-book-link}#provisioning-your-custom-configuration[your {product-very-short} secrets] using the following key/value pairs. |
| 25 | +Use these environment variables in your {product-very-short} configuration files. |
| 26 | + |
| 27 | +`GITLAB_HOST`:: |
| 28 | +Enter your GitLab host: `<gitlab_host>`. |
| 29 | + |
| 30 | +`GITLAB_CLIENT_ID`:: |
| 31 | +Enter the saved *OAuth 2 Client ID*. |
| 32 | + |
| 33 | +`GITLAB_CLIENT_SECRET`:: |
| 34 | +Enter the saved *OAuth 2 Client Secret*. |
| 35 | + |
| 36 | +`GITLAB_URL`:: |
| 37 | +Enter the GitLab host domain: _`<gitlab_host_domain>`_. |
| 38 | + |
| 39 | +`GITLAB_PARENT_ORG`:: |
| 40 | +Enter your GitLab organization name, such as `_<your_gitlab_organization_name>_`. |
| 41 | + |
| 42 | +. Enable provisioning for GitLab users and groups to the {product-short} software catalog by adding the provider section to your {product-very-short} `{my-app-config-file}` file: |
| 43 | ++ |
| 44 | +[source,yaml,subs="+quotes,+attributes"] |
| 45 | +---- |
| 46 | +catalog: |
| 47 | + providers: |
| 48 | + gitlab: |
| 49 | + default: |
| 50 | + host: $\{GITLAB_HOST} |
| 51 | + orgEnabled: true |
| 52 | + group: $\{GITLAB_PARENT_ORG} |
| 53 | + relations: |
| 54 | + - INHERITED |
| 55 | + - DESCENDANTS |
| 56 | + - SHARED_FROM_GROUPS |
| 57 | + groupPattern: `[\s\S]*` |
| 58 | + restrictUsersToGroup: true |
| 59 | + includeUsersWithoutSeat: true |
| 60 | + schedule: |
| 61 | + initialDelay: |
| 62 | + seconds: 0 |
| 63 | + frequency: |
| 64 | + minutes: 50 |
| 65 | + timeout: |
| 66 | + minutes: 50 |
| 67 | +---- |
| 68 | + |
| 69 | +`host`:: |
| 70 | +Enter your GitLab instance address: pass:c,a,q[`${GITLAB_HOST}`]. |
| 71 | + |
| 72 | +`orgEnabled`:: |
| 73 | +Set to `true` to enable the ingestion of GitLab organizational data, such as users and groups. For the Gitlab site, you must also provide a value for the `group` parameter. |
| 74 | + |
| 75 | +`group`:: |
| 76 | +Enter your configured link:https://docs.gitlab.com/user/group/[GitLab parent group]: `${GITLAB_PARENT_ORG}`. |
| 77 | + |
| 78 | +`relations`:: |
| 79 | +Optional. Specify the types of group memberships to include during ingestion. You can use the following values: |
| 80 | +* `INHERITED`: Optional. Includes members of any ancestor groups as members of the current group. |
| 81 | +* `DESCENDANTS`: Optional. Includes members of any descendant groups as members of the current group. |
| 82 | +* `SHARED_FROM_GROUPS`: Optional. Includes members of any invited groups as members of the current group. |
| 83 | + |
| 84 | +`groupPattern`:: |
| 85 | +Optional. Filters found groups based on provided pattern. Defaults to `[\s\S]*`, which means to not filter anything. |
| 86 | + |
| 87 | +`restrictUsersToGroup`:: |
| 88 | +Set to `true` to ingest only users who are direct members of the configured group. |
| 89 | + |
| 90 | +`includeUsersWithoutSeat`:: |
| 91 | +Set to `true` to include users who do not occupy a paid seat. This setting applies only to GitLab SaaS. |
| 92 | + |
| 93 | +`schedule.initialDelay`:: |
| 94 | +Enter your schedule initial delay, in the ISO duration or "human duration" format. |
| 95 | + |
| 96 | +`schedule.frequency`:: |
| 97 | +Enter your schedule frequency, in the cron, ISO duration, or "human duration" format. |
| 98 | + |
| 99 | +`schedule.timeout`:: |
| 100 | +Enter your schedule timeout, in the ISO duration or "human duration" format. |
| 101 | + |
| 102 | +. Enable the GitLab authentication provider by adding the GitLab authentication provider section to your {product-very-short} `{my-app-config-file}` file: |
| 103 | ++ |
| 104 | +[source,yaml,subs="+quotes,+attributes"] |
| 105 | +---- |
| 106 | +includeTransitiveGroupOwnership: true |
| 107 | +signInPage: gitlab |
| 108 | +auth: |
| 109 | + environment: production |
| 110 | + session: |
| 111 | + secret: _<name_of_secret>_ |
| 112 | + providers: |
| 113 | + gitlab: |
| 114 | + production: |
| 115 | + audience: https://${GITLAB_HOST} |
| 116 | + clientId: $\{GITLAB_CLIENT_ID} |
| 117 | + clientSecret: $\{GITLAB_CLIENT_SECRET} |
| 118 | + callbackUrl: {my-product-url}/api/auth/gitlab/handler/frame |
| 119 | +---- |
| 120 | ++ |
| 121 | +
|
| 122 | +`audience`:: |
| 123 | +Enter your GitLab instance address: `pass:c,a,q[https://${GITLAB_HOST}]` |
| 124 | + |
| 125 | +`clientId`:: |
| 126 | +Enter the configured client ID: `${GITLAB_CLIENT_ID}`. |
| 127 | + |
| 128 | +`clientSecret`:: |
| 129 | +Enter the configured secret variable name: `${GITLAB_CLIENT_SECRET}`. |
| 130 | + |
| 131 | +`callbackUrl`:: |
| 132 | +Enter your {product-short} authentication backend URL: `pass:c,a,q[{my-product-url}/api/auth/gitlab/handler/frame]` |
0 commit comments