duendesoftware/duende-skills/identityserver-stores
Claude Code and agent skill by duendesoftware/duende-skills
- community
Checking that the SKILL.md file is still in the repository.
Implement and customize Duende IdentityServer stores including configuration store, operational store, and Entity Framework Core integration. Covers the opt-in Duende Storage provider (preview, see `identityserver-duende-storage`), migrations, custom store implementations, caching strategies, server-side sessions, signing key storage, token cleanup, and multi-tenant patterns.
Install
npx vskill@latest install duendesoftware/duende-skills/identityserver-storesSKILL.md
The same SKILL.md was published earlier as duendesoftware/duende-skills/identityserver-stores.
Duende IdentityServer Stores
When to Use This Skill
- You are wiring up
AddConfigurationStore()orAddOperationalStore()with EF Core and need correct registration, migration assembly setup, and schema configuration. - You are implementing a custom
IClientStore,IResourceStore,IPersistedGrantStore, orISigningKeyStoreagainst a non-EF data source (Redis, Mongo, external API, etc.). - You need to enable and tune configuration store caching (
AddConfigurationStoreCache(), expiration windows, distributed cache setup) to reduce database load. - You are managing EF Core migrations across IdentityServer versions and need to correctly handle schema drift for
ConfigurationDbContextandPersistedGrantDbContext. - You are enabling server-side sessions (
IServerSideSessionStore) and need to understand session lifecycle, cleanup, and storage integration. - You are troubleshooting stale client or resource data, expired token accumulation, or signing key rotation failures tied to store configuration.
- You are designing a multi-tenant IdentityServer deployment and need to choose between database-per-tenant and shared-database store strategies.
Core Principles
Store interfaces decouple IdentityServer from persistence. All data access goes through store interfaces registered in the ASP.NET Core DI container. IdentityServer does not care what database backs them — EF Core, Redis, MongoDB, or a static in-memory collection are all equally valid.
Two independent store categories exist: configuration and operational. They can be used independently or together. Configuration data is relatively static (clients, resources, CORS); operational data is dynamic and high-write (grants, sessions, signing keys). They should be sized, cached, and maintained with those distinct access patterns in mind.
Operational data is protected at rest. The Data payload of persisted grants and serialized signing keys is encrypted using the ASP.NET Core Data Protection API. Key rotation and Data Protection configuration must be coordinated — a lost Data Protection key makes stored grants and signing keys unreadable.
Consumed grants are soft-deleted, not immediately removed. One-time-use grants (e.g., authorization codes, one-time refresh tokens) are marked with a ConsumedTime rather than deleted. This enables threat detection in custom IRefreshTokenService implementations. Do not confuse consumed with expired — the token cleanup service only removes records past their Expiration, not consumed ones (unless RemoveConsumedTokens is enabled).
Store interfaces are runtime contracts, not storage backends. IResourceStore, IClientStore etc. define how IdentityServer loads data, not where it lives. Providers: Entity Framework Core (classic ApiResources/ApiScopes/ApiResourceScopes tables, fully supported), In-Memory, Duende Storage (preview, opt-in alternative, versioned documents; it does *not* replace EF Core), and custom.
EF Core schema changes are your responsibility. Duende does not ship automatic migration scripts or schema upgrade tooling. You own migration creation, application, and data migration between IdentityServer versions.
Docs: https://docs.duendesoftware.com/identityserver/data
NuGet Package
This package provides EF Core implementations for all configuration and operational store interfaces.
Store Architecture
IdentityServer's data is split into two categories, each with its own set of store interfaces:
Configuration Data
Stores static, rarely-changing data that describes how IdentityServer behaves:
| Interface | Contents | |
|---|---|---|
IClientStore | OAuth/OIDC clients (grant types, redirect URIs, secrets, claims, scopes) | |
IResourceStore | IdentityResource, ApiResource, and ApiScope definitions | |
ICorsPolicyService | CORS allowed-origin rules (derived from client configuration) | |
IIdentityProviderStore | Dynamic external identity provider registrations |
Operational Data
Stores dynamic, high-write runtime state that IdentityServer creates and manages during request processing:
| Interface | Contents | |
|---|---|---|
IPersistedGrantStore | Authorization codes, refresh tokens, reference tokens, user consent records | |
IDeviceFlowStore | Device authorization flow codes and user codes | |
ISigningKeyStore | Dynamically managed signing keys (used by automatic key management) | |
IServerSideSessionStore | Server-side authentication session data for interactive users | |
IPushedAuthorizationRequestStore | Pushed authorization request (PAR) data |
EF Core Integration
The Duende.IdentityServer.EntityFramework NuGet package provides EF Core-backed implementations of all store interfaces. It ships two DbContext types:
- `ConfigurationDbContext` — backs
IClientStore,IResourceStore,ICorsPolicyService,IIdentityProviderStore - `PersistedGrantDbContext` — backs
IPersistedGrantStore,IDeviceFlowStore,ISigningKeyStore,IServerSideSessionStore
Registering Both Stores
IdentityServer 8.1 preview: starting with 8.1.0-preview.4 the EF registrations are namedAddEntityFrameworkConfigurationStoreandAddEntityFrameworkOperationalStoreso they can't be confused with Duende Storage'sAddConfigurationStorage/AddOperationalStorage.AddConfigurationStore/AddOperationalStorestill work but are[Obsolete]. Examples below use the classic names that work on all versions.
Separate Schemas
Isolate configuration and operational tables using DefaultSchema to avoid naming collisions and simplify backup strategies:
Migrations
EF Core migrations must be created in the host assembly. IdentityServer does not generate or apply migrations automatically.
Creating Migrations
Applying Migrations at Startup
Handling Schema Updates Across Versions
When upgrading IdentityServer, always check the upgrade guide for schema changes before applying the new package version:
- Review the changelog for any new columns or tables in
ConfigurationDbContextorPersistedGrantDbContext. - Scaffold a new EF migration:
dotnet ef migrations add UpgradeToV7x --context ConfigurationDbContext. - Review the generated migration SQL — especially for columns with
NOT NULLconstraints that require backfill. - Apply to a staging environment and validate before production.
Caching Configuration Data
Configuration data (clients, resources, CORS) is read on every token request. Without caching, every request hits the database.
EF Store Caching (Recommended)
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/identityserver-stores/SKILL.md
Popularity
- Repository stars
- 9
- Repository forks
- 3
- 7-day trend score
- 0
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-stores)