Commit 2f095b2
authored
fix: pass OIDC default env vars to meridian container (#1259)
* feat: enable Dex OIDC authentication for demo environment
Replace fake JWT workarounds with real Dex OIDC authentication.
The backend now gracefully handles standard OIDC tokens by falling
back to the sub claim for user ID and applying configurable defaults
for tenant ID and roles when custom Meridian claims are absent.
Backend:
- Add Email/Name OIDC fields and EffectiveUserID() to Claims
- Add DEFAULT_TENANT_ID and DEFAULT_ROLES env vars to gateway config
- JWT middleware injects configured defaults for missing claims
- Wire defaults through CombinedAuthMiddleware to JWTMiddleware
Frontend:
- parseJWT accepts standard OIDC tokens (sub fallback, array aud)
- Login page with email/password form using Dex password grant
- Dev-only fake JWT buttons preserved for local development
- Demo mode defaults to platform lens for DevTenantAutoSelector
Dex config:
- Real bcrypt hashes for admin@volterra.energy and operator@volterra.energy
- Password: demo2026
* fix: store effective claims object in context for platform-admin bypass
TenantAuthorizationMiddleware checks claims.HasRole() on the Claims
object stored in context. The previous approach stored default roles
only as context values, making them invisible to the authorization
check. Fix by creating a shallow copy of claims with effective values
(UserID, TenantID, Roles) applied, then storing the copy in context.
This ensures platform-admin default role is visible when
DEFAULT_ROLES=platform-admin is configured with empty
DEFAULT_TENANT_ID, enabling cross-tenant access for demo users.
* fix: pass DEFAULT_TENANT_ID and DEFAULT_ROLES to meridian container
These env vars were defined in .env but not listed in the
docker-compose.yml environment section, so they were never
passed to the container. Also update .env.demo.example to
document the new vars and enable AUTH_ENABLED=true by default.
* fix: trim whitespace from DEFAULT_TENANT_ID env var
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>1 parent 0272d07 commit 2f095b2
3 files changed
Lines changed: 13 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 71 | + | |
| 72 | + | |
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
| |||
92 | 91 | | |
93 | 92 | | |
94 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
95 | 102 | | |
96 | 103 | | |
97 | 104 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
| 269 | + | |
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| |||
0 commit comments