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
Copy file name to clipboardExpand all lines: modules/authentication/proc-creating-a-custom-transformer-to-provision-users-from-rhbk-to-the-software-catalog.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
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.
5
5
6
6
.Prerequisites
7
-
* You have xref:provisioning-users-from-rhbk-to-the-software-catalog[enabled provisioning users from {rhbk-brand-name} ({rhbk}) to the software catalog].
7
+
* You have xref:enabling-user-authentication-with-rhbk[enabled provisioning users from {rhbk-brand-name} ({rhbk}) to the software catalog].
8
8
9
9
.Procedure
10
10
. Create a new backend module with the `yarn new` command.
= Enabling authentication with {rhbk-brand-name} ({rhbk})
3
-
4
-
To authenticate users with {rhbk-brand-name} ({rhbk}), enable the OpenID Connect (OIDC) authentication provider in {product}.
1
+
[id="enabling-user-authentication-with-rhbk"]
2
+
= Enabling user authentication with {rhbk-brand-name} ({rhbk})
5
3
4
+
To authenticate users with {rhbk-brand-name} ({rhbk}), enable and configure the OpenID Connect (OIDC) authentication provider in {product} and provision the users and groups from {rhbk} to the {product-short} software catalog.
6
5
7
6
.Prerequisites
8
7
* You link:{configuring-book-url}[added a custom {product-short} application configuration], and have sufficient permissions to modify it.
9
-
* You have sufficient permissions in {rhsso} to create and manage a realm.
8
+
* You have sufficient permissions in {rhsso} to create and manage a realm and a client.
9
+
Alternatively, your {rhbk} administrator can prepare in {rhbk} the required realm and client for you.
10
10
11
11
.Procedure
12
12
. To allow {product-short} to authenticate with {rhbk}, complete the steps in {rhbk}, to link:https://docs.redhat.com/en/documentation/red_hat_build_of_keycloak/26.0/html/getting_started_guide/getting-started-zip-#getting-started-zip-create-a-realm[create a realm and a user] and link:https://docs.redhat.com/en/documentation/red_hat_build_of_keycloak/26.0/html/getting_started_guide/getting-started-zip-#getting-started-zip-secure-the-first-application[secure the first application]:
@@ -25,15 +25,143 @@ Save the value for the next step:
25
25
26
26
.. To prepare for the verification steps, in the same realm, get the credential information for an existing user or link:https://docs.redhat.com/en/documentation/red_hat_build_of_keycloak/26.0/html-single/getting_started_guide/index#getting-started-zip-create-a-user[create a user]. Save the user credential information for the verification steps.
27
27
28
-
. To add your {rhsso} credentials to your {product-short}, add the following key/value pairs to link:{configuring-dynamic-plugins-book-url}#provisioning-your-custom-configuration[your {product-short} secrets]:
28
+
. To add your {rhsso} 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].
29
+
You can use these secrets in the {product-short} configuration files by using their respective environment variable name.
30
+
+
31
+
`AUTHENTICATION_OIDC_CLIENT_ID`::
32
+
Enter the saved **Client ID**.
33
+
34
+
`AUTHENTICATION_OIDC_CLIENT_SECRET`::
35
+
Enter the saved **Client Secret**.
36
+
37
+
`AUTHENTICATION_OIDC_METADATA_URL`::
38
+
Enter the saved **{rhbk} realm base URL**.
39
+
40
+
. Enable the Keycloak organization plugin (`backstage-plugin-catalog-backend-module-keycloak-dynamic`).
41
+
The plugin is named after {rhbk} upstream project.
42
+
This plugin ingests {rhbk} users and groups to the {product-short} software catalog.
. To provision {rhbk} users and groups to the {product-short} software catalog, add the `catalog.providers.keycloakOrg` section to your custom {product-short} `{my-app-config-file}` configuration file:
53
+
54
+
.. Add mandatory fields:
29
55
+
30
-
`AUTH_OIDC_CLIENT_ID`:: Enter the saved **Client ID**.
31
-
`AUTH_OIDC_CLIENT_SECRET`:: Enter the saved **Client Secret**.
32
-
`AUTH_OIDC_METADATA_URL`:: Enter the saved **{rhbk} realm base URL**.
56
+
[id=keycloakOrgProviderId]
57
+
.`{my-app-config-file}` fragment with mandatory `keycloakOrg` fields
Enter your {rhbk} server URL, defined when xref:enabling-user-authentication-with-rhbk[enabling authentication with {rhbk}].
73
+
74
+
`clientId`::
75
+
Enter your {product-short} application client ID in {rhbk}, defined when xref:enabling-user-authentication-with-rhbk[enabling authentication with {rhbk}].
76
+
77
+
`clientSecret`::
78
+
Enter your {product-short} application client secret in {rhbk}, defined when xref:enabling-user-authentication-with-rhbk[enabling authentication with {rhbk}].
79
+
80
+
`realm`::
81
+
Enter the realm name to provision users, such as `master`.
82
+
83
+
`loginRealm`::
84
+
Enter the realm name to authenticate users, such as `master`.
85
+
86
+
.. Optional: Consider adding optional fields:
87
+
88
+
`userQuerySize`::
89
+
Enter the user count to query simultaneously.
90
+
Default value: `100`.
91
+
+
92
+
.`{my-app-config-file}` fragment with optional `userQuerySize` field
93
+
[source,yaml]
94
+
----
95
+
catalog:
96
+
providers:
97
+
keycloakOrg:
98
+
default:
99
+
userQuerySize: 100
100
+
----
101
+
102
+
`groupQuerySize`::
103
+
Enter the group count to query simultaneously.
104
+
Default value: `100`.
105
+
+
106
+
.`{my-app-config-file}` fragment with optional `groupQuerySize` field
107
+
[source,yaml]
108
+
----
109
+
catalog:
110
+
providers:
111
+
keycloakOrg:
112
+
default:
113
+
groupQuerySize: 100
114
+
----
115
+
116
+
`schedule.frequency`::
117
+
Enter the schedule frequency.
118
+
Supports cron, ISO duration, and "human duration" as used in code.
119
+
+
120
+
.`{my-app-config-file}` fragment with optional `schedule.frequency` field
121
+
[source,yaml]
122
+
----
123
+
catalog:
124
+
providers:
125
+
keycloakOrg:
126
+
default:
127
+
schedule:
128
+
frequency: { hours: 1 }
129
+
----
130
+
131
+
`schedule.timeout`::
132
+
Enter the timeout for the user provisioning job.
133
+
Supports ISO duration and "human duration" as used in code.
134
+
+
135
+
.`{my-app-config-file}` fragment with optional `schedule.timeout` field
136
+
[source,yaml]
137
+
----
138
+
catalog:
139
+
providers:
140
+
keycloakOrg:
141
+
default:
142
+
schedule:
143
+
timeout: { minutes: 50 }
144
+
----
145
+
146
+
`schedule.initialDelay`::
147
+
Enter the initial delay to wait for before starting the user provisioning job.
148
+
Supports ISO duration and "human duration" as used in code.
149
+
+
150
+
.`{my-app-config-file}` fragment with optional `schedule.initialDelay` field
151
+
[source,yaml]
152
+
----
153
+
catalog:
154
+
providers:
155
+
keycloakOrg:
156
+
default:
157
+
schedule:
158
+
initialDelay: { seconds: 15}
159
+
----
160
+
--
33
161
34
162
. To set up the {rhbk} authentication provider in your {product-short} custom configuration, edit your custom {product-short} ConfigMap such as `app-config-rhdh`, and add the following lines to the `{my-app-config-file}` content:
35
163
36
-
.. Configure mandatory fields:
164
+
.. Add mandatory fields:
37
165
+
38
166
.`{my-app-config-file}` fragment with mandatory fields to enable authentication with {rhbk}
@@ -61,12 +189,14 @@ To enable the OIDC provider as default sign-in provider.
61
189
62
190
`prompt: auto`::
63
191
To allow the identity provider to automatically determine whether to prompt for credentials or bypass the login redirect if an active {rhsso} session exists.
64
-
192
+
+
65
193
[NOTE]
66
194
====
67
195
If `prompt: auto` is not set, the identity provider defaults to `prompt: none`, which assumes that you are already logged in and rejects sign-in requests without an active session.
@@ -212,6 +350,18 @@ If multiple valid refresh tokens are issued due to frequent refresh token reques
212
350
====
213
351
214
352
.Verification
215
-
. Go to the {product-short} login page.
216
-
. Your {product-short} sign-in page displays *Sign in using OIDC* and the Guest user sign-in is disabled.
217
-
. Log in with OIDC by using the saved **Username** and **Password** values.
353
+
354
+
. To verify user and group provisioning, check the console logs.
355
+
+
356
+
.Successful synchronization example:
357
+
[source]
358
+
----
359
+
2025-06-27T16:02:34.647Z catalog info Read 5 Keycloak users and 3 Keycloak groups in 0.4 seconds. Committing... class="KeycloakOrgEntityProvider" taskId="KeycloakOrgEntityProvider:default:refresh" taskInstanceId="db55c34b-46b3-402b-b12f-2fbc48498e82" trace_id="606f80a9ce00d1c86800718c4522f7c6" span_id="7ebc2a254a546e90" trace_flags="01"
360
+
361
+
2025-06-27T16:02:34.650Z catalog info Committed 5 Keycloak users and 3 Keycloak groups in 0.0 seconds. class="KeycloakOrgEntityProvider" taskId="KeycloakOrgEntityProvider:default:refresh" taskInstanceId="db55c34b-46b3-402b-b12f-2fbc48498e82" trace_id="606f80a9ce00d1c86800718c4522f7c6" span_id="7ebc2a254a546e90" trace_flags="01"
362
+
----
363
+
364
+
. To verify {rhbk} user authentication:
365
+
.. Go to the {product-short} login page.
366
+
.. Your {product-short} sign-in page displays *Sign in using OIDC* and the Guest user sign-in is disabled.
367
+
.. Log in with OIDC by using the saved **Username** and **Password** values.
0 commit comments