duendesoftware/duende-skills/identityserver-spaces
Claude Code and agent skill by duendesoftware/duende-skills
- community
- ext:[{"type":"plugin","description":"Custom plugin integration"}]
Checking that the SKILL.md file is still in the repository.
IdentityServer Spaces (preview, licensed add-on) for multi-tenancy: isolated configuration and operational data per space using Duende Storage pools, Duende.Spaces setup, ISpaceAdmin, origin/path space resolution, FallbackToDefault, IssuerUri constraints, what Spaces do not isolate, and how Spaces differ from Multi-Issuer and tenant acr_values hints.
Install
npx vskill@latest install duendesoftware/duende-skills/identityserver-spacesSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as duendesoftware/duende-skills/identityserver-spaces.
IdentityServer Spaces (Preview)
When to Use This Skill
- Hosting multiple isolated security domains (SaaS tenants, regions, business units) in one IdentityServer deployment
- Installing/configuring
Duende.Spaces, creating spaces withISpaceAdmin, choosing origin vs path matching - Deciding between Spaces, Multi-Issuer and the
tenant:acr hint - Reviewing what Spaces do and do not isolate
Core Principles
- A space is an isolated IdentityServer environment inside one deployment: own configuration + operational data (own clients, resources, grants, sessions, issuer), same process/code/database infrastructure. Licensed add-on; preview.
- Built on Duende Storage pools: each space maps to a storage pool (numeric pool ID) in the same database. The default space uses data pool `0`; configured spaces normally use positive IDs. A separate reserved management pool stores space definitions (match rules + assigned pool); normal requests never use it as data pool. Spaces require Duende Storage (see
identityserver-duende-storage). - IdentityServer resolves the space at the start of each request and routes all store operations to that pool.
- Docs: https://docs.duendesoftware.com/identityserver/spaces/
Spaces vs Multi-Issuer vs Tenant Hint
| Multi-Issuer | Tenant hint (acr_values=tenant:x) | Spaces | ||
|---|---|---|---|---|
| What | iss varies by host (built in, no add-on) | Client-supplied login hint | Isolated config + operational data per tenant | |
| Selected by | Request host | Client, per authorize request | Server, from origin/path | |
| Trust | - | Untrusted | Validated against configured match patterns | |
| Data isolation | None | None | Yes | |
| Issuer | Per host | Shared | One per space |
A client cannot select a space via acr_values. To target a space, set the client authority to the space's base URL (= its issuer), e.g. https://acme.example.com (origin) or https://login.example.com/t/acme (path). Inside a space the tenant hint still works for sub-tenants; prefer ISpaceContextAccessor over trusting a hint when the space already identifies the tenant.
Setup
Middleware placed after UseSpaceResolution can use ISpaceContextAccessor.GetSpaceId().
Creating Spaces
Use ISpaceAdmin from a trusted provisioning/admin path. Make it idempotent: query by name first, run from one deployment process (avoid query/create races).
This space requires both origin and path to match: https://login.example.com/t/acme/.well-known/openid-configuration resolves to Acme's pool.
- Moving a space to another pool changes which data it sees; deleting is a soft delete (pool data blocked but retained;
ISpaceAdmin.UndeleteAsyncrestores the space and its rules). Authorize and audit pool reassignment/deletion as security-boundary changes (break-glass).
Resolving Requests
Match by origin (dedicated host; include scheme and non-default port), path segment (shared host; default /t prefix: /acme → /t/acme, middleware moves it into PathBase), or both. Origin claims take precedence so a path can't route a request away from a space that owns the host.
- Requests with the space prefix but no matching space →
404. Other unmatched requests →404too, unlessFallbackToDefault = true(serves the default space). Only enable fallback if that's an intentional isolation decision; strict 404 is safer. - Only accept forwarded headers from known proxies: an untrusted forwarded host/proto can select a different security boundary.
- Never trust a client-supplied space identifier without the resolution middleware validating it against a configured match pattern. Authorize admins per space.
Issuer
Spaces rely on issuer inference from request origin + path base, which gives each space its own iss. Leave `IdentityServerOptions.IssuerUri` unset: a fixed value makes every space return the same issuer/iss (data and discovery endpoints still differ). Same rule for Multi-Issuer.
UI and Application Services
Login/consent/logout/error pages are shared and run within the resolved space (reading that space's stores). No per-space UI/branding: inject ISpaceContextAccessor into scoped UI services, read SpaceId, and load your own space settings. User databases and other services are not space-aware unless they use the shared IStorageFactory.
Duende User Management uses the same storage factory: profiles, authenticators, roles and groups are stored per space by default. For a shared global user directory use a deliberately separate architecture (no opt-out switch for only User Management).
What Spaces Do NOT Isolate
Spaces isolate persisted data only. Review and decide separately for: signing credentials (shared credentials reduce cryptographic separation; scope them per space if your trust model requires), ASP.NET Core Data Protection, external caches, telemetry, rate limits, custom services, email delivery, user databases not using IStorageFactory.
Multiple Storage Instances
Spaces management data and every space's pool live in the default Duende Storage instance unless categories are mapped elsewhere; with multiple instances a category resolves to its instance first, then to the space's pool in that instance's database. See identityserver-duende-storage.
High Availability
Every instance must resolve the same issuer per host/space: keep proxy host names and path bases stable (see identityserver-deployment).
Common Pitfalls
- ❌ Setting
IssuerUri→ ✅ leave unset. - ❌
UseSpaceResolution()afterUseRouting()or beforeUseForwardedHeaders()→ ✅ forwarded headers → space resolution → routing. - ❌
FallbackToDefault = trueby default → ✅ keep strict 404 unless intentional. - ❌ Trusting forwarded headers from any source → ✅
KnownProxies/KnownNetworks. - ❌ Assuming shared signing keys/Data Protection/caches are per-space → ✅ review explicitly.
- ❌ Using
acr_values=tenant:to select a space → ✅ set authority to the space URL. - ❌ Non-idempotent provisioning from several instances → ✅ query-then-create from one process.
Related Skills
identityserver-duende-storage— required storage layer and poolsidentityserver-ui-flows— tenant hints, login/logout pagesidentityserver-deployment— proxies, forwarded headers, HAidentityserver-usermanagement— per-space user dataidentityserver-configuration— Multi-Issuer / issuer options
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/identityserver-spaces/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
pluginCustom plugin integration
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/duendesoftware/duende-skills/identityserver-spaces)