Add OIDC auth support#279
Conversation
|
Thanks for this PR. What OIDC provider is good to test with? Also how can I control which users have the administrator role vs the user role? |
|
Another thing I noticed is that See this line as an example of how LDAP does it. The web UI should also be modified to use |
|
Thanks for the detailed feedback @brian7704. it was very helpful. I’ve now revalidated the flow end to end against a real Authelia setup, and that worked well, so I’d recommend Authelia as a good provider to test with. It was straightforward to run locally, supports discovery metadata and For administrator vs user, the mapping is controlled through the OIDC claim settings:
For example: OTS_OIDC_ROLE_CLAIM=groups
OTS_OIDC_ADMIN_ROLES=ots-admin
OTS_OIDC_DEFAULT_ROLES=user With that setup:
One nuance is that if the provider does send explicit groups/roles, those are synced on login. So for non-admin users you either want no role claim at all, so they fall back to OTS_OIDC_DEFAULT_ROLES=user, or you want user I also made a few follow-up changes after the initial PR:
On your last point: you were right about that integration. In our original setup, we were using the reverse proxy in front of OTS to send the user into the correct OIDC flow, so I didn’t run into the missing SECURITY_USER_IDENTITY_ATTRIBUTES / web UI integration right away. Now that At the moment, if both LDAP and OIDC are enabled, the UI prefers OIDC when oidc is present. That matches the original reverse-proxy-driven use case on our side |
Summary
This PR adds the first OpenID Connect (OIDC) implementation to OpenTAKServer for browser-based single sign-on.
It introduces OIDC login/callback endpoints, local user synchronization, configurable claim mapping, PKCE support, and a conservative default configuration so existing deployments remain unaffected unless OIDC is explicitly
enabled.
What this adds
GET /api/oidc/loginGET /api/oidc/callbackOTS_OIDC_METADATA_URL), orissuer + subjectS256for public clients when no client secret is configuredS256PKCE for confidential clients as wellSecurity / identity behavior
OIDC users are linked to local accounts by
issuer + subject, not by email.This avoids relying on mutable claims for identity association and gives OpenTAKServer a stable external identity to bind to.
The callback flow also:
no-storeresponse headersConfiguration / compatibility notes
OTS_ENABLE_OIDCis enabledImplementation notes
The implementation uses
flask-oidcinternally while keeping OpenTAKServer-owned routes so OTS can continue to control:Testing
OIDC tests were unified into:
tests/test_oidc_api.pyDocumentation
brian7704/OpenTAKServer-docs#18