One Identity Across Eight Domains: Designing .keshavsingh.in SSO with .NET 10, Passkeys & Dynamic CORS
How we unified Admin, AnimStudio AI, Hindu Panchang, Pratiyogita, Social Analytics, Ghar Ledger, and Content Blog around a single identity provider (id.keshavsingh.in) with FIDO2 passkeys, replay-safe refresh rotation, and zero hardcoded CORS wildcards.
- A wildcard CORS rule on *.keshavsingh.in creates subdomain-takeover blast radius if DNS outlives an old service.
- Scoped apps validate symmetric HS256 JWTs issued by id.keshavsingh.in without maintaining separate password databases.
- WebAuthn RelyingPartyId is pinned to keshavsingh.in while login ceremonies remain restricted to explicit origin allowlists.
Why Multiple Independent Logins Break Multi-App Ecosystems
When a digital ecosystem grows from one site into eight specialized applications, duplicating user tables across every database quickly turns into a maintenance trap. Password resets drift out of sync, audit logs fragment across separate services, and users hesitate to register again on a sibling tool they only plan to test for two minutes.
Rather than embedding local login screens inside Pratiyogita, Hindu Panchang, Ghar Ledger, or AnimStudio AI, we separated authentication cleanly. A single .NET 10 identity service running on id.keshavsingh.in owns password verification, two-factor challenges, FIDO2 passkeys, and short-lived access tokens. Every sibling website acts strictly as a stateless resource server validating tokens issued under a shared issuer and audience contract.
Preventing Subdomain Takeover With Explicit Origin Validation
Sharing an HTTP-only refresh cookie across .keshavsingh.in requires disciplined cross-origin controls. Because credentialed CORS responses tell the browser to carry the shared session cookie, admitting an unconstrained wildcard rule across every subdomain would let any forgotten CNAME or retired test deployment inherit session authority.
Our DynamicEcosystemCorsPolicyProvider combines startup config origins with active records in MongoDB website registry metadata, enforcing HTTPS scheme checks and exact origin comparisons in production.
| Layer | Host | Primary Responsibility | Session State |
|---|---|---|---|
| Central Identity API | id.keshavsingh.in | Passwords, OTP, FIDO2 Passkeys, Token Rotation | Mongo refresh_tokens |
| Admin Workspace | admin.keshavsingh.in | RBAC grants, Website Registry, Global i18n Seeds | Bearer JWT + Cookie |
| AnimStudio AI | studio.keshavsingh.in | Storyboards, FFmpeg renders, Channel scheduling | JWT Validation Only |
| Ghar Ledger | ghar.keshavsingh.in | Household vendor entries mapped to SSO sub ID | JWT Validation Only |
Handling Multi-Tab Refresh Races Safely
In modern browser apps, a visitor often keeps two ecosystem tabs open side by side. If both tabs notice an expired access token at the exact same millisecond and fire simultaneous refresh calls, naive token rotation flags the second request as replay theft and revokes the user session.
Inside sibling frontends like AnimStudio AI, refresh POST calls opt out of blind HTTP retry loops and serialize concurrent browser-tab refresh attempts using the Web Locks API where supported, while preserving clean cookie domain upgrades on matching production hosts.
- Never auto-retry state-changing refresh POST calls in transient HTTP failure interceptors.
- Bind FIDO2 RelyingPartyId to keshavsingh.in once, but allowlist exact ceremony Origins only.
- Serve non-secret cross-site configuration through public GET /api/config so UI shells never drift.