Files
sor/Server
d5363fa014 Add Keycloak authentication via Authorization Code + PKCE
- auth.proto: add ExchangeKeycloakToken RPC + request/response messages
- KeycloakOptions: binds Keycloak:Authority + Keycloak:ClientId from config
- KeycloakTokenValidator: validates Keycloak JWTs via OIDC discovery/JWKS;
  extracts sub, email, preferred_username, realm_access.roles
- AuthGrpcHandler.ExchangeKeycloakToken:
  - validates JWT and requires "player" realm role
  - lazy-migrates existing accounts by email on first Keycloak login
  - creates new passwordless accounts from Keycloak claims
  - syncs preferred_username → DisplayName on every login
  - single-session policy: revokes prior sessions before issuing SOR token
- AuthGrpcHandler.Register: assign "player" role to all new registrations
- ServiceRegistration: wire KeycloakOptions + KeycloakTokenValidator as singleton
- Admin SeedAsync: seed player, moderator, card_builder roles alongside Admin/SuperAdmin
- IGatewayAuthValidator / GatewayAuthValidator: add ExchangeKeycloakTokenAsync
- ConnectionLoop: handle auth.keycloak message type → auth.keycloak.ack
- appsettings.json: add Keycloak section (Authority + ClientId, overridable via env)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-02 14:27:32 -04:00
..