Add the following entries to your /etc/hosts
file
127.0.0.1 id.rust.test api.rust.test apps.rust.test
The example uses TLS where possible, therfore we need custom certificates.
We use mkcert to automatically generate certs for the example environment.
Run the following command to generate the certs:
mkcert -cert-file ./certs/rust.test.pem -key-file ./certs/rust.test-key.pem -install id.rust.test api.rust.test apps.rust.test
Keycloak is used as OAuth2 Authorization Server and OpenID Provider.
cd keycloak; docker compose -f keycloak/docker-compose.yml up
Login via https://id.rust.test:8443/auth with admin/admin
.
Switch to the playground
realm that was automatically generated during startup.
The playground realm contains the following custom clients:
web-frontend-spa
accessible via https://apps.rust.test:4443/web-frontend-spa/
You can login with the following users:
tester
with passwordtest
A public client that uses the authorization code flow with PKCE for authentication. The frontend can also access the APIs provided by resource server with an access token.
Run with cd apps/web-frontend-spa; cargo run
The resource servers provide a simple "me" endpoint that return user data contained in the access token.
Run with cd apps/api-actix; cargo run
Run with cd apps/api-rocket; cargo run
Run with cd apps/cli-device-flow-plain; cargo run
Run with cd apps/cli-device-flow-oauth2; cargo run