feat(auth): Entra sign-in with MSAL beside GitHub (step 5c) - #8
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Adds @azure/msal-browser 5.21.0 with the v5 redirect bridge (auth-redirect.html as a second Vite entry), an EntraClient interface in src/lib/entra.ts with a fake for tests, and a SessionProvider that runs both providers behind one status machine: Entra is the primary sign-in, GitHub stays unchanged until the cutoff. The API client takes a credential (GitHub token or Entra token getter), 403 guest_not_allowed joins the non-member status, 401 github_auth_retired and an expired Entra session become notices on the landing, and a SunsetBanner shows the API's githubAuthSunset for GitHub sessions. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…tHub cutoff Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
nuqs's react-router adapter reads window.location.search, which is empty under HashRouter because the query lives inside the fragment, so /sign-in?provider=github started the Entra sign-in. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Collaborator
Author
|
Sunset checks (dev,
Also fixed on this branch since the description was written: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 5c of the ATK Azure build-out (
docs/Direction.mdin the monorepo): an Entra sign-in with MSAL beside the existing GitHub sign-in, Entra as the primary option, and the API's GitHub-auth sunset signals surfaced. Nothing changes for GitHub sessions, and no environment has a sunset date set.What changed
@azure/msal-browser5.21.0 (pinned, no msal-react) behind anEntraClientinterface insrc/lib/entra.ts, withcreateFakeEntraClient()for tests. Auth-code + PKCE redirect flow through the v5 redirect bridge:auth-redirect.htmlis a second Vite entry whose only script callsbroadcastResponseToMainFrame(), so the hash router is re-entered at the route that started sign-in and never sees#code=. Constants in code (tenant,ES ATK Webclient id, API scope); no newVITE_*variables.SessionProviderruns both providers behind one status machine: startup awaitsinitialize()+handleRedirectPromise()before reporting anything butverifying;signIn(provider, returnPath?); per-schemesignOut(Entra:logoutRedirect, ends the Microsoft web session); anoticestore (entra_expired,github_auth_retired,sign_in_failed) shown on the landing;403 guest_not_allowedjoinsnon-member;401 github_auth_retiredkeeps the API's message verbatim.SessionUseris now the/meprincipal andtokenleft the context (nothing read it).{ scheme: 'github', token }or{ scheme: 'entra', getToken }); the Entra getter callsacquireTokenSilenton every request and turns an interaction-required failure into a 401session_expiredthat ends the session (never an interactive flow inside a request). New 401/403 texts./sign-instarts Entra,/sign-in?provider=githubGitHub;SunsetBannerunder the header for GitHub sessions withgithubAuthSunset("Switch now", dismiss per tab);RequireAuthlabel "Checking your access…"; per-scheme not-authorized copy; author pre-fill from the display name for Entra users; publish permission text./menow typesid,email,githubAuthSunset); docs (docs/deployment.md§2.4/2.5,PROJECT_OVERVIEW.md§7,.env.example).Registration change already applied to
ES ATK Web: the twoauth-redirect.htmlSPA redirect URIs, the localhost URIs corrected to include/agentic-toolkit-web/(Vite serves the base path in dev too), and thelogin_hintoptional ID-token claim.Verification
pnpm lint && pnpm typecheck && pnpm test && pnpm buildclean (341 tests;dist/auth-redirect.htmlemitted;pnpm devserves it at/agentic-toolkit-web/auth-redirect.html)./#/bundlesback to/#/bundleswith the UPN in the header and no "GitHub" wording; reload keeps the session; a new tab shows the landing and the Emergent button completes without a prompt; browse, asset detail with files,.skilldownload (200, zip), bundle detail; Contribute dry run (planprBody"Published by Jason Paff (jasonp@emergentsoftware.net) via Entra"); one real publish: registry PR EmergentSoftware/agentic-toolkit-registry#313 opened by JasonPaff, commit authored as Jason Paff jasonp@emergentsoftware.net, publisher line present, closed unmerged. Sign out → Microsoft → landing signed out (clean URL), the Emergent button prompts again and a fresh sign-in returns to the app. GitHub: sign in →/auth/callback→ member, Contribute dry run ("@JasonPaff via GitHub"), author pre-fill "JasonPaff".github_auth_retiredin the browser and the live check on Pages: see the PR comments.🤖 Generated with Claude Code