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: documentation/modules/ROOT/pages/index.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
@@ -7,4 +7,4 @@
7
7
8
8
Red Hat Build of Keycloak enables you to secure your web applications by providing Web SSO capabilities based on popular standards such as OpenID Connect, OAuth 2.0, and SAML 2.0.
9
9
10
-
IMPORTANT: This is not an official guide or workshop provided by Red Hat. For more information on trainingor guidelines related to this topic or product, please reach out to your designated Red Hat representative.
10
+
IMPORTANT: This is not an official guide or workshop provided by Red Hat. For official training, documentation, or guidance related to this product, please contact your designated Red Hat representative.
* Repeat the same steps for creating a user named `elisabeth` but assign the `assistant` role. Also, remember to incude the user in the `Personal staff` group.
83
+
* Repeat the same steps to create a user named `elisabeth`, assigning the `assistant` role and adding the user to the `Personal staff` group.
84
84
85
85
[#quarkus-apps]
86
86
== Securing Web Applications
87
87
88
-
The sample application that we will use in this section is the `Quarkus Petclinic project`.
88
+
The sample application used in this section is the `Quarkus Petclinic` project.
89
89
90
-
In this tutorial, we will work with a version that has been modified for the tutorial.
90
+
In this tutorial, we will work with a version that has been modified for demonstration purposes.
At this point, we have the `demo` realm with the `quarkus-petclinic` client; additionally, we created two roles and two users: the user `angel` that has the `vet` role and the user `elisabeth` that has the role `assistant`.
138
+
At this point, we have the `demo` realm with the `quarkus-petclinic` client. We also created two roles and two users:
139
+
the user `angel` with the `vet` role, and the user `elisabeth` with the `assistant` role.
139
140
140
-
* The authorization granularity that we want to configure based on our application is the following:
141
-
** Any user that belongs to the `demo` realm, like `elisabeth`, can browse the application except the `VETERINARIANS` resource.
142
-
** Only the users with the role `vet` can view the `VETERINARIANS` resource (which has the `/vets.html` context).
143
-
** Any other user access outside the realm will be rejected.
141
+
* The authorization granularity we want to configure in our application is as follows:
142
+
** Any user that belongs to the `demo` realm, like `elisabeth`, can browse the application except for the `VETERINARIANS` resource.
143
+
** Only users with the `vet` role can view the `VETERINARIANS` resource (which corresponds to the `/vets.html` path).
144
+
** Any user outside the realm will be denied access.
144
145
145
146
image::authservices/quarkus-petclinic-menu.png[]
146
147
147
148
Let's configure our client authorization.
148
149
149
-
* Open a browser window and log in to the Red Hat build of Keycloak administration web console. Browse to our `quarkus-petclinic` client and click the `Authorization` and then `Policies` tabs.
150
+
* Open a browser window and log in to the Red Hat build of Keycloak administration console.
151
+
Browse to the `quarkus-petclinic` client and click the `Authorization` tab, then the `Policies` tab.
150
152
151
153
image::authservices/client4.png[]
152
154
153
-
* Click `Create policy`, select `Group`.
155
+
* Click `Create policy` and select `Group`.
154
156
155
157
image::authservices/client5.png[]
156
158
157
-
* Set `Default Group Policy` as the `Name`. Add the `staff` group to the `Groups` list. Make sure that the `Logic` is set to `Positive` and `Extend to Children` is checked (to enable the checkbox, you may need to click `Save` first). Finally, click `Save`.
159
+
* Set `Default Group Policy` as the `Name`.
160
+
Add the `staff` group to the `Groups` list.
161
+
Ensure that the `Logic` is set to `Positive` and that `Extend to Children` is checked (to enable it, you may need to click `Save` first).
162
+
Finally, click `Save`.
158
163
159
164
image::authservices/client6.png[]
160
165
161
-
* Come back, select the `Resources` tab and click `Create Permission` for the `Default Resource`.
166
+
* Go back, select the `Resources` tab, and click `Create permission` for the `Default Resource`.
162
167
163
168
image::authservices/client7.png[]
164
169
165
-
* Set `Default Resource Permission` as `Name` and select `Default Resource` as `Resources`. Add the recently created `Default Group Policy` policy. Click `Save`.
170
+
* Set `Default Resource Permission` as the `Name` and select `Default Resource` as the `Resource`.
171
+
Add the previously created `Default Group Policy` and click `Save`.
166
172
167
173
image::authservices/client8.png[]
168
174
169
-
* Come back again, select the `Resources` tab and create a new resource by clicking on `Create resource`.
175
+
* Go back again, select the `Resources` tab, and click `Create resource`.
170
176
171
177
image::authservices/client9.png[]
172
178
173
-
* Set `Vets Resource` as `Name` and `Display name`, and `/vets.html` as URI. Click `Save`.
179
+
* Set `Vets Resource` as both the `Name` and `Display name`, and `/vets.html` as the `URI`. Click `Save`.
174
180
175
181
image::authservices/client10.png[]
176
182
177
-
* Browse to `Authorization` and `Policies` tabs. Click on `Create Policy`.
183
+
* Navigate to the `Authorization` → `Policies` tab and click `Create policy`.
178
184
179
185
image::authservices/client11.png[]
180
186
181
-
* Select `Role`
187
+
* Select `Role`.
182
188
183
189
image::authservices/client12.png[]
184
190
185
-
* Set `Vet Role Policy` as the Name, `vet` as `Realm Roles`, and check required. Click `Save`.
191
+
* Set `Vet Role Policy` as the `Name`, select `vet` under `Realm Roles`, check `Required`, and click `Save`.
186
192
187
193
image::authservices/client13.png[]
188
194
189
-
* Browse to the `Authorization` and `Resources` tabs.
195
+
* Navigate to the `Authorization` → `Resources` tab.
190
196
191
-
* Click on `Create Permission` for the `Vets Resource`.
197
+
* Click `Create permission` for the `Vets Resource`.
192
198
193
199
image::authservices/client14.png[]
194
200
195
-
* Set `Vets Resource Permission` as `Name`. And apply the `Vet Role Policy`. Click `Save`.
201
+
* Set `Vets Resource Permission` as the `Name` and apply the `Vet Role Policy`. Click `Save`.
196
202
197
203
image::authservices/client16.png[]
198
204
199
205
At this point, the Red Hat build of Keycloak client is properly configured.
200
206
201
207
Let's configure the application side.
202
208
203
-
* Open a browser window and log in to the Red Hat build of Keycloak administration web console. Browse to our `quarkus-petclinic` client and click the `Credentials` tab. Write down the `Secret` value, we will need it soon.
209
+
* In the Keycloak administration console, browse to the `quarkus-petclinic` client and click the `Credentials` tab.
210
+
Write down the `Secret` value — you will need it soon.
** Browse to the context root of the Quarkus Petclinic application. The request will be redirected to the Red Hat Single Sign-On login page. Here, we checked that the anonymous access to the application is forbidden.
262
+
** Browse to the context root of the Quarkus Petclinic application. The request should be redirected to the Red Hat Single Sign-On login page — confirming that anonymous access is blocked.
256
263
** Log in as `elisabeth`. The request will be redirected to the application after a successful login.
257
-
** Browse through the application, try to access the VETERINARIANS section. The access should be denied, as `elisabeth` has the `assistant` role and the access is restricted to the `vet` role. An error will be shown on the application page.
258
-
** Close the browser and open a new one incognito session.
259
-
** Visit the context root of the application again.
260
-
** Login as `angel`.
261
-
** Browse through the application, try to access the VETERINARIANS section. The access should be granted, as `angel` has the `vet` role.
264
+
** Browse the application and try to access the *VETERINARIANS* section. Access should be denied since`elisabeth` has the `assistant` role and this resource is restricted to users with the `vet` role.
265
+
** Close the browser and open a new incognito session.
266
+
** Visit the context root again.
267
+
**Log in as `angel`.
268
+
** Browse the application and try to access the *VETERINARIANS* section. This time, access should be granted since`angel` has the `vet` role.
262
269
263
-
NOTE: A complete OIDC working Petclinic Quarkus application is available at `rhbk-oidc-22` branch.
270
+
NOTE: A complete OIDC-enabled Quarkus Petclinic application is available in the`rhbk-oidc-22` branch.
0 commit comments