- New auth module verifies Keycloak access tokens offline against the realm's signing keys (issuer, RS256, typ=Bearer, allowed azp); guests are recognised by the guest realm role - Clients send an auth message after connecting and get on_auth or on_auth_error; unauthenticated sockets are closed after 5 seconds and their messages ignored; a socket can refresh its token but not switch user - A user can be connected from several sockets; a late close of an old socket no longer drops the new one - Malformed messages are ignored instead of throwing - Games store player names and guest flags and send them with the connection info - Legacy ?userKey= clients and /register stay available behind LEGACY_USERKEY_AUTH; legacy keys must be UUIDs so they cannot take a Keycloak user's kc: id - TypeScript target raised to es2020 for async/await
52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
services:
|
|
backend:
|
|
image: jhalitaksoy/mancala-backend:latest
|
|
environment:
|
|
# Must match the iss claim, i.e. the public Keycloak URL; https://auth.playmancala.app/realms/mancala in production
|
|
KEYCLOAK_ISSUER: ${KEYCLOAK_HOSTNAME:-http://localhost:8080}/realms/mancala
|
|
# Fetch keys over the compose network instead of the public URL
|
|
KEYCLOAK_JWKS_URL: http://keycloak:8080/realms/mancala/protocol/openid-connect/certs
|
|
KEYCLOAK_CLIENT_IDS: mancala-web
|
|
LEGACY_USERKEY_AUTH: ${LEGACY_USERKEY_AUTH:-true}
|
|
ports:
|
|
- "5000:6000"
|
|
frontend:
|
|
image: jhalitaksoy/mancala-frontend:latest
|
|
ports:
|
|
- "3000:3000"
|
|
keycloak-db:
|
|
image: postgres:17.6
|
|
environment:
|
|
POSTGRES_DB: keycloak
|
|
POSTGRES_USER: keycloak
|
|
POSTGRES_PASSWORD: ${KEYCLOAK_DB_PASSWORD:?set KEYCLOAK_DB_PASSWORD in apps/.env}
|
|
volumes:
|
|
- keycloak-db:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U keycloak -d keycloak"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
keycloak:
|
|
image: jhalitaksoy/mancala-keycloak:latest
|
|
build: ./keycloak
|
|
environment:
|
|
KC_DB_URL: jdbc:postgresql://keycloak-db:5432/keycloak
|
|
KC_DB_USERNAME: keycloak
|
|
KC_DB_PASSWORD: ${KEYCLOAK_DB_PASSWORD}
|
|
# Public URL of Keycloak; https://auth.playmancala.app in production
|
|
KC_HOSTNAME: ${KEYCLOAK_HOSTNAME:-http://localhost:8080}
|
|
KC_HTTP_ENABLED: "true"
|
|
KC_PROXY_HEADERS: xforwarded
|
|
# Only used to create the master admin on the very first start
|
|
KC_BOOTSTRAP_ADMIN_USERNAME: ${KEYCLOAK_ADMIN_USERNAME:-admin}
|
|
KC_BOOTSTRAP_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:?set KEYCLOAK_ADMIN_PASSWORD in apps/.env}
|
|
ports:
|
|
- "127.0.0.1:8080:8080"
|
|
depends_on:
|
|
keycloak-db:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
keycloak-db:
|