You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -12,106 +12,121 @@ To authenticate users with GitHub, enable the GitHub authentication provider in
12
12
Opt for a GitHub App instead of an OAuth app to use fine-grained permissions, gain more control over which repositories the application can access, and use short-lived tokens.
13
13
14
14
.. link:https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app[Register a GitHub App] with the following configuration:
15
-
+
16
-
* *GitHub App name*: Enter a unique name identifying your GitHub App, such as __<{product}>__-__<GUID>__.
17
-
* *Homepage URL*: Your {product-short} URL: `pass:c,a,q[{my-product-url}]`.
18
-
* *Authorization callback URL*: Your {product-short} authentication backend URL: `pass:c,a,q[{my-product-url}/api/auth/github/handler/frame]`.
19
-
* *Webhook URL*: Your {product-short} URL: `pass:c,a,q[{my-product-url}]`.
20
-
* *Webhook secret*: Provide a strong secret.
21
-
* *Repository permissions*:
22
-
** Enable `Read-only` access to:
23
-
*** *Administration*
24
-
*** *Commit statuses*
25
-
*** *Contents*
26
-
*** *Dependabot alerts*
27
-
*** *Deployments*
28
-
*** *Pull Requests*
29
-
*** *Webhooks*
30
-
+
31
-
TIP: If you plan to make changes using the GitHub API, ensure that `Read and write` permissions are enabled instead of `Read-only`.
32
15
33
-
** Toggle other permissions as per your needs.
16
+
GitHub App name::
17
+
Enter a unique name identifying your GitHub App, such as `Authenticating-with-{product-very-short}-__<GUID>__`.
34
18
35
-
* *Organization permissions*:
36
-
** Enable `Read-only` access to *Members*.
19
+
Homepage URL::
20
+
Enter your {product-short} URL: `pass:c,a,q[{my-product-url}]`.
37
21
38
-
* For *Where can this GitHub App be installed?*, select `Only on this account`.
22
+
Authorization callback URL::
23
+
Enter your {product-short} authentication backend URL: `pass:c,a,q[{my-product-url}/api/auth/github/handler/frame]`.
39
24
40
-
.. In the *General* -> *Clients secrets* section, click *Generate a new client secret*.
25
+
Webhook URL:: Enter your {product-short} URL: `pass:c,a,q[{my-product-url}]`.
26
+
27
+
Webhook secret::
28
+
Not required.
41
29
42
-
.. In the *General* -> *Private keys* section, click *Generate a private key*.
30
+
Repository permissions::
31
+
Not required.
32
+
33
+
Organization permissions::
34
+
Enable `Read-only` access to *Members*.
35
+
36
+
Where can this GitHub App be installed?::
37
+
Select `Only on this account`.
38
+
39
+
.. In the *General* -> *Clients secrets* section, click *Generate a new client secret*.
43
40
44
41
.. In the *Install App* tab, choose an account to install your GitHub App on.
45
42
46
43
.. Save the following values for the next step:
47
44
48
-
* **App ID**
49
45
* **Client ID**
50
46
* **Client secret**
51
-
* **Private key**
52
-
* **Webhook secret**
53
47
54
48
. To add your GitHub credentials to {product-short}, add the following key/value pairs to link:{configuring-dynamic-plugins-book-url}#provisioning-your-custom-configuration[your {product-short} secrets]:
55
49
+
56
-
`AUTH_GITHUB_APP_ID`:: Enter the saved **App ID**.
57
-
`AUTH_GITHUB_CLIENT_ID`:: Enter the saved **Client ID**.
58
-
//`GITHUB_HOST_DOMAIN`:: Enter your GitHub host domain: `github.com` unless you are using GitHub Enterprise.
59
-
`GITHUB_ORGANIZATION`:: Enter your GitHub organization name, such as `__<your_github_organization_name>__'.
60
-
`GITHUB_ORG_URL`:: Enter `$GITHUB_HOST_DOMAIN/$GITHUB_ORGANIZATION`.
61
-
`GITHUB_CLIENT_SECRET`:: Enter the saved **Client Secret**.
62
-
`GITHUB_PRIVATE_KEY_FILE`:: Enter the saved **Private key**.
63
-
`GITHUB_WEBHOOK_URL`:: Enter your {product-short} URL: `pass:c,a,q[{my-product-url}]`.
64
-
`GITHUB_WEBHOOK_SECRET`:: Enter the saved *Webhook secret*.
65
-
66
-
. . To set up the GitHub authentication provider and enable integration with the GitHub API in your {product-short} custom configuration, edit your custom {product-short} config map such as `{my-app-config-config-map}`, and add the following lines to the `{my-app-config-file}` file content:
50
+
`AUTHENTICATION_GITHUB_CLIENT_ID`::
51
+
Enter the saved **Client ID**.
52
+
`AUTHENTICATION_GITHUB_CLIENT_SECRET`::
53
+
Enter the saved **Client Secret**.
54
+
`AUTHENTICATION_GITHUB_HOST_DOMAIN`::
55
+
Enter the GitHub host domain: `github.com`.
56
+
`AUTHENTICATION_GITHUB_ORGANIZATION`::
57
+
Enter your GitHub organization name, such as `__<your_github_organization_name>__'.
58
+
59
+
. Enable the `backstage-plugin-catalog-backend-module-github-org` plugin.
67
60
+
68
-
.`{my-app-config-file}` file fragment with mandatory fields to enable authentication with GitHub
. To provision GitHub users and groups to the {product-short} software catalog, add the `catalog.providers.githubOrg` section to your custom {product-short} `{my-app-config-file}` configuration file:
70
+
+
71
+
--
72
+
[id=githubProviderId]
73
+
.`{my-app-config-file}` fragment with mandatory `catalog.providers.githubOrg` fields
69
74
[source,yaml]
70
75
----
71
-
auth:
72
-
environment: production # <1>
76
+
catalog:
73
77
providers:
74
-
github:
75
-
production:
76
-
clientId: ${AUTH_GITHUB_CLIENT_ID} # <2>
77
-
clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
78
-
integrations:
79
-
github:
80
-
- host: ${GITHUB_HOST_DOMAIN}
81
-
apps:
82
-
- appId: ${AUTH_GITHUB_APP_ID}
83
-
clientId: ${AUTH_GITHUB_CLIENT_ID}
84
-
clientSecret: ${GITHUB_CLIENT_SECRET}
85
-
webhookUrl: ${GITHUB_WEBHOOK_URL}
86
-
webhookSecret: ${GITHUB_WEBHOOK_SECRET}
87
-
privateKey: |
88
-
${GITHUB_PRIVATE_KEY_FILE}
89
-
signInPage: github # <3>
78
+
githubOrg:
79
+
githubUrl: "${GITHUB_HOST_DOMAIN}"
80
+
orgs: [ "${GITHUB_ORGANIZATION}" ]
81
+
schedule:
82
+
frequency:
83
+
minutes: 30
84
+
initialDelay:
85
+
seconds: 15
86
+
timeout:
87
+
minutes: 15
90
88
----
91
-
<1> Mark the environment as `production` and disable the Guest login option in the {product-short} login page.
92
-
<2> Apply the GitHub credentials configured in your {product-short} secrets.
93
-
<3> To enable the GitHub provider as your {product-short} sign-in provider.
94
89
95
-
.. Optional: Consider adding the following optional fields:
90
+
`githubUrl` and `orgs`::
91
+
Use the {product-short} application information that you have created in GitHub and configured in OpenShift as secrets.
96
92
97
-
`callbackUrl`::
98
-
The callback URL that GitHub uses when initiating an OAuth flow, such as: __<your_intermediate_service_url/handler>__.
99
-
Define it when {product-short} is not the immediate receiver, such as in cases when you use one OAuth app for many {product-short} instances.
93
+
`schedule.frequency`::
94
+
Enter your schedule frequency, in the cron, ISO duration, or "human duration" format.
95
+
96
+
`schedule.timeout`::
97
+
Enter your schedule timeout, in the ISO duration or "human duration" format.
98
+
99
+
`schedule.initialDelay`::
100
+
Enter your schedule initial delay, in the ISO duration or "human duration" format.
101
+
--
102
+
103
+
. To set up the GitHub authentication provider, add the `auth.providers.github` section to the `{my-app-config-file}` file content:
100
104
+
101
-
.`{my-app-config-file}` file fragment with optional `enterpriseInstanceUrl` field
102
-
[source,yaml,subs="+quotes"]
105
+
.`{my-app-config-file}` file fragment with mandatory fields to enable authentication with GitHub
Enter a duration in `ms` library format (such as '24h', '2 days'), ISO duration, or "human duration" as used in code.
130
144
+
131
145
.`app-config-rhdh.yaml` fragment with optional `sessionDuration` field
@@ -138,14 +152,16 @@ auth:
138
152
sessionDuration: { hours: 24 }
139
153
----
140
154
141
-
`signIn`::
155
+
`signIn`::
142
156
143
157
`resolvers`:::
144
-
After successful authentication, the user signing in must be resolved to an existing user in the {product-short} catalog. To best match users securely for your use case, consider configuring a specific resolver. Enter the resolver list to override the default resolver: `usernameMatchingUserEntityName`.
158
+
After successful authentication, the user signing in must be resolved to an existing user in the {product-short} catalog.
159
+
To best match users securely for your use case, consider configuring a specific resolver.
160
+
Enter the resolver list to override the default resolver: `usernameMatchingUserEntityName`.
145
161
+
146
162
The authentication provider tries each sign-in resolver in order until it succeeds, and fails if none succeed.
147
163
+
148
-
WARNING: In production mode, only configure one resolver to ensure users are securely matched.
164
+
WARNING: In production mode, only configure one resolver to ensure users are securely matched.
149
165
150
166
`resolver`::::
151
167
Enter the sign-in resolver name.
@@ -174,55 +190,21 @@ auth:
174
190
resolvers:
175
191
- resolver: usernameMatchingUserEntityName
176
192
dangerouslyAllowSignInWithoutUserInCatalog: true
177
-
integrations:
178
-
github:
179
-
- host: ${GITHUB_HOST_DOMAIN}
180
-
apps:
181
-
- appId: ${AUTH_GITHUB_APP_ID}
182
-
clientId: ${AUTH_GITHUB_CLIENT_ID}
183
-
clientSecret: ${GITHUB_CLIENT_SECRET}
184
-
webhookUrl: ${GITHUB_WEBHOOK_URL}
185
-
webhookSecret: ${GITHUB_WEBHOOK_SECRET}
186
-
privateKey: |
187
-
${GITHUB_PRIVATE_KEY_FILE}
188
193
signInPage: github
189
194
----
190
195
191
-
[TIP]
192
-
====
193
-
To enable GitHub integration with a different authentication provider, complete the following configurations:
194
-
195
-
* Add the GitHub provider to the existing `auth` section.
196
-
* Keep the `signInPage` section from your authentication provider configuration.
197
-
198
-
.`{my-app-config-file}` file fragment with mandatory fields to enable GitHub integration and use a different authentication provider
199
-
[source,yaml,subs="+quotes"]
196
+
.Verification
197
+
. To verify user and group provisioning, check the console logs.
{"class":"GithubMultiOrgEntityProvider","level":"info","message":"Reading GitHub users and teams for org: rhdh-dast","plugin":"catalog","service":"backstage","target":"https://github.com","taskId":"GithubMultiOrgEntityProvider:production:refresh","taskInstanceId":"801b3c6c-167f-473b-b43e-e0b4b780c384","timestamp":"2024-09-09 23:55:58"}
203
+
{"class":"GithubMultiOrgEntityProvider","level":"info","message":"Read 7 GitHub users and 2 GitHub groups in 0.4 seconds. Committing...","plugin":"catalog","service":"backstage","target":"https://github.com","taskId":"GithubMultiOrgEntityProvider:production:refresh","taskInstanceId":"801b3c6c-167f-473b-b43e-e0b4b780c384","timestamp":"2024-09-09 23:55:59"}
221
204
----
222
-
====
223
205
224
-
.Verification
225
-
. Go to the {product-short} login page.
226
-
. Your {product-short} sign-in page displays *Sign in using GitHub* and the Guest user sign-in is disabled.
227
-
. Log in with GitHub.
206
+
. To verify GitHub authentication:
207
+
.. Go to the {product-short} login page.
208
+
.. Your {product-short} sign-in page displays *Sign in using GitHub* and the Guest user sign-in is disabled.
0 commit comments