Skip to content

Commit

Permalink
Minor improvements in security-openid-connect-client guide
Browse files Browse the repository at this point in the history
Signed-off-by: Harald Albers <[email protected]>
  • Loading branch information
albers committed Oct 4, 2022
1 parent 007ea98 commit fe61084
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions docs/src/main/asciidoc/security-openid-connect-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public class ProtectedResource {

As you can see `ProtectedResource` returns a name from both `userName()` and `adminName()` methods. The name is extracted from the current `JsonWebToken`.

Next lets add REST Client with `OpenID Connect Client Reactive Filter` and another REST Client with `OpenID Connect Token Propagation Filter`, `FrontendResource` will use these two clients to call `ProtectedResource`:
Next let's add a REST Client with `OpenID Connect Client Reactive Filter` and another REST Client with `OpenID Connect Token Propagation Filter`. `FrontendResource` will use these two clients to call `ProtectedResource`:

[source,java]
----
Expand Down Expand Up @@ -266,7 +266,7 @@ public class FrontendResource {

`FrontendResource` will use REST Client with `OpenID Connect Client Reactive Filter` to acquire and propagate an access token to `ProtectedResource` when either `/frontend/user-name-with-oidc-client-token` or `/frontend/admin-name-with-oidc-client-token` is called. And it will use REST Client with `OpenID Connect Token Propagation Reactive Filter` to propagate the current incoming access token to `ProtectedResource` when either `/frontend/user-name-with-propagated-token` or `/frontend/admin-name-with-propagated-token` is called.

Finally, lets add a JAX-RS `ExceptionMapper`:
Finally, let's add a JAX-RS `ExceptionMapper`:

[source,java]
----
Expand Down Expand Up @@ -431,17 +431,17 @@ Now use this token to call `/frontend/user-name-with-propagated-token` and `/fro

[source,bash]
----
curl -v -X GET \
http://localhost:8080/frontend/user-name-with-propagated-token` \
curl -i -X GET \
http://localhost:8080/frontend/user-name-with-propagated-token \
-H "Authorization: Bearer "$access_token
----

will return `200` status code and the name `alice` while

[source,bash]
----
curl -v -X GET \
http://localhost:8080/frontend/admin-name-with-propagated-token` \
curl -i -X GET \
http://localhost:8080/frontend/admin-name-with-propagated-token \
-H "Authorization: Bearer "$access_token
----

Expand All @@ -463,37 +463,37 @@ and use this token to call `/frontend/user-name-with-propagated-token` and `/fro

[source,bash]
----
curl -v -X GET \
http://localhost:8080/frontend/user-name-with-propagated-token` \
curl -i -X GET \
http://localhost:8080/frontend/user-name-with-propagated-token \
-H "Authorization: Bearer "$access_token
----

will return `200` status code and the name `admin`, and

[source,bash]
----
curl -v -X GET \
http://localhost:8080/frontend/admin-name-with-propagated-token` \
curl -i -X GET \
http://localhost:8080/frontend/admin-name-with-propagated-token \
-H "Authorization: Bearer "$access_token
----

will also return `200` status code and the name `admin`, as `admin` has both `user` and `admin` roles.


Now lets check `FrontendResource` methods which do not propagate the existing tokens but use `OidcClient` to acquire and propagate the tokens. You have seen that `OidcClient` is configured to acquire the tokens for the `alice` user, so:
Now let's check `FrontendResource` methods which do not propagate the existing tokens but use `OidcClient` to acquire and propagate the tokens. You have seen that `OidcClient` is configured to acquire the tokens for the `alice` user, so:

[source,bash]
----
curl -v -X GET \
http://localhost:8080/frontend/user-name-with-oidc-client-token`
curl -i -X GET \
http://localhost:8080/frontend/user-name-with-oidc-client-token
----

will return `200` status code and the name `alice`, but

[source,bash]
----
curl -v -X GET \
http://localhost:8080/frontend/admin-name-with-oidc-client-token`
curl -i -X GET \
http://localhost:8080/frontend/admin-name-with-oidc-client-token
----

will return `403` status code.
Expand Down

0 comments on commit fe61084

Please sign in to comment.