duendesoftware/duende-skills/identityserver-usermanagement
Claude Code and agent skill by duendesoftware/duende-skills
- community
Checking that the SKILL.md file is still in the repository.
Setting up Duende User Management with IdentityServer: passwordless authentication (OTP, TOTP, passkeys), storage configuration, user lifecycle, and migration from ASP.NET Identity.
Install
npx vskill@latest install duendesoftware/duende-skills/identityserver-usermanagementSKILL.md
The same SKILL.md was published earlier as duendesoftware/duende-skills/identityserver-usermanagement.
User Management
When to Use This Skill
- Adding user management to a Duende IdentityServer project
- Setting up passwordless authentication (OTP, TOTP, passkeys)
- Configuring storage providers (PostgreSQL, SQL Server, SQLite)
- Integrating User Management with IdentityServer for claims and login/logout
- Managing user profiles, roles, and groups
- Migrating users from ASP.NET Identity
Core Principles
- Duende User Management is passwordless-first — OTP email/SMS is the default flow
- Requires
Duende.UserManagement.IdentityServer8NuGet package + .NET 10 - Storage is document-based (no EF migrations) but the schema is not auto-created — call
IStorageInstanceSchema.MigrateAsync()at startup or as a deployment step - Select the storage provider with
AddStorage(...)on the IdentityServer builder, not insideAddUserManagement(); OTP/authentication options go insideAddUserManagement(options => options.Authentication(...)) - Use
app.UseIdentityServer()(notUseAuthentication()separately)
Docs: https://docs.duendesoftware.com/identityserver/usermanagement
Setup
1. Add Packages
2. Configure Program.cs
3. OTP Dispatcher
Console (development): User Management ships no console dispatcher; implement IOtpDispatcher yourself:
SMTP (production):
Authentication Methods
| Method | Description | Setup | |
|---|---|---|---|
| OTP (default) | One-time codes via email/SMS | IOtpDispatcher implementation | |
| TOTP | Authenticator apps (RFC 6238) | Built-in, user enrollment required | |
| Passkeys | WebAuthn/FIDO2 phishing-resistant | Built-in, browser support required | |
| Passwords | Traditional username/password (PBKDF2) | Opt-in, not recommended as primary | |
| External | OAuth 2.0 / OIDC federated login | Standard ASP.NET Core auth handlers | |
| Recovery codes | Single-use backup codes | Auto-generated during 2FA setup |
IdentityServer Integration
AddUserManagement() is called on the IdentityServer builder — it automatically:
- Registers
IProfileServicefor claims delivery - Handles login/logout flows
- Maps user attributes to identity token claims
Claims Mapping
User profile attributes are mapped to claims based on requested scopes:
openid→subprofile→name,given_name,family_name, etc.email→email(email_verifiedis not in the built-in profile schema; add it withBuiltInSchemas.UserProfile.Extend(OidcStandardAttributes.EmailVerified)and set it, e.g.attributes.Set(AttributeCode.Create("email_verified"), true))
Custom attributes are available through custom identity resources.
Storage
User Management uses the Duende Storage layer (document-based, in a relational DB). Storage is selected with AddStorage(...) on the IdentityServer builder, not inside AddUserManagement. AddUserManagement(...) only maps the user-management data category to a storage instance.
| Provider | Package | Registration | |
|---|---|---|---|
| SQLite | Duende.Storage.Sqlite | storage.AddSqlite(o => o.ConnectionString = "..."); AddSqliteInMemory() for tests only | |
| PostgreSQL (recommended for production, native JSONB) | Duende.Storage.PostgreSql | storage.AddPostgreSql() with an NpgsqlDataSource singleton in DI; SchemaName option | |
| SQL Server | Duende.Storage.MsSql | storage.AddMsSql(o => { }) with a CreateSqlConnection singleton in DI |
- No EF Core migrations, but the common storage schema must be created:
IStorageInstanceSchema.MigrateAsync(fromIStorageInstanceSchemaFactory.GetStorageInstanceSchema(ct)). It's idempotent (advisory locks on PostgreSQL). In production run it as a separate deployment step.CheckVersionAsyncreturnsIsCompatible/CurrentVersion/RequiredVersionfor a startup compatibility check. - Shared instance: if
AddStorage(...)already registered a provider for the default instance (withAddConfigurationStorage()/AddOperationalStorage()), callAddUserManagement(...)without registering the provider again; IdentityServer and User Management share the DB and schema (different entity types). Selecting a second provider for the same instance throwsInvalidOperationException. - Dedicated database:
var umInstance = StorageInstanceId.Create("user-management");+.AddStorage(umInstance, storage => storage.AddPostgreSql(sp => sp.GetRequiredKeyedService<NpgsqlDataSource>(umInstance.Value)))+.AddUserManagement(umInstance, um => { }). Migrate that instance explicitly:GetStorageInstanceSchema(umInstance, ct). - This page's storage covers only User Management data (profiles, authenticators, roles, groups); IdentityServer config/operational data uses whichever provider you chose (EF Core, Duende Storage, ...). See
identityserver-duende-storage. - With Spaces, User Management data is stored in the resolved space's pool by default (isolated users per space); see
identityserver-spaces.
Profile Schema
Profile attributes are defined by a schema (SchemaConfiguration, SchemaId.UserProfile). AddUserManagement(...) registers BuiltInSchemas.UserProfile (email [unique, required], name, given_name, family_name; each access returns a new mutable instance). With defaults, users register and log in by email.
Extend(attributes, groups)also addsAttributeGroups; attributes getGroupCode/Order(not unique; apply a secondary sort). There is no dedicated reorder API: build/replace the schema.- Replace: register a full
SchemaConfigurationwithSchemaId.UserProfile(e.g. login by a customusernameattribute); none of the built-in attributes remain unless re-added. A schema with the sameSchemaIdas the built-in always wins; registration order relative toAddUserManagementdoesn't matter; the last registered wins. - Runtime editing:
AddDynamicSchemas()gives youISchemaAdmin(get-modify-UpdateAsyncwith the version for optimistic concurrency). In that mode in-memory schemas (including the built-in profile) are not used or seeded;GetAsync(SchemaId.UserProfile)returns not-found until you create it. OidcStandardAttributes.*(e.g.MiddleName,Nickname) can be passed toExtend;Email/Name/GivenName/FamilyNameare already included.- Removing an attribute from the schema does not purge stored values (validated on write only).
IUserProfileSchemaAdminwas removed; useISchemaAdmin. profile.ToUpdate()returns a mutableAttributeValueCollectionfor read-modify-write withIUserProfileSelfService.TryUpdateAsync(subjectId, update.Validate(), ct).- Membership is managed through the single
IMembershipAdmin(replacesIRoleMembershipAdmin/IGroupMembershipAdmin) alongsideIRoleAdmin/IGroupAdmin.
Passkeys
AddUserManagement(...) registers the passkey services automatically (ES/RS/PS signature algorithms, WebAuthn ceremonies, credential storage, challenge management). Passkey endpoints (incl. /passkeys/js) require app.MapUserManagement(). ChallengeSize defaults to 32 bytes (min 16). Stored Transports are client-reported hints, not verified. Passkeys can also be a second factor.
User Lifecycle
- Creation: Users are created on first authentication (passwordless) or via admin APIs
- Profiles: Custom attributes stored as key-value pairs, organized in attribute groups
- Roles & Groups: RBAC support with group membership and role inheritance
- Deletion: Full user deletion with cascade
Migration from ASP.NET Identity
There is no built-in migration option. Read the source ASP.NET Identity database directly (a minimal IdentityDbContext<IdentityUser>, not UserManager), map each user to a UserImportRecord, and call IUserImporter.ImportAsync (registered automatically; typically from a hosted service run once on startup, after MigrateAsync()).
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 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-usermanagement/SKILL.md
Popularity
- Repository stars
- 7
- Repository forks
- 2
- 7-day trend score
- 10
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
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-usermanagement)