Skip to content

Commit 64cfead

Browse files
themr0cJessicaJHee
authored andcommitted
RHIDP-7975 Enabling authentication procedures with mandatory steps only (redhat-developer#1266)
Co-authored-by: Jessica He <[email protected]>
1 parent b17a412 commit 64cfead

13 files changed

+189
-170
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
cron
2+
Entra
3+
IdP
4+
Operator
5+
MSGraph
16
scaffolder

.vale.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ BasedOnStyles = RedHat,DeveloperHub,AsciiDocDITA
2323
AsciiDocDITA.AttributeReference = NO
2424
AsciiDocDITA.ShortDescription = NO
2525
AsciiDocDITA.CrossReference = NO
26+
AsciiDocDITA.ConditionalCode = NO

assemblies/assembly-authenticating-with-the-guest-user.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
[id="authenticating-with-the-guest-user_{context}"]
44
= Authenticating with the Guest user
55

6-
To explore {product-short} features, you can skip configuring authentication and authorization.
7-
You can configure {product-short} to log in as a Guest user and access {product-short} features.
6+
For trial or non-production environments, you can enable guest access to skip configuring authentication and authorization and explore {product-short} features.
87

98
include::modules/authentication/proc-authenticationg-with-the-guest-user-on-an-operator-based-installation.adoc[leveloffset=+1]
109

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
:optional-steps: disable
3+
4+
[id='enabling-authentication-with-mandatory-steps-only']
5+
= Enabling authentication in {product} (with mandatory steps only)
6+
7+
include::modules/authentication/con-understanding-authentication-and-user-provisioning.adoc[leveloffset=+1]
8+
9+
10+
include::assembly-authenticating-with-the-guest-user.adoc[leveloffset=+1]
11+
12+
13+
include::modules/authentication/proc-enabling-user-authentication-with-rhbk.adoc[leveloffset=+1]
14+
15+
16+
include::modules/authentication/proc-enabling-user-authentication-with-github.adoc[leveloffset=+1]
17+
18+
19+
include::modules/authentication/proc-enabling-user-authentication-with-microsoft-azure.adoc[leveloffset=+1]
20+

assemblies/assembly-enabling-authentication.adoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
:_mod-docs-content-type: ASSEMBLY
2+
:optional-steps: enable
23

34
[id='enabling-authentication']
45
= Enabling authentication in {product}
56

6-
7-
8-
97
include::modules/authentication/con-understanding-authentication-and-user-provisioning.adoc[leveloffset=+1]
108

119

modules/authentication/con-understanding-authentication-and-user-provisioning.adoc

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
= Understanding authentication and user provisioning
44

5-
This module provides an overview of how authentication and user provisioning function within {product}.
6-
Learn about the process from creating user and group entities in the software catalog to user sign-in, and how authentication and catalog plugins enable each step.
5+
Learn about the authentication process from creating user and group entities in the software catalog to user sign-in, and how authentication and catalog plugins enable each step.
76
Understanding this process is essential for successfully configuring your {product-short} instance, securing access through authorization, and enabling features that rely on synchronized user and group data.
87

98
To fully enable catalog features, provision user and group data from the Identity Provider to the {product-short} software catalog.
@@ -18,21 +17,29 @@ On successful authentication, the {product-short} authentication plugin, configu
1817

1918
Configuring authentication and user provisioning is critical for several reasons.
2019

21-
* It secures your {product-short} instance by ensuring only authenticated users can gain access.
22-
* It enables authorization by allowing you to define access controls based on user and group memberships synchronized from your IdP.
20+
* Securing your {product-short} instance by ensuring only authenticated users can gain access.
21+
* Enabling authorization by allowing you to define access controls based on user and group memberships synchronized from your IdP.
2322
* Provisioning user and group data to the catalog is necessary for various catalog features that rely on understanding entity ownership and relationships between users, groups, and software components.
24-
Without this provisioning step, features like displaying who owns a component in the catalog may not function correctly.
23+
+
24+
[IMPORTANT]
25+
====
26+
Without this provisioning step, features such as displaying who owns a catalog entity might not function correctly.
27+
====
2528

2629
[TIP]
2730
====
2831
To explore {product-short} features in a non-production environment, you can:
2932
3033
* To use {product-short} without external IdP, enable the guest user to skip configuring authentication and authorization, log in as the guest user, and access all {product-short} features.
3134
32-
* To use {product-short} without authorization policies and features relying on the software catalog, you can enable the `dangerouslyAllowSignInWithoutUserInCatalog` resolver option. This setting bypasses the check requiring a user to be in the catalog but still enforces authentication.
35+
* To use {product-short} without authorization policies and features relying on the software catalog, you can enable the `dangerouslyAllowSignInWithoutUserInCatalog` resolver option.
36+
This setting bypasses the check requiring a user to be in the catalog but still enforces authentication.
3337
====
3438

3539
[IMPORTANT]
3640
====
37-
{product-short} uses a one-way synchronization model, where user and group data flow from your Identity Provider to the {product-short} software catalog. As a result, deleting users or groups manually through the {product-short} Web UI or REST API might be ineffective or cause inconsistencies, since those entities will be recreated during the next ingestion.
41+
{product-short} uses a one-way synchronization model, where user and group data flow from your Identity Provider to the {product-short} software catalog.
42+
As a result,
43+
deleting users or groups manually through the {product-short} Web UI or REST API might be ineffective or cause inconsistencies,
44+
since {product-short} will create those entities again during the next import.
3845
====

modules/authentication/proc-authenticationg-with-the-guest-user-on-a-helm-based-installation.adoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
[id="authenticating-with-the-guest-user-on-a-helm-based-installation_{context}"]
44
= Authenticating with the Guest user on a Helm-based installation
55

6-
On a Helm-based installation, you can configure {product-short} to log in as a Guest user and access {product-short} features.
6+
For trial or non-production environments installed by using the {product} Helm chart, you can enable guest access to skip configuring authentication and authorization and explore {product-short} features.
77

88
.Prerequisites
9-
* You {configuring-book-link}[added a custom {product-short} application configuration], and have sufficient permissions to modify it.
9+
* You {configuring-book-link}[added a custom {product-short} application configuration], and have enough permissions to change it.
1010
* You {configuring-book-link}#using-the-helm-chart-to-run-rhdh-with-your-custom-configuration[use the {product} Helm chart to run {product-short}].
1111

1212
.Procedure
13-
* To enable the guest user in your {product-short} custom configuration, {configuring-book-link}#using-the-helm-chart-to-run-rhdh-with-your-custom-configuration[configure your {product} Helm Chart] with following content:
13+
* Add following content to your {product} Helm Chart:
1414
+
15-
.{product} Helm Chart configuration fragment
1615
[source,yaml]
1716
----
1817
upstream:

modules/authentication/proc-authenticationg-with-the-guest-user-on-an-operator-based-installation.adoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
[id="authenticating-with-the-guest-user-on-an-operator-based-installation_{context}"]
44
= Authenticating with the Guest user on an Operator-based installation
55

6-
After an Operator-based installation, you can configure {product-short} to log in as a Guest user and access {product-short} features.
6+
For trial or non-production environments installed by using the {product} Operator, you can enable guest access to skip configuring authentication and authorization and explore {product-short} features.
77

88
.Prerequisites
9-
* You {configuring-book-link}[added a custom {product-short} application configuration], and have sufficient permissions to modify it.
9+
* You {configuring-book-link}[added a custom {product-short} application configuration], and have enough permissions to change it.
1010
* You {configuring-book-link}#using-the-operator-to-run-rhdh-with-your-custom-configurationn[use the {product} Operator to run {product-short}].
1111

1212
.Procedure
13-
* To enable the guest user in your {product-short} custom configuration, {configuring-book-link}#provisioning-your-custom-configuration[edit your {product-short} application configuration] with following content:
13+
* Add the following content to the `{my-app-config-file}` file:
1414
+
15-
.`{my-app-config-file}` fragment
1615
[source,yaml]
1716
----
1817
auth:

modules/authentication/proc-creating-a-custom-transformer-to-provision-users-from-rhbk-to-the-software-catalog.adoc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
[id="creating-a-custom-transformer-to-provision-users-from-rhbk-to-the-software-catalog"]
44
= Creating a custom transformer to provision users from {rhbk-brand-name} ({rhbk}) to the software catalog
55

6-
To customize how {rhbk} users and groups are mapped to {product} entities, you can create a backend module that uses the `keycloakTransformerExtensionPoint` to provide custom user and group transformers for the Keycloak backend.
6+
Customize how {product} provisions users and groups to {product} software catalog entities,
7+
by creating a backend module that uses the `keycloakTransformerExtensionPoint` to offer custom user and group transformers for the Keycloak backend.
78

89
.Prerequisites
910
* You have xref:enabling-user-authentication-with-rhbk[enabled provisioning users from {rhbk-brand-name} ({rhbk}) to the software catalog].
@@ -14,9 +15,8 @@ To customize how {rhbk} users and groups are mapped to {product} entities, you c
1415
. Add your custom user and group transformers to the `keycloakTransformerExtensionPoint`.
1516

1617
+
17-
The following is an example of how the backend module can be defined:
18+
The following is an example `plugins/__<module_name>__/src/module.ts` file defining the backend module:
1819
+
19-
.`plugins/__<module-name>__/src/module.ts`
2020
[source,javascript]
2121
----
2222
import {
@@ -63,7 +63,7 @@ export const keycloakBackendModuleTransformer = createBackendModule({
6363
+
6464
[IMPORTANT]
6565
====
66-
The module's `pluginId` must be set to `catalog` to match the `pluginId` of the `keycloak-backend`; otherwise, the module fails to initialize.
66+
Set the module's `pluginId` to `catalog` to match the `pluginId` of the `keycloak-backend`; otherwise, the module fails to initialize.
6767
====
6868

6969
. Install this new backend module into your {product-short} backend.
@@ -76,16 +76,17 @@ backend.add(import(backstage-plugin-catalog-backend-module-keycloak-transformer)
7676
.Verification
7777

7878
* {product-short} imports the users and groups each time when started.
79-
Check the console logs to verify that the synchronization is completed.
79+
Check the console logs to verify the synchronization result.
80+
+
81+
Successful synchronization example:
8082
+
81-
.Successful synchronization example:
8283
[source,json]
8384
----
8485
{"class":"KeycloakOrgEntityProvider","level":"info","message":"Read 3 Keycloak users and 2 Keycloak groups in 1.5 seconds. Committing...","plugin":"catalog","service":"backstage","taskId":"KeycloakOrgEntityProvider:default:refresh","taskInstanceId":"bf0467ff-8ac4-4702-911c-380270e44dea","timestamp":"2024-09-25 13:58:04"}
8586
{"class":"KeycloakOrgEntityProvider","level":"info","message":"Committed 3 Keycloak users and 2 Keycloak groups in 0.0 seconds.","plugin":"catalog","service":"backstage","taskId":"KeycloakOrgEntityProvider:default:refresh","taskInstanceId":"bf0467ff-8ac4-4702-911c-380270e44dea","timestamp":"2024-09-25 13:58:04"}
8687
----
8788

88-
* After the first import is complete, navigate to the *Catalog* page and select **User** to view the list of users.
89+
* After the first import is complete, go to the *Catalog* page and select **User** to view the list of users.
8990

9091
* When you select a user, you see the information imported from {rhbk}.
9192

modules/authentication/proc-enabling-user-authentication-with-github.adoc

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
[id="enabling-user-authentication-with-github"]
44
= Enabling user authentication with GitHub
55

6-
To authenticate users with GitHub, configure the GitHub authentication provider in {product} and provision the users and groups from GitHub to the {product-short} software catalog.
6+
Authenticate users with GitHub by provisioning the users and groups from GitHub to the {product-short} software catalog, and configuring the GitHub authentication provider in {product}.
77

88
.Prerequisites
9-
* You {configuring-book-link}[added a custom {product-short} application configuration], and have sufficient permissions to modify it.
9+
* You {configuring-book-link}[added a custom {product-short} application configuration], and have enough permissions to change it.
1010

11-
* You have sufficient permissions in GitHub to create and manage a link:https://docs.github.com/en/apps/overview[GitHub App].
11+
* You have enough permissions in GitHub to create and manage a link:https://docs.github.com/en/apps/overview[GitHub App].
1212
Alternatively, you can ask your GitHub administrator to prepare the required GitHub App.
1313

1414
.Procedure
@@ -45,44 +45,43 @@ Select `Only on this account`.
4545
* **Client secret**
4646

4747
. To add your GitHub credentials to {product-short}, add the following key/value pairs to {configuring-book-link}#provisioning-your-custom-configuration[your {product-short} secrets].
48-
You can use these secrets in the {product-short} configuration files by using their respective environment variable name.
48+
You can use these secrets in the {product-short} configuration files by using their environment variable name.
4949

50-
`AUTHENTICATION_GITHUB_CLIENT_ID`::
50+
`GITHUB_CLIENT_ID`::
5151
Enter the saved **Client ID**.
5252

53-
`AUTHENTICATION_GITHUB_CLIENT_SECRET`::
53+
`GITHUB_CLIENT_SECRET`::
5454
Enter the saved **Client Secret**.
5555

56-
`AUTHENTICATION_GITHUB_HOST_DOMAIN`::
56+
`GITHUB_URL`::
5757
Enter the GitHub host domain: `github.com`.
5858

59-
`AUTHENTICATION_GITHUB_ORGANIZATION`::
59+
`GITHUB_ORG`::
6060
Enter your GitHub organization name, such as `__<your_github_organization_name>__`.
6161

6262
. Enable the GitHub organization provisioning plugin (`backstage-plugin-catalog-backend-module-github-org`).
63-
This plugin ingests GitHub users and groups to the {product-short} software catalog.
63+
This plugin imports GitHub users and groups to the {product-short} software catalog.
64+
+
65+
`dynamic-plugins.yaml` file fragment:
6466
+
65-
.`dynamic-plugins.yaml` file fragment
6667
[source,yaml]
6768
----
6869
plugins:
6970
- package: './dynamic-plugins/dist/backstage-plugin-catalog-backend-module-github-org'
7071
disabled: false
7172
----
7273

73-
. 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:
74+
. Provision GitHub users and groups to the {product-short} software catalog by adding the `catalog.providers.githubOrg` section to your custom {product-short} `{my-app-config-file}` configuration file:
7475
+
75-
--
7676
[id=githubProviderId]
77-
.`{my-app-config-file}` fragment with mandatory `catalog.providers.githubOrg` fields
7877
[source,yaml]
7978
----
8079
catalog:
8180
providers:
8281
githubOrg:
8382
id: githuborg
84-
githubUrl: "${AUTHENTICATION_GITHUB_HOST_DOMAIN}"
85-
orgs: [ "${AUTHENTICATION_GITHUB_ORGANIZATION}" ]
83+
githubUrl: "${GITHUB_URL}"
84+
orgs: [ "${GITHUB_ORG}" ]
8685
schedule:
8786
frequency:
8887
minutes: 30
@@ -94,13 +93,13 @@ catalog:
9493

9594
`id`::
9695
Enter a stable identifier for this provider, such as `githuborg`.
97-
Entities from this provider are associated with this identifier, therefore you must take care not to change it over time since that might lead to orphaned entities and/or conflicts.
96+
Entities from this provider are associated with this identifier, therefore you must take care not to change it over time since that might lead to orphaned entities or conflicts.
9897

9998
`githubUrl`::
100-
Enter the configured secret variable name: `${AUTHENTICATION_GITHUB_HOST_DOMAIN}`.
99+
Enter the configured secret variable name: `$\{GITHUB_URL}`.
101100

102101
`orgs`::
103-
Enter the configured secret variable name: `${AUTHENTICATION_GITHUB_ORGANIZATION}`.
102+
Enter the configured secret variable name: `$\{GITHUB_ORG}`.
104103

105104
`schedule.frequency`::
106105
Enter your schedule frequency, in the cron, ISO duration, or "human duration" format.
@@ -110,48 +109,47 @@ Enter your schedule timeout, in the ISO duration or "human duration" format.
110109

111110
`schedule.initialDelay`::
112111
Enter your schedule initial delay, in the ISO duration or "human duration" format.
113-
--
114112

115-
. To set up the GitHub authentication provider, add the `auth.providers.github` section to the `{my-app-config-file}` file content:
113+
. To set up the GitHub authentication provider, add the `auth.providers.github` section to your `{my-app-config-file}` file:
116114
+
117-
--
118-
.`{my-app-config-file}` file fragment with mandatory fields to enable authentication with GitHub
119115
[source,yaml]
120116
----
121117
auth:
122118
environment: production
123119
providers:
124120
github:
125121
production:
126-
clientId: ${AUTHENTICATION_GITHUB_CLIENT_ID}
127-
clientSecret: ${AUTHENTICATION_GITHUB_CLIENT_SECRET}
122+
clientId: ${GITHUB_CLIENT_ID}
123+
clientSecret: ${GITHUB_CLIENT_SECRET}
128124
signInPage: github
129125
----
130126

131127
`environment`::
132128
Enter `production` to disable the Guest login option in the {product-short} login page.
133129

134130
`clientId`::
135-
Enter the configured secret variable name: `${AUTHENTICATION_GITHUB_CLIENT_ID}`.
131+
Enter the configured secret variable name: `$\{GITHUB_CLIENT_ID}`.
136132

137133
`clientSecret`::
138-
Enter the configured secret variable name: `${AUTHENTICATION_GITHUB_CLIENT_SECRET}`.
134+
Enter the configured secret variable name: `$\{GITHUB_CLIENT_SECRET}`.
139135

140136
`signInPage`::
141137
Enter `github` to enable the GitHub provider as your {product-short} sign-in provider.
142-
143-
Optional: Consider adding the following optional fields:
144-
145-
.`{my-app-config-file}` file fragment including optional fields to enable authentication with GitHub
138+
+
139+
Optional: Consider adding optional fields.
140+
ifeval::["{optional-steps}" == "disable"]
141+
See {configuring-book-link}[{configuring-book-title}].
142+
endif::[]
143+
ifeval::["{optional-steps}" == "enable"]
146144
[source,yaml,subs="+quotes"]
147145
----
148146
auth:
149147
environment: production
150148
providers:
151149
github:
152150
production:
153-
clientId: ${AUTHENTICATION_GITHUB_CLIENT_ID}
154-
clientSecret: ${AUTHENTICATION_GITHUB_CLIENT_SECRET}
151+
clientId: ${GITHUB_CLIENT_ID}
152+
clientSecret: ${GITHUB_CLIENT_SECRET}
155153
callbackUrl: __<your_intermediate_service_url/handler>__
156154
sessionDuration: { hours: 24 }
157155
signIn:
@@ -178,7 +176,10 @@ Enter the resolver list to override the default resolver: `usernameMatchingUserE
178176
+
179177
The authentication provider tries each sign-in resolver in order until it succeeds, and fails if none succeed.
180178
+
181-
WARNING: In production mode, only configure one resolver to ensure users are securely matched.
179+
[WARNING]
180+
====
181+
Make sure users are securely matched in production mode, by configuring only one resolver.
182+
====
182183

183184
`resolver`::::
184185
Enter the sign-in resolver name.
@@ -191,13 +192,17 @@ Available resolvers:
191192
`dangerouslyAllowSignInWithoutUserInCatalog: true`::::
192193
Configure the sign-in resolver to bypass the user provisioning requirement in the {product-short} software catalog.
193194
+
194-
WARNING: Use `dangerouslyAllowSignInWithoutUserInCatalog` to explore {product-short} features, but do not use it in production.
195-
--
195+
[WARNING]
196+
====
197+
Do not use `dangerouslyAllowSignInWithoutUserInCatalog` in production. Use this configuration only to explore {product-short} features.
198+
====
199+
endif::[]
196200

197201
.Verification
198-
. To verify user and group provisioning, check the console logs.
202+
. Verify user and group provisioning by checking the console logs.
203+
+
204+
Successful synchronization example:
199205
+
200-
.Successful synchronization example:
201206
[source,json]
202207
----
203208
{"class":"GithubMultiOrgEntityProvider","level":"info","message":"Reading GitHub users and teams for org: rhdh-dast","plugin":"catalog","service":"backstage","target":"https://github.com","taskId":"GithubMultiOrgEntityProvider:githuborg:refresh","taskInstanceId":"801b3c6c-167f-473b-b43e-e0b4b780c384","timestamp":"2024-09-09 23:55:58"}
@@ -210,6 +215,5 @@ WARNING: Use `dangerouslyAllowSignInWithoutUserInCatalog` to explore {product-sh
210215
.. Log in with a GitHub account.
211216

212217
.Additional resources
213-
214218
* {integrating-with-github-book-link}[{integrating-with-github-book-title}]
215219

0 commit comments

Comments
 (0)