Overview
Keycloak provides:- JWT token generation - Issue tokens for authenticated users
- User management - Pre-configured users with different roles
- Realm administration - Full IdP configuration capabilities
- Standards compliance - OIDC and OAuth 2.0 support
Access
- URL: http://localhost:8085
- Port: 8085 (mapped from container port 8080)
- Realm:
krakend
Pre-Configured Users
The playground includes two users with different roles:| Username | Password | Role |
|---|---|---|
| moderator | moderator | Moderator role with elevated permissions |
| reader | reader | Reader role with limited permissions |
These users are pre-configured in the
krakend realm and ready to use for testing JWT authentication.Admin Console
To manage users, roles, and realm configuration:- Visit http://localhost:8085/admin/master/console/#/krakend/users
- Login with admin credentials:
admin/admin - Select the
krakendrealm from the dropdown - Manage users, roles, clients, and other settings
JWT Token Validation
KrakenD validates JWT tokens issued by Keycloak on protected endpoints. For example:How It Works
- User authenticates with Keycloak
- Keycloak issues a JWT token
- Client sends the token to KrakenD in the
Authorizationheader - KrakenD validates the token signature using Keycloak’s public keys
- KrakenD checks required roles/claims
- Request proceeds if valid, or returns 401/403 if invalid
Configuration Persistence
Exporting Configuration
If you create new users, roles, or configurations that you want to keep:config/keycloak/realms/, which is mounted as a volume and will be imported on the next container start.
Make sure the Keycloak container is running before executing the save command.
Realm Configuration
The Keycloak instance uses:- Import on startup - Automatically imports realm config from
config/keycloak/realms/ - Development mode - Runs with
start-devfor easier testing - Volume mount - Configuration files at
./config/keycloak/realms:/opt/keycloak/data/import
Using with the Demo App
The playground includes a Single Page Application at http://localhost:3000 that:- Integrates with Keycloak for authentication
- Obtains JWT tokens
- Makes authenticated requests to KrakenD
- Demonstrates the complete authentication flow