Skip to content

feat: add OIDC authentication support for Go services#170

Draft
boehlke wants to merge 5 commits intoOpenSlides:mainfrom
kryptance:feature/keycloak-oidc
Draft

feat: add OIDC authentication support for Go services#170
boehlke wants to merge 5 commits intoOpenSlides:mainfrom
kryptance:feature/keycloak-oidc

Conversation

@boehlke
Copy link

@boehlke boehlke commented Feb 19, 2026

Summary

  • Add OIDCValidator with JWKS discovery and token validation for Keycloak bearer tokens
  • Add UserLookup to resolve keycloak_id to OpenSlides user ID via PostgreSQL
  • Extend auth.New() to accept optional *pgxpool.Pool for OIDC user resolution (backward-compatible variadic parameter)
  • Support OIDC environment variables (OIDC_ENABLED, OIDC_ISSUER_URL, etc.)
  • Include unit tests for OIDC validation

Context

This is the foundational library change for adding Keycloak OIDC authentication to all Go-based OpenSlides services. The auth.New() signature change is backward-compatible (variadic pool parameter), so existing callers continue to work without modification.

Related PRs (part of Keycloak OIDC integration):

  • openslides-autoupdate-service: OIDC logout + theme endpoint
  • openslides-vote-service: pass DB pool to auth
  • openslides-icc-service: pass DB pool to auth
  • openslides-search-service: pass DB pool to auth

Test plan

  • Unit tests included for OIDC token validation
  • Integration test with Keycloak instance via make dev oidc
  • Verify backward compatibility: services not passing pool still work

🤖 Generated with Claude Code

@ostcar
Copy link
Member

ostcar commented Feb 23, 2026

I made changes but could not push them into your PR. I pushed them here instead: https://github.com/OpenSlides/openslides-go/tree/feature/keycloak-oidc

@boehlke boehlke force-pushed the feature/keycloak-oidc branch 4 times, most recently from fb92ee2 to 0e3dd68 Compare March 4, 2026 13:14
@boehlke boehlke force-pushed the feature/keycloak-oidc branch from 0e3dd68 to 03c1e1d Compare March 9, 2026 08:09
boehlke and others added 2 commits March 9, 2026 10:20
- Add OIDCValidator with JWKS discovery and token validation
- Add UserLookup to resolve keycloak_id to OpenSlides user ID via PostgreSQL
- Extend auth.New() to accept optional *pgxpool.Pool for OIDC user resolution
- Support OIDC environment variables (OIDC_ENABLED, OIDC_ISSUER_URL, etc.)
- Include unit tests for OIDC validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NewOIDCValidator now takes 3 args (issuerURL, internalIssuerURL, clientID).
Update all test call sites to pass issuerURL as both external and internal URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@boehlke boehlke force-pushed the feature/keycloak-oidc branch from 03c1e1d to 6b339dd Compare March 9, 2026 11:34
@boehlke boehlke force-pushed the feature/keycloak-oidc branch from 6b339dd to 6a2c3e9 Compare March 9, 2026 12:21
@boehlke boehlke changed the base branch from feature/relational-db to main March 11, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants