ID

identityserver-usermanagement

Configures user management and authentication flows for Duende IdentityServer, prioritizing passwordless methods.

Install

mkdir -p .claude/skills/identityserver-usermanagement && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11539" && unzip -o skill.zip -d .claude/skills/identityserver-usermanagement && rm skill.zip

Installs to .claude/skills/identityserver-usermanagement

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Setting up Duende User Management with IdentityServer: passwordless authentication (OTP, TOTP, passkeys), storage configuration, user lifecycle, and migration from ASP.NET Identity.
181 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Add user management to Duende IdentityServer projects
  • Set up passwordless authentication (OTP, TOTP, passkeys)
  • Configure storage providers (PostgreSQL, SQL Server, SQLite)
  • Integrate User Management with IdentityServer for claims delivery
  • Manage user profiles, roles, and groups
  • Migrate users from ASP.NET Identity

How it works

The skill integrates Duende User Management into IdentityServer by adding necessary NuGet packages and configuring services in `Program.cs` for passwordless authentication, storage, and claims mapping.

Inputs & outputs

You give it
a Duende IdentityServer project requiring user management or migration from ASP.NET Identity
You get back
a configured IdentityServer with passwordless authentication, storage, and user lifecycle management

When to use identityserver-usermanagement

  • Implementing passwordless login flows
  • Migrating existing users from ASP.NET Identity
  • Configuring PostgreSQL or SQL Server for IdentityServer
  • Setting up user roles and profile management

About this skill

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.IdentityServer8 NuGet package + .NET 10
  • Storage is document-based (no EF migrations needed) — schema auto-creates at startup
  • Configuration goes inside AddUserManagement(), not at top level
  • Use app.UseIdentityServer() (not UseAuthentication() separately)

Docs: https://docs.duendesoftware.com/identityserver/usermanagement

Setup

1. Add Packages

dotnet add package Duende.IdentityServer
dotnet add package Duende.UserManagement.IdentityServer8
dotnet add package Duende.Storage.Sqlite  # or .PostgreSQL, .Mssql

2. Configure Program.cs

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddIdentityServer(options =>
{
    options.UserInteraction.LoginUrl = "/Account/Login";
    options.UserInteraction.LogoutUrl = "/Account/Logout";
})
    .AddInMemoryClients(Config.Clients)
    .AddInMemoryIdentityResources(Config.IdentityResources)
    .AddUserManagement(options =>
    {
        // Storage (pick one)
        options.AddSqliteStore("Data Source=users.db");
        // options.AddPostgreSqlStore(connectionString);
        // options.AddSqlServerStore(connectionString);

        // OTP delivery
        options.UseSmtpOtpDispatcher(smtp =>
            builder.Configuration.GetSection("Smtp").Bind(smtp));
    });

var app = builder.Build();

// Auto-create database schema
var schema = app.Services.GetRequiredService<IDatabaseSchema>();
await schema.CreateIfNotExistsAsync();

app.UseIdentityServer();
app.MapRazorPages();
app.Run();

3. OTP Dispatcher

Console (development):

builder.Services.AddSingleton<IOtpDispatcher, ConsoleOtpDispatcher>();

SMTP (production):

options.UseSmtpOtpDispatcher(x =>
{
    x.Host = "smtp.example.com";
    x.Port = 587;
    x.Username = "[email protected]";
    x.Password = "secret";
    x.FromAddress = "[email protected]";
});

Authentication Methods

MethodDescriptionSetup
OTP (default)One-time codes via email/SMSIOtpDispatcher implementation
TOTPAuthenticator apps (RFC 6238)Built-in, user enrollment required
PasskeysWebAuthn/FIDO2 phishing-resistantBuilt-in, browser support required
PasswordsTraditional username/password (PBKDF2)Opt-in, not recommended as primary
ExternalOAuth 2.0 / OIDC federated loginStandard ASP.NET Core auth handlers
Recovery codesSingle-use backup codesAuto-generated during 2FA setup

IdentityServer Integration

AddUserManagement() is called on the IdentityServer builder — it automatically:

  • Registers IProfileService for 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:

  • openidsub
  • profilename, given_name, family_name, etc.
  • emailemail, email_verified

Custom attributes are available through custom identity resources.

Storage

ProviderPackageConnection
SQLiteDuende.Storage.SqliteData Source=users.db
PostgreSQLDuende.Storage.PostgreSQLStandard connection string
SQL ServerDuende.Storage.MssqlStandard connection string
In-Memory(built-in)Data Source=:memory: (testing only)

Storage is document-based — no EF Core migrations needed. Call IDatabaseSchema.CreateIfNotExistsAsync() at startup to ensure schema exists.

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

options.AddAspNetIdentityMigration(migrationOptions =>
{
    migrationOptions.ConnectionString = "existing-aspnet-identity-db";
});

Key points:

  • Imports users, roles, and claims from existing ASP.NET Identity tables
  • Password hashes are preserved (users can still log in with existing passwords)
  • Migration runs once; subsequent runs skip already-imported users
  • After migration, users can enroll in passwordless methods

Common Anti-Patterns

❌ Configuring storage outside AddUserManagement() — storage config must be inside the options lambda ❌ Using UseAuthentication() instead of UseIdentityServer() — IdentityServer middleware handles auth ❌ Skipping CreateIfNotExistsAsync() — database tables won't exist on first run ❌ Using in-memory storage in production — data is lost on restart

Common Pitfalls

  1. Storage configuration location: AddSqliteStore()/AddPostgreSqlStore() must be called inside the AddUserManagement(options => { }) lambda, not on the top-level builder.
  2. .NET 10 required: User Management requires .NET 10 SDK or later.
  3. OTP dispatcher required: Without an IOtpDispatcher, the default OTP flow cannot send codes. Register ConsoleOtpDispatcher for development.
  4. LoginUrl/LogoutUrl: Must be set in IdentityServer options to point to your account pages.
  5. Schema creation: Call IDatabaseSchema.CreateIfNotExistsAsync() before the app starts handling requests.

Related Skills

  • identityserver-configuration — IdentityServer host configuration and options
  • identityserver-ui-flows — Login/logout UI flows
  • identityserver-upgrade-v7-to-v8 — Migration guide for v8 (includes User Management as new feature)
  • aspnetcore-authentication — ASP.NET Core authentication fundamentals

When not to use it

  • When configuring storage outside `AddUserManagement()`
  • When using `UseAuthentication()` instead of `UseIdentityServer()`
  • When skipping `CreateIfNotExistsAsync()` for database schema creation

Limitations

  • The skill requires `Duende.UserManagement.IdentityServer8` NuGet package + .NET 10.
  • Storage configuration must be inside `AddUserManagement()` options.
  • The skill requires `app.UseIdentityServer()` for middleware.

How it compares

This skill provides a structured approach to integrating passwordless-first user management into Duende IdentityServer, simplifying complex configurations and migrations compared to manual setup.

Compared to similar skills

identityserver-usermanagement side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
identityserver-usermanagement (this skill)02moReviewIntermediate
azure-identity-dotnet13moReviewBeginner
azure-security-keyvault-keys-dotnet13moReviewIntermediate
csharp-developer432moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

azure-identity-dotnet

microsoft

Azure Identity SDK for .NET. Authentication library for Azure SDK clients using Microsoft Entra ID. Use for DefaultAzureCredential, managed identity, service principals, and developer credentials. Triggers: "Azure Identity", "DefaultAzureCredential", "ManagedIdentityCredential", "ClientSecretCredential", "authentication .NET", "Azure auth", "credential chain".

13

azure-security-keyvault-keys-dotnet

microsoft

Azure Key Vault Keys SDK for .NET. Client library for managing cryptographic keys in Azure Key Vault and Managed HSM. Use for key creation, rotation, encryption, decryption, signing, and verification. Triggers: "Key Vault keys", "KeyClient", "CryptographyClient", "RSA key", "EC key", "encrypt decrypt .NET", "key rotation", "HSM".

12

csharp-developer

zenobi-us

Expert C# developer specializing in modern .NET development, ASP.NET Core, and cloud-native applications. Masters C# 12 features, Blazor, and cross-platform development with emphasis on performance and clean architecture.

43151

csharp-pro

sickn33

Write modern C# code with advanced features like records, pattern matching, and async/await. Optimizes .NET applications, implements enterprise patterns, and ensures comprehensive testing. Use PROACTIVELY for C# refactoring, performance optimization, or complex .NET solutions.

953

microsoft-code-reference

github

Look up Microsoft API references, find working code samples, and verify SDK code is correct. Use when working with Azure SDKs, .NET libraries, or Microsoft APIs—to find the right method, check parameters, get working examples, or troubleshoot errors. Catches hallucinated methods, wrong signatures, and deprecated patterns by querying official docs.

747

dotnet-architect

sickn33

Expert .NET backend architect specializing in C#, ASP.NET Core, Entity Framework, Dapper, and enterprise application patterns. Masters async/await, dependency injection, caching strategies, and performance optimization. Use PROACTIVELY for .NET API development, code review, or architecture decisions.

1241

Search skills

Search the agent skills registry