A containerized Identity Management demo featuring a Keycloak instance and a Vanilla JS Single Page Application (SPA) demonstrating OIDC authentication flows.
This project demonstrates how to integrate a client-side application with Keycloak for secure authentication using the OpenID Connect (OIDC) protocol. It consists of:
- Keycloak Server: Running in a Docker container, configured via
docker-compose.yaml. - Demo SPA: A simple JavaScript application (
demo-app/) that performs login, logout, and displays user token details.
docker-compose.yaml: Defines the Keycloak service configuration.demo-app/: Source code for the Single Page Application.app.js: Main logic for Keycloak integration.index.html: UI for the demo.
server.crt.pem&server.key.pem: SSL certificates for secure communication.
Run the Keycloak Identity Provider using Docker Compose:
docker compose up -dAccess the Keycloak Admin Console at http://localhost:8080 (Default credentials: admin/admin).
You will need to set up the following resources (see demo-app/README.md for detailed steps):
- Realm: Create a realm named
demo-realm. - Client: Create a client named
demo-spa(Public, Standard Flow enabled).- Web Origins:
http://localhost:5500(or the URL where your app is running).
- Web Origins:
- User: Create a test user with credentials.
Navigate to the demo-app directory and start a local web server (e.g., using Python or Node.js):
cd demo-app
python3 -m http.server 5500Open http://localhost:5500 in your browser.
For more detailed instructions on the client application and specific Keycloak configuration steps, please refer to the Demo App README.