This folder sets up a local authentication server using Keycloak for development and testing purposes.
Start the development environment using Docker Compose from the root folder
Once running, access Keycloak Admin UI at: ➡️ http://localhost:5555 Login with:
- Username: admin
- Password: admin
To configure a web client and an API client, follow the official guide: Keycloak - Getting Started with Docker
To include the correct aud (audience) claim in your tokens:
- Go to Client Scopes in the Keycloak Admin UI.
- Click Create to add a new client scope (e.g.,
audience-api). - Navigate to the Mappers tab of the client scope.
- Click Create.
- Set Mapper Type to
Audience. - Set Included Client Audience to your target client ID (e.g.,
api-client). - Enable Add to access token and Add to ID token.
- Click Save.
- Go to Clients, select the client that should include this audience.
- Open the Client Scopes tab.
- Add your new client scope as either Default or Optional.
💡 This ensures the
audfield in the JWT token includes the specified client audience (e.g.,api-client), which is commonly required for API-side JWT validation.
You can verify that your Keycloak server is correctly issuing tokens (including checking the aud claim) by using Keycloak's official test app:
TODO