Skip to content

feat(skills): add uno-authentication hub - #182

Merged
kazo0 merged 19 commits into
mainfrom
feat/uno-authentication-skill
Oct 30, 2026
Merged

kazo0 merged 19 commits into
mainfrom
feat/uno-authentication-skill

Conversation

@kazo0

@kazo0 kazo0 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Refs #178

Summary

Adds uno-authentication, a hub skill for Uno.Extensions.Authentication. It has a short SKILL.md and nine references that load only when needed, each under the 6,000-character budget.

Reference Covers
custom.md Login against the app's own API with AddCustom/AddCustom<TService>, and a local prototype check
msal.md Microsoft Entra ID and B2C sign-in with AddMsal(window)
msal-platforms.md MSAL redirect URIs, the Android activity, the iOS URL scheme and keychain, the WebAssembly spa platform
oidc.md Any OpenID Connect provider with AddOidc: configuration, code options, Google, logout and cancellation behaviour
oidc-platforms.md The OIDC redirect per head: Android activity scheme, iOS CFBundleURLTypes, the WebAssembly callback
oidc-desktop.md OIDC and Web sign-in on the Skia desktop head: which Uno.Extensions version has the loopback broker, how to opt in, the loopback redirect URI, the pre-dev.135 workaround
web.md A backend that redirects back with tokens, with AddWeb
flow.md The start page by sign-in state, login and logout Models, LoggedOut, optional sign-in
http.md Tokens on Refit and Kiota calls, refresh on 401, NoRefresh, cookies, reading tokens

For a new app the skill starts from dotnet new unoapp -preset recommended -auth <custom|msal|oidc|Web>, then has the agent fix the gaps in the generated code. It also registers the hub everywhere the others are listed:

  • the uno-platform router and its new-app section;
  • uno-build-app, including the -auth flag in new-app.md;
  • the uno-dev agent, in both its Markdown and Codex files;
  • the READMEs, plugin.json and the marketplace descriptions.

What the rules are grounded in

Every behaviour claim was checked against the decompiled Uno.Extensions 8.0.0-dev.85 packages (the version Uno.Sdk 7.0.0-dev.77 pins) and the Uno.Templates 7.0.0-dev.77 output, then re-checked where 8.0.0-dev.135 changed them; the Web guidance was re-checked against 8.0.0-dev.150 and Uno.Templates 7.0.0-dev.115. The main ones:

  • Login returns tokens only. The user counts as signed in while any token is stored, and whatever Login returns is persisted.
  • Handle LoggedOut once, for the life of the app. It fires on logout, on a failed refresh, and on a 401 that a refresh can't fix.
  • Only Uno-registered clients get the token (AddRefitClient, AddKiotaClient, AddClient).
  • Mark the refresh endpoint with NoRefresh.
  • Provider traps: Web needs LogoutStartUri to sign out; OIDC needs offline_access to stay signed in across restarts; any OIDC code option replaces the whole configuration section; MSAL takes the window and a dispatcher, and a RedirectUri in appsettings replaces the per-platform defaults on every head.
  • Desktop (Skia) OIDC/Web sign-in is version-gated. Uno.Extensions 8.0.0-dev.135 (feat(auth): sign in on Skia Desktop with a loopback WebAuthenticationBroker for the Oidc and Web providers uno.extensions#3261) makes AddOidc and AddWeb register a loopback WebAuthenticationBroker, sends the cached ID token as id_token_hint on sign-out, and surfaces app cancellation as OperationCanceledException. Uno.Sdk 7.0.0-dev.95 and later pin a version that has it (7.0.0-dev.113+ pin 8.0.0-dev.150). oidc-desktop.md gives the version check, the opt-in for an older Sdk (UnoExtensionsVersion plus Uno.Sdk 7.0.0-dev.89), the Debug-only Uno.WinUI.Lottie reference still needed through at least Uno.Sdk 7.0.0-dev.115 ([Navigation] Uno.Extensions.Navigation.Toolkit still references Uno.UI.Lottie, so Recommended apps on Uno.Sdk 7.0.0-dev.89 fail to initialize (FileNotFoundException) uno.extensions#3262), the first-registration ordering rule, and the IBrowser workaround for older versions.

How it was tested

  • .github/scripts/Test-Plugin.ps1 passes; claude plugin validate --strict and agentskills validate passed on the earlier revisions.
  • The MSAL guidance was reconciled with UI/Authentication.MsalExtensionsDemo in Uno.Samples.
  • The OIDC guidance was dogfooded by building UI/Authentication.OidcExtensionsDemo in Uno.Samples from the skill alone (unoplatform/Uno.Samples branch dev/sb/oidc-extensions-demo), recording every place the skill was wrong, and fixing it. The sample runs end to end against the Duende demo server on desktop (Skia), WebAssembly, Android and an iOS 18.5 simulator. Desktop, WebAssembly and iOS were re-run against the published Uno.Extensions 8.0.0-dev.135.
  • The Web guidance was dogfooded the same way by building UI/Authentication.WebExtensionsDemo (unoplatform/Uno.Samples branch dev/sb/web-extensions-demo, with its own ASP.NET Core backend) from dotnet new unoapp -preset recommended -auth Web -server on Uno.Sdk 7.0.0-dev.115. Verified end to end on desktop (Windows), WebAssembly and an Android API 36 emulator: sign-in, the state check refusing a forged loopback callback, 401 → Refresh → retry, silent sign-in after a restart, sign-out, and both refresh failure modes (backend down, refresh token rejected). That pass fixed the stale version gate, the WebAssembly callback, the AddWeb<TService> requirement for a state check, the Refresh exception semantics, and LogoutAsync clearing the tokens whatever the browser returned. iOS was then verified on an iPhone 16 simulator (iOS 18.5).
  • The Custom guidance was dogfooded by building UI/Authentication.CustomExtensionsDemo (unoplatform/Uno.Samples branch dev/sb/custom-extensions-demo, with its own backend) from dotnet new unoapp -preset recommended -auth custom -server, keeping the Kiota client the template ships. Verified on desktop, WebAssembly and Android: a wrong password failing the sign-in, Login storing only the tokens, 401 → Refresh → retry through Kiota with the No-Refresh header, silent sign-in after a restart, sign-out revoking the refresh token, a rejected refresh ending the session without a loop, and a failing Logout callback still clearing the tokens. That pass added the Kiota specifics to http.md and the exception semantics to custom.md. iOS was then verified on an iPhone 16 simulator (iOS 18.5).

Not done:

Upstream

🤖 Generated with Claude Code

https://claude.ai/code/session_01Sn8GmJ41W3eBgT7866J3jV
https://claude.ai/code/session_01PZQ75jhwM9sq6XMMnSCUEt

@kazo0

kazo0 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio rebase

Agents asked for sign-in wrote their own auth service and token
storage. The new hub routes them to Uno.Extensions.Authentication:
custom, MSAL, OIDC and web providers, the login/logout navigation
flow, and the access token on Refit and Kiota clients.

Its critical rules cover what the docs and the 6.8 template get wrong,
checked against the Uno.Extensions 7.4 source: the custom template
stores the password with the tokens, the recommended template never
handles LoggedOut, Refit needs HttpRefit (not Http), the OIDC option is
AutoRedirectUriFromWebAuthenticationBroker, and the Android redirect
activities use a placeholder scheme.

The router, uno-build-app, the uno-dev agent, the READMEs and the
manifest descriptions now list the hub.

Refs #178

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0174z2Vobf7pXT4VUMUZxczA
@mergify

mergify Bot commented Oct 9, 2026

Copy link
Copy Markdown

rebase

✅ Branch has been successfully rebased

@kazo0
kazo0 force-pushed the feat/uno-authentication-skill branch from e0593fd to edabf8e Compare October 9, 2026 15:59
kazo0 and others added 2 commits October 14, 2026 20:32
- flow.md: subscribe to LoggedOut after the first navigation. A
  RefreshAsync that cannot renew stored tokens clears them and raises
  LoggedOut, so the earlier subscription sent an expired session to the
  login page twice.
- msal.md, msal-platforms.md: use a <client-id> placeholder instead of
  a real-looking GUID that agents would copy into apps.
- http.md: the Refit section name drops every leading I or i
  (IIdentityApi reads "dentityApi"); pass name: to AddRefitClient then.

Refs #178

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018n3XbSQngpLmbiRhN6cLNu
kazo0 and others added 11 commits October 23, 2026 12:37
…L keeps its platform redirect URIs

Re-checked every claim against the versions main targets instead of the
6.8/7.4 line the skill was written on: the public auth, HTTP, Refit and Kiota
API of Uno.Extensions 8.0.0-dev.85 decompiled next to 7.4.0-dev.103 (no
difference), and one app per `-auth` value generated with Uno.Templates
7.0.0-dev.77 (every template gap the skill lists is still there). What changed:

- MSAL: the template's `appsettings.development.json` sets
  `RedirectUri: myprotocol://auth`, and every Debug build loads it. The skill
  said to replace `myprotocol` everywhere; a configured `RedirectUri` is
  `ConfigurationSupplied` in `MsalRedirectDefaults.Apply` and skips the
  per-platform defaults on every head, so that broke iOS, WebAssembly and
  desktop. The rule is now to delete the key from both appsettings files.
- MSAL: `KeychainSecurityGroup`, which the template writes, binds to nothing
  in `MsalConfiguration` or MSAL's `PublicClientApplicationOptions`; say so and
  point at the entitlements and `WithIosKeychainSecurityGroup`.
- OIDC: the description promised Google; `oidc.md` now covers its two traps.
  Google's discovery document has no `end_session_endpoint`, so `LogoutAsync`
  throws after the tokens are cleared (OidcClient 6.0.1 `EndSessionAsync`, and
  `AuthenticationService.LogoutAsync` clears then rethrows), and its redirect
  URI rules differ per client type.
- Version lines moved to Uno.Extensions 8.0.0-dev.85 / Uno.Sdk 7.0.0-dev.77 /
  Uno.Templates 7.0.0-dev.77.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sn8GmJ41W3eBgT7866J3jV
… keeps the MSAL Android and iOS scheme fixes

Google accepts a custom-scheme redirect as the reverse DNS of a domain you
control or of the client ID, not only the latter. The MSAL critical rule now
says the Android activity and Info.plist still get their schemes; only the
appsettings `RedirectUri` key is deleted rather than filled.

Also verified since the previous commit: the parameterless
`EmbeddedSource<App>()` adds `appsettings.<environment>.json` (so the Debug
build reads the development file), `UnoUIApplicationDelegate` and
`UseUIApplicationDelegate<T>` exist in Uno.WinUI.Runtime.AppleUIKit
7.0.0-dev.2332, and the custom-login, `LoggedOut` and `LoginModel` snippets
build on the desktop head of an app generated with Uno.Templates 7.0.0-dev.77
with no warnings.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sn8GmJ41W3eBgT7866J3jV
… MSAL sample

Checked against Uno.Samples/UI/Authentication.MsalExtensionsDemo, the sample
the skill names as its reference. The sample confirms the appsettings
`RedirectUri` deletion and that no configuration key sets the iOS keychain
group. What it corrected:

- Android registers `msal{ClientId}://auth` as a custom redirect URI under
  Mobile and desktop applications, not under the portal's Android option
  (which generates the broker `msauth://{package}/{hash}` form); iOS uses the
  iOS/macOS option with the bundle ID; WinAppSDK registers
  `ms-appx-web://microsoft.aad.brokerplugin/{ClientId}`.
- `MsalActivity` uses `LaunchMode.SingleTop`, as the template and sample do.
- The registration needs Allow public client flows; `TenantId` must match the
  supported account types (`consumers` is personal accounts only).
- WebAssembly: the popup must not be blocked, no Cross-Origin-Opener-Policy,
  and the host rewrites `/authentication-callback` to `index.html`; wrong
  platform type fails with AADSTS90023.
- iOS: an incremental build can skip `Info.plist` and `Entitlements.plist`
  edits; delete bin/obj for the iOS target after changing them.
- `InteractiveTimeout` `00:00:00` waits forever; `TokenAsync` is null after
  sign-out.

To stay under the reference budget, the `OnActivityResult` snippet the
template already contains is now one sentence, and the Mac Catalyst note
lives only in msal.md.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sn8GmJ41W3eBgT7866J3jV
…e Uno.Samples OIDC sample

Dogfooded the skill by building UI/Authentication.OidcExtensionsDemo on
Uno.Sdk 7.0.0-dev.77 against the Duende demo server, desktop and Android
verified end to end. What the skill got wrong or left out:

- Skia desktop: Uno's WebAuthenticationBroker is not implemented there, so
  AddOidc's default browser throws NotImplementedException and LoginAsync
  returns false. The app has to register its own IBrowser with a loopback
  listener. New reference oidc-platforms.md carries this, with the Android
  intent-filter and iOS CFBundleURLTypes snippets.
- Code configuration replaces the whole OidcAuthentication section rather
  than overriding one value (Settings.Options ?? Configuration.Get(name)), so
  a per-platform redirect override goes through configuration.
- LogoutAsync sends no id_token_hint or state, waits up to 300 s for a
  post-logout redirect most identity providers will not send without the
  hint, and then clears the tokens whatever the browser returned. flow.md no
  longer claims a cancel path that keeps the tokens for OIDC.
- The docs search phrase for OIDC returned the pre-Extensions IdentityModel
  guide; the reference now names the Uno.Extensions how-to paths.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sn8GmJ41W3eBgT7866J3jV
…er shipped in Uno.Extensions 8.0.0-dev.135

AddOidc and AddWeb now register DesktopWebAuthenticationBrokerProvider on desktop
(uno.extensions#3261, published as 8.0.0-dev.135), the OIDC provider sends the cached
ID token as id_token_hint on every head, and app cancellation surfaces as
OperationCanceledException. No Uno.Sdk pins dev.135 yet, so the guidance is
version-gated: a new references/oidc-desktop.md holds the version check, the opt-in
(UnoExtensionsVersion plus Uno.Sdk 7.0.0-dev.89, the Debug-only Uno.WinUI.Lottie
reference for uno.extensions#3262), the loopback redirect URI, the first-registration
ordering rule, logging, and the pre-dev.135 IBrowser workaround. oidc-platforms.md,
oidc.md, web.md, flow.md and SKILL.md point at it and drop the claims the fix made
wrong. Verified by running the Uno.Samples OIDC sample on desktop and WebAssembly
against the published package.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sn8GmJ41W3eBgT7866J3jV
kazo0 and others added 5 commits October 30, 2026 13:50
…eb sample; Uno.Sdk 7.0.0-dev.95+ pins the desktop broker

Dogfooded the skill by building UI/Authentication.WebExtensionsDemo in
Uno.Samples from dotnet new unoapp -preset recommended -auth Web -server on
Uno.Templates/Uno.Sdk 7.0.0-dev.115, verified on desktop, WebAssembly and
Android. What the skill got wrong or left out:

- Version gate: Uno.Sdk 7.0.0-dev.95 and later pin Uno.Extensions
  8.0.0-dev.147+ (7.0.0-dev.113+ pin dev.150), so desktop sign-in needs no
  UnoExtensionsVersion override there. The Debug-only Uno.WinUI.Lottie
  workaround is still needed on 7.0.0-dev.115 (Uno.UI.HotDesign 2.0.0-dev.31);
  without it the desktop app hangs with no window rather than throwing.
- web.md: a state check needs AddWeb<TService>, the only PostLogin that gets
  the callback URL. On WebAssembly the Web provider sends the configured
  callback (unlike AddOidc), so it has to be set to the broker's callback
  through configuration. Without Refresh, RefreshAsync reports success while
  tokens exist; a Refresh callback that throws makes RefreshAsync throw with
  the tokens kept, which the template's InitialNavigate does not catch.
  LogoutAsync clears the tokens whatever the browser returned. Fragment
  responses work on desktop. Adds the docs paths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PZQ75jhwM9sq6XMMnSCUEt
…a Custom sample with Kiota

Dogfooded by building UI/Authentication.CustomExtensionsDemo in Uno.Samples
from dotnet new unoapp -preset recommended -auth custom -server on
Uno.Sdk 7.0.0-dev.115, with the Kiota client the template ships, verified on
desktop, WebAssembly and Android. custom.md held up; what it lacked:

- The recommended template uses Kiota, but custom.md only showed Refit.
  http.md now gives the Kiota no-refresh header (request configuration), the
  Kiota error type (ApiException.ResponseStatusCode), and how to regenerate
  the checked-in client after an API change.
- LogoutAsync clears the tokens and raises LoggedOut before rethrowing a
  Logout callback's exception; RefreshAsync keeps them.
- The docs walkthrough's Refit example also returns the credentials
  dictionary (storing the password) and lists only the Http feature.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PZQ75jhwM9sq6XMMnSCUEt
@kazo0
kazo0 merged commit ff792e2 into main Oct 30, 2026
6 checks passed
@kazo0
kazo0 deleted the feat/uno-authentication-skill branch October 30, 2026 21:35
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.

2 participants