Skip to content

Commit d3cccc5

Browse files
authored
Merge pull request #121 from redhat-developer-demos/disable-oidc-reactive
disable oidc and reactive for now
2 parents 900e234 + 92e42b1 commit d3cccc5

5 files changed

Lines changed: 45 additions & 33 deletions

File tree

19.9 KB
Loading

documentation/modules/ROOT/nav.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
** xref:health.adoc[Health Check]
1616
** xref:metrics.adoc[Metrics]
1717
** xref:security.adoc[Security with JWT RBAC]
18-
** xref:security-oidc.adoc[Security using OpenID Connect]
18+
// ** xref:security-oidc.adoc[Security using OpenID Connect]
1919
20-
* Reactive
21-
** xref:reactive.adoc[Reactive with Mutiny]
22-
** xref:reactive-messaging.adoc[Streaming reactive messages]
23-
** xref:kafka-and-streams.adoc[Apache Kafka with Reactive Streams]
20+
// * Reactive
21+
// ** xref:reactive.adoc[Reactive with Mutiny]
22+
// ** xref:reactive-messaging.adoc[Streaming reactive messages]
23+
// ** xref:kafka-and-streams.adoc[Apache Kafka with Reactive Streams]

documentation/modules/ROOT/pages/metrics.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,10 @@ for i in {1..5}; do curl -w '\n' localhost:8080/time; done
125125

126126
== Check the metrics
127127

128-
By default the metrics are exposed in Prometheus format. You can check the output by pointing your browser to http://localhost:8080/q/metrics[window=_blank]
128+
By default the metrics are exposed in Prometheus format. You can check the output by pointing your browser to http://localhost:8080/q/metrics[window=_blank]. See if you can find the TimeResource counter result.
129+
130+
[.mt-4.center]
131+
image::Timed_Resource.png[Micrometer Timed Resource,800,100,align="left"]
132+
133+
NOTE: In this tutorial we consulted the results in raw format, however these metrics are meant to be consumed by a monitoring system such as Prometheus so you can produce meaningful dashboards or alerts instead of accessing the metrics endpoint directly.
129134

documentation/modules/ROOT/pages/panache.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ curl localhost:8080/fruit?season=Summer
430430

431431
== Using Repository instead of ActiveRecord pattern
432432

433-
Is `PanacheEntity` too opinionated for you? Maybe you prefer the traditional *Repository* pattern? Don't worry: we got you covered.
433+
Is `PanacheEntity` too opinionated for you? Maybe you prefer the traditional *Repository* pattern? Don't worry: we've got you covered.
434434

435435
Panache also helps you to create Repositories.
436436

documentation/modules/ROOT/pages/security-oidc.adoc

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ In this section we will secure our endpoints with Bearer Tokens by using Dev Ser
99

1010
== Add the OIDC and KeyCloak extensions
1111

12-
Just open a new terminal window, and make sure youre at the root of your `{project-name}` project, then run:
12+
Just open a new terminal window, and make sure you're at the root of your `{project-name}` project, then run:
1313

1414
[tabs]
1515
====
@@ -37,24 +37,30 @@ quarkus extension add quarkus-oidc quarkus-keycloak-authorization
3737
== Working with DevServices for KeyCloak
3838
Quarkus introduced an experimental *Dev Services For Keycloak* feature which is enabled by default when the `quarkus-oidc` extension is started in dev mode. It starts a Keycloak container and initializes it by registering the existing Keycloak realm or creating a new realm with the client and users for you to start developing your Quarkus application secured by Keycloak immediately.
3939

40-
When working in Dev Mode, you can use Dev Services for KeyCloak. This is the easy way to locally test your KeyCloak authentication.
40+
When working in Dev Mode, you can use Dev Services for KeyCloak. This is an easy way to locally test your KeyCloak authentication.
4141

42-
Simply go to http://localhost:8080/q/dev/[Dev UI] and select the OpenId Connect Card linking to a Keycloak page.
42+
Let's define a static port for the KeyCloak dev service so you can copy/paste the links further down in this section. Add the following line to your application.properties:
43+
[.console-input]
44+
[source,bash,subs="+macros,+attributes"]
45+
----
46+
quarkus.keycloak.devservices.port=34000
47+
----
4348

44-
Click on the http://localhost:8080/q/dev/io.quarkus.quarkus-oidc/provider[Provider: Keycloak link] and you will see a Keycloak page which will be presented slightly differently depending on how Dev Services for Keycloak feature has been configured.
49+
Now go to the http://localhost:8080/q/dev-ui/dev-services[Dev UI - Dev Services]. You will see a 'keycloak' section with information about the running Keycloak Dev Services container, including auth server url and some default oidc users.
4550

4651
TIP: By default, `alice` and `bob` users (with the passwords matching the names), and user and admin roles are created.
4752
`alice` has both admin and user roles, and `bob` has just the user role.
4853

49-
However, we can add our own user, role and group by following these steps:
54+
We can add our own user, role and group in KeyCloak by following these steps:
5055

51-
. Click on http://localhost:55105/auth[KeyCloak Admin link] in the left corner.
52-
. Login using `admin' as user and password.
56+
. Go to the http://localhost:34000/admin/master/console/[KeyCloak Administration console] and use `admin' as user and password.
5357
. Go to https://raw.githubusercontent.com/redhat-developer-demos/quarkus-tutorial/master/jwt-token/quarkus-realm.json and save it on your local machine.
54-
. Go to http://localhost:55105/auth/admin/master/console/#/realms/quarkus/partial-import[Import] in the KeyCloak Administration console and import `quarkus-realm.json`.
55-
After this step you should have `Subscriber` Role and Group.
56-
. Go to http://localhost:55105/auth/admin/master/console/#/realms/quarkus/users[Users] and check that `jdoe` user is mapped to the `Subscriber` role and group.
57-
. Setup a password for `jdoe` user.
58+
. Go to the http://localhost:34000/admin/master/console/#/quarkus/realm-settings['quarkus' Realm Settings]
59+
. Click on 'Action' in the top right and select Partial Import.
60+
. Browse to the `quarkus-realm.json` you downloaded and select all resources to import. Then also select "Overwrite" when it asks "If a resource already exists, specify what should be done:"
61+
After this step you should have a `Subscriber` Role and Group.
62+
. Go to 'Users' in the left menu and click on 'jdoe' and then on the 'Role Mapping' tab and check that the `jdoe` user is correctly mapped to the 'Subscriber' role.
63+
. Reset the password for the 'jdoe' user in the Credentials settings to 'jdoepass'.
5864

5965
Congratulations! Now you can run this section in Dev Mode without starting the KeyCloak container nor adding the KeyCloak setup in `application.properties`.
6066
[WARNING]
@@ -108,15 +114,17 @@ First you need a token valid to authenticate. Run the following command to obtai
108114
[.console-input]
109115
[source,bash]
110116
----
111-
curl -X POST 'http://localhost:56006/auth/realms/quarkus/protocol/openid-connect/token' \ #<1>
112-
-H "Content-Type: application/x-www-form-urlencoded" \
113-
-d "username=jdoe" \
114-
-d 'password=the_pass_you_set' \ #<2>
115-
-d 'grant_type=password' \
116-
-d 'client_id=admin-cli'
117+
curl -X POST 'http://localhost:34000/realms/quarkus/protocol/openid-connect/token' \
118+
-H 'Content-Type: application/x-www-form-urlencoded' \
119+
-d 'username=jdoe' \
120+
-d 'password=jdoepass' \
121+
-d 'grant_type=password' \
122+
-d 'client_id=admin-cli'
117123
----
118-
<1> If you are using KeyCloak Dev Services, you can get the KeyCloak port from Quarkus logs.
119-
<2> Consider to replace the password here with the one you set in the beginning.
124+
[IMPORTANT]
125+
--
126+
<1> Replace the KeyCloak port with the current value of the dev service container port (this is the same as the one in the url you were using to set up KeyCloak).
127+
--
120128

121129
You should see an output similar to:
122130

@@ -131,17 +139,16 @@ Below you can find details on how to do that using `curl` and `jq`:
131139
[.console-input]
132140
[source,bash]
133141
----
134-
token=$(curl -X POST 'http://localhost:56006/auth/realms/quarkus/protocol/openid-connect/token' \
135-
-H "Content-Type: application/x-www-form-urlencoded" \
136-
-d "username=jdoe" \
137-
-d 'password=jdoe' \
138-
-d 'grant_type=password' \
139-
-d 'client_id=admin-cli' | jq -r '.access_token')
142+
token=$(curl -X POST 'http://localhost:34000/realms/quarkus/protocol/openid-connect/token' \
143+
-H 'Content-Type: application/x-www-form-urlencoded' \
144+
-d 'username=jdoe' \
145+
-d 'password=jdoepass' \
146+
-d 'grant_type=password' | jq -r '.access_token')
140147
141148
curl -H "Authorization: Bearer $token" localhost:8080/api/users/info
142149
----
143150

144-
And youll see the response for the given token:
151+
And you'll see the response for the given token:
145152

146153
[.console-output]
147154
[source,text]

0 commit comments

Comments
 (0)