sso(auth0): drive real @auth0/auth0-react SDK against mock IdP (kills __omTestAuth0 shim) - #33164
Conversation
Second half of the plan we split off from PR #31675: replace the `window.__omTestAuth0` in-page shim with the real Auth0 SPA SDK running against the mock IdP the parent PR added URL aliases to. Closes Copilot review #8 — the source is now free of an Auth0 test hook, and the Playwright leg is genuine end-to-end proof that Auth0Authenticator behaves under a live IdP round-trip. Change map: - playwright/utils/sso-providers/auth0.ts (new): configures OM with `authority = MOCK_AUTH0_DOMAIN`, `clientId = openmetadata-auth0-client`, triggers the "Sign in with Auth0" button, and waits on the app-shell. All PKCE happens inside @auth0/auth0-react — no page.evaluate patching, no seeded IndexedDB, no mint-mock-JWT helper. - playwright/utils/sso-providers/auth0-mock.ts (removed): the shim fixture is superseded — same slug (`auth0-mock`), same `--grep @auth0-mock` filter, so the CI matrix line doesn't change. - src/components/Auth/AppAuthenticators/Auth0Authenticator.tsx: dropped the `window.__omTestAuth0` runtime read + `isPlaywrightBuild()` gate entirely; `useAuth0()` is now the sole source of truth. - playwright/utils/mockOidc.ts: exports `MOCK_AUTH0_CLIENT_ID`, `MOCK_AUTH0_DOMAIN`, and `MOCK_OIDC_INTERNAL_JWKS_URL`. The internal JWKS URL uses `MOCK_OIDC_INTERNAL_URL` (docker-network container name) so OM backend can reach the mock's JWKS from inside the compose network — outside docker it collapses to the same localhost URL, so local dev is unchanged. - .github/workflows/playwright-sso-login-nightly.yml: adds a "Start Mock OIDC provider" step under `needs_docker: mock-oidc`; the auth0-mock leg is the first to use it. Attaches the mock container to `ometa_network` so OM backend can reach it by name; passes `MOCK_OIDC_URL` + `MOCK_OIDC_INTERNAL_URL` env vars to the test run; adds the `--profile sso-test down` teardown to Clean Up. Not in this commit (needs its own architectural PR): - Removing `window.__omTestMsal` and swapping msal-mock to the real @azure/msal-browser SDK. That requires teaching `updateAuthInstance` in AuthProvider.tsx to add `knownAuthorities` + `protocolMode: 'OIDC'` when the authority is non-Microsoft; the current `otherConfigs as unknown as Configuration` cast in that path is loose enough that changing it needs its own careful validation against real Azure AD deployments. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
✅ Playwright Results — workflow succeededValidated commit ✅ 812 passed · ❌ 0 failed · 🟡 1 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 55m 40s ⏱️ Max setup 4m 46s · max shard execution 19m 48s · max shard-job elapsed before upload 23m 27s · reporting 5s 🌐 239.30 requests/attempt · 2.30 app boots/UI scenario · 28.70% common-shard skew Optimization targets still in progress:
🟡 1 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…n-restart' into sso-remove-omtest-shims-followup
Code Review ✅ ApprovedRemoves the OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
| Count | Rule |
|---|---|
| 1 | openmetadata-imports/no-internal-barrel-imports |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/components/Auth/AppAuthenticators/Auth0Authenticator.tsx:23:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changed
|



Stacked on top of #31675
This PR targets the base branch of #31675 (
azure-oidc-session-invalidated-on-restart) so its diff is only the incremental changes: fully review-able in isolation, merges back into the parent PR when you're happy.Summary
Closes Copilot review finding #8 (
__omTestAuth0shim inAuth0Authenticator.tsx) by rewriting theauth0-mockPlaywright fixture to drive the real@auth0/auth0-reactSDK against the mock IdP the parent PR already extended with Auth0-shape URL aliases (7de47070342). Same fixture slug (auth0-mock), same--grep @auth0-mockfilter — no CI matrix rename.What lands
playwright/utils/sso-providers/auth0.tsauthority = MOCK_AUTH0_DOMAIN, clicks "Sign in with Auth0", waits on the app-shell. All PKCE handled by@auth0/auth0-react.playwright/utils/sso-providers/auth0-mock.tssrc/components/Auth/AppAuthenticators/Auth0Authenticator.tsxwindow.__omTestAuth0runtime read +isPlaywrightBuild()gate.useAuth0()is now the sole source of truth in every build.playwright/utils/mockOidc.tsMOCK_AUTH0_CLIENT_ID,MOCK_AUTH0_DOMAIN,MOCK_OIDC_INTERNAL_JWKS_URL..github/workflows/playwright-sso-login-nightly.ymlStart Mock OIDC providerstep underneeds_docker: mock-oidc; auth0-mock leg is the first to use it. Attaches mock container toometa_network, passesMOCK_OIDC_URL+MOCK_OIDC_INTERNAL_URLenv vars to the test run, adds--profile sso-test downto cleanup.Test evidence
Not in this PR (deserves its own)
__omTestMsalshim removal). Requires teachingupdateAuthInstanceinAuthProvider.tsxto addknownAuthorities+protocolMode: 'OIDC'when the authority is non-Microsoft; the currentotherConfigs as unknown as Configurationcast in that path is loose enough that changing it needs a dedicated PR with real Azure AD validation. Filed as follow-up.Test plan
auth0-mockgoes green on the first run against this branch.Start Mock OIDC providerstep boots cleanly,curl http://localhost:9090/healthreturns 200.docker network connect ometa_network mock_oidc_providerdoesn't error.🤖 Generated with Claude Code