Skip to content

Commit

Permalink
docs(example): add components and diagram to docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
SafeEval committed Jul 21, 2024
1 parent 7e50381 commit e6e9711
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions examples/docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,43 @@ make stop
```

When the containers are up, browse to [http://ui-app.localhost](http://ui-app.localhost). There are a few controls:
- Login: redirects to the IdP (Keycloak). Login with `alice`:`password`.
- Call API: sends a GET request to http://api.localhost/json, which
- **Login**: redirects to the IdP (Keycloak). Login with `alice`:`password`.
- **Call API**: sends a GET request to http://api.localhost/json, which
requires authentication. If the UI app has a token, it will be used.
- Logout: call JWT block, blocking the token from making future
- **Logout**: call JWT block, blocking the token from making future
authenticated calls.
- Clear State: clears the tokens from the UI app.
- **Clear State**: clears the tokens from the UI app.

## Components

There are four small hosts and a proxy in this example.
1. `http://ui-app.localhost`
- A static web UI loaded into the browser with demo controls.
- This app has the OIDC login flow callback.
- Logout will call the JWT Block service to add the access token to the blocklist.
1. `http://keycloak.localhost`
- A Keycloak instance used as an OIDC identity provider.
- The web app will redirect here for user login.
- The demo user is `alice`:`password`.
1. `http://api.localhost`
- A protected httpbin instance web service behind authentication.
- This requires a valid access token that is not in the blocklist.
1. `http://jwtblock.localhost`
- A JWT Block instance.
- Nginx will defer to this service for authentication decisions (`auth_request` directive).
- If the JWT is invalid or is in the blocklist then it returns HTTP 401.
- This also has the "logout" endpoint, where an access token is added to the blocklist.

```mermaid
graph TD
WebUI["Web UI \n(html/js)"]
WebProxy["Web Proxy \n(nginx)"]
AuthProxy["Auth Proxy \n(jwtblock)"]
APIService["Web API \n(httpbin)"]
IdentityProvider["OpenID IdP \n(keycloak)"]
WebUI --> WebProxy
WebProxy --> IdentityProvider
WebProxy --> AuthProxy
WebProxy --> APIService
```

0 comments on commit e6e9711

Please sign in to comment.