Skip to content

feat(samples): add the MSAL authentication extensions demo - #948

Merged
kazo0 merged 1 commit into
masterfrom
dev/sb/msal-extensions-demo
Aug 26, 2026
Merged

kazo0 merged 1 commit into
masterfrom
dev/sb/msal-extensions-demo

Conversation

@kazo0

@kazo0 kazo0 commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Adds UI/Authentication.MsalExtensionsDemo, a single-project Uno app demonstrating Uno.Extensions MSAL authentication across Desktop, WebAssembly, Android and iOS.

What it demonstrates

MSAL's hard parts are the ones you cannot see from the outside: which redirect URI a head actually uses, what the app registration has to say about it, and where the token cache lives. The app surfaces each of those.

  • Flow log — narrates every IAuthenticationService call as it happens: the silent startup refresh, interactive sign-in, token summaries, sign-out. The order of operations a production app follows becomes readable rather than inferred.
  • Platform setup page — what each head needs and why: the redirect-URI convention per platform and the registration platform type it must be filed under (WebAssembly must be a single-page application or browser-side redemption fails with AADSTS90023), the Android intent-filter scheme, the iOS CFBundleURLTypes entry, and the keychain-access-groups entitlement without which MSAL cannot write its token cache and sign-in ends in missing_entitlements.
  • Sign in page — shows the exact redirect URI the running head will use, which is the string that has to match the registration.
  • Graph call (User.Read) — proves the acquired token actually works, rather than stopping at "sign-in returned true".
  • Redact switch — hides everything identifying the app registration or the signed-in user, so the app can be screen-shared or recorded.

Configuration

Standard appsettings pattern: client ID and tenant go in appsettings.development.json. The committed file carries an empty ClientId — with none configured the app starts and explains what is missing rather than throwing, which is also what makes it safe to commit. Platforms/Android/MsalActivity.Android.cs keeps the existing all-zeros GUID placeholder for the intent-filter scheme; the ReadMe covers both.

Packages

Everything resolves from the public feeds already configured in the repo root NuGet.config — no local feed, no sibling checkout to arrange:

Uno.Sdk 6.8.0-dev.23
UnoExtensionsVersion 7.4.0-dev.29

7.4.0-dev.29 carries the MSAL token-cache and redirect work the demo relies on — verified against the resolved assembly: MsalStorageDefaults, GetMacKeychainServiceName, AllowUnprotectedTokenCacheFallback and MsalRedirectDefaults are all present.

One known gap: that version predates the macOS keychain-prompt fix (uno.extensions#3166), so on macOS the demo still raises three keychain-access prompts at every launch — MsalCacheHelper.VerifyPersistence() probing with a keychain entry whose service name MSAL randomizes each run, which is why "Always Allow" never sticks. Bumping UnoExtensionsVersion once that ships takes it to zero. It does not affect the demo's correctness on any platform, only how noisy macOS startup is.

Verification

Clean restore and build against the public feeds only, with obj/ and bin/ removed first:

dotnet restore   →  Uno.Extensions.Authentication.MSAL.WinUI/7.4.0-dev.29
dotnet build -f net10.0-desktop  →  0 warnings, 0 errors

That also confirms the sample is self-contained — nothing it needs was left behind on the branch it was split from.

The desktop head has been run end to end on macOS (sign-in, Graph call, silent refresh across restart, sign-out).

Notes for reviewers

  • Branched fresh off master rather than split from the working branch, so the development history (and a real client ID that had been committed there) stays out of this one. Single commit, 84 files, all new.
  • The working branch's HANDOFF-MACOS.md is deliberately excluded — an internal handoff document, not sample material.
  • Sibling OIDC and Web demos exist on the same working branch and are not included here; this PR is the MSAL demo only.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RhtkcHHpbm6XiDagFY6VaS

A single-project Uno app demonstrating Uno.Extensions MSAL authentication
across Desktop, WebAssembly, Android and iOS, built to make the parts that
are usually invisible visible.

- A flow log narrates every IAuthenticationService call - the silent startup
  refresh, interactive sign-in, token summaries, sign-out - so the order of
  operations a real app follows is readable as it happens.
- A Platform setup page explains what each head needs and why: the redirect
  URI convention per platform and the app-registration platform type it must
  be registered under (WebAssembly must be a single-page application), the
  Android intent-filter scheme, the iOS CFBundleURLTypes entry, and the
  keychain-access-groups entitlement without which MSAL cannot write its
  token cache.
- The Sign in page shows the exact redirect URI the running head will use,
  which is the value that has to match the registration.
- A Graph call (User.Read) proves the acquired token actually works.
- A Redact switch hides everything identifying the app registration or the
  signed-in user, so the app can be screen-shared or recorded.

Configuration follows the appsettings pattern: put the client ID and tenant
in appsettings.development.json. The committed file carries an empty
ClientId - with none configured the app starts and explains what is missing
rather than throwing.

Packages come from the public feeds: Uno.Sdk 6.8.0-dev.23 and
UnoExtensionsVersion 7.4.0-dev.29, both resolved from the uno dev feed in
the repo root NuGet.config. That version carries the MSAL token-cache and
redirect work the demo relies on, so there is no local feed and no sibling
checkout to arrange.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01RhtkcHHpbm6XiDagFY6VaS
@kazo0
kazo0 force-pushed the dev/sb/msal-extensions-demo branch from 4c26247 to b1bacfd Compare August 26, 2026 14:48
@kazo0
kazo0 marked this pull request as ready for review August 26, 2026 15:01
@kazo0
kazo0 merged commit acfc6ed into master Aug 26, 2026
9 checks passed
@kazo0
kazo0 deleted the dev/sb/msal-extensions-demo branch August 26, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant