Commit 7a84f1a
authored
feat: generic OIDC SSO and password-login disable flag (#152)
* feat: generic OIDC SSO and password-login disable flag
Adds support for any OpenID Connect provider (Authentik, Keycloak, Dex,
Okta, etc.) alongside the existing Google and GitHub OAuth providers, and
a new flag to enforce SSO-only login.
OIDC provider:
- New OIDC_CLIENT_ID / OIDC_CLIENT_SECRET / OIDC_DISCOVERY_URL env vars
enable any OIDC-compliant provider via goth's openidConnect backend
- OIDC_DISPLAY_NAME sets a custom label on the login button (default: SSO)
- OIDC_AUTO_CREATE_USERS=true bypasses the invite requirement in
self-hosted mode, automatically provisioning accounts and adding users
to an org on first login
- OIDC_ORG_CLAIM routes users to a named org via a custom JWT claim for
multi-org instances; falls back to the first org if absent
- OIDC_EXTRA_SCOPES requests additional scopes needed to expose custom claims
- Switched session store from CookieStore to FilesystemStore to avoid the
4096-byte cookie size limit hit by large OIDC ID tokens (e.g. Authentik)
- Providers endpoint now returns providerLabels so the frontend can show
the correct display name on the SSO button
Password-login disable flag:
- DISABLE_PASSWORD_LOGIN=true blocks POST /api/login and /api/register
with 403 and hides the email/password form on the login and register
pages; the "or" divider between SSO buttons and the form is also removed
- Login page skips the /register redirect (first-time setup) when password
login is disabled — onboarding happens through the SSO flow instead
- Register page redirects to /login immediately when password login is
disabled
* feat: expand OIDC SSO with role mapping, manual endpoints, and flash fix
Add OIDC_ROLE_CLAIM and OIDC_ROLE_MAP env vars to map IdP roles/groups
to Traceway roles on every login. Supports dot-notation paths for nested
claims (e.g. Keycloak's realm_access.roles). The highest-priority match
wins (admin > user > readonly); owner is never auto-assigned and existing
owners are protected from demotion on re-login.
Add OIDC_AUTH_URL, OIDC_TOKEN_URL, and OIDC_USER_INFO_URL as an
alternative to OIDC_DISCOVERY_URL for providers that do not expose a
well-known configuration endpoint. A short-lived local server synthesises
the discovery document at startup so the existing goth flow is unchanged.
Fix a flash on the login and register pages where the email/password form
was briefly visible before the /api/auth/providers response arrived when
password login is disabled.
Update SSO docs with Keycloak setup guide, role mapping examples
(including Authentik and generic groups claim), manual endpoint
configuration, and the new env var reference.1 parent bd9f6ea commit 7a84f1a
10 files changed
Lines changed: 869 additions & 49 deletions
File tree
- backend/app
- config
- controllers
- repositories
- services
- docs/pages/learn
- frontend/src
- lib/components
- routes
- login
- register
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
55 | 70 | | |
56 | 71 | | |
57 | 72 | | |
| |||
109 | 124 | | |
110 | 125 | | |
111 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
112 | 142 | | |
113 | 143 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
84 | 94 | | |
85 | 95 | | |
86 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| 41 | + | |
38 | 42 | | |
39 | | - | |
| 43 | + | |
40 | 44 | | |
41 | 45 | | |
42 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
43 | 55 | | |
44 | 56 | | |
45 | 57 | | |
| |||
49 | 61 | | |
50 | 62 | | |
51 | 63 | | |
52 | | - | |
| 64 | + | |
53 | 65 | | |
54 | 66 | | |
55 | 67 | | |
| |||
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
63 | | - | |
| 75 | + | |
64 | 76 | | |
65 | 77 | | |
66 | 78 | | |
| |||
80 | 92 | | |
81 | 93 | | |
82 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
83 | 100 | | |
84 | 101 | | |
85 | 102 | | |
86 | 103 | | |
87 | 104 | | |
88 | 105 | | |
89 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
90 | 136 | | |
91 | 137 | | |
92 | 138 | | |
| |||
127 | 173 | | |
128 | 174 | | |
129 | 175 | | |
130 | | - | |
| 176 | + | |
| 177 | + | |
131 | 178 | | |
132 | 179 | | |
133 | 180 | | |
| |||
152 | 199 | | |
153 | 200 | | |
154 | 201 | | |
| 202 | + | |
155 | 203 | | |
156 | 204 | | |
157 | 205 | | |
| |||
271 | 319 | | |
272 | 320 | | |
273 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
274 | 346 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
47 | 62 | | |
48 | 63 | | |
49 | 64 | | |
| |||
0 commit comments