Skip to content
Introducing the next era of Duende IdentityServer. Read our CEO’s announcement

Custom Store Implementation

IdentityServer abstracts all data access behind store interfaces. You can implement any of these interfaces yourself to use any database, storage backend, or data access technology, rather than being limited to the built-in Entity Framework Core or in-memory providers.

Register your custom store implementations in Program.cs using the standard ASP.NET Core DI methods or the IdentityServer builder extension methods.

These interfaces back configuration data: the clients, resources, and identity providers that define what your IdentityServer instance supports.

InterfaceResponsibility
IClientStoreRetrieve client configuration
IResourceStoreRetrieve identity resources, API resources, and API scopes
IIdentityProviderStoreRetrieve dynamic external identity providers
ICorsPolicyServiceDetermine allowed CORS origins
IConnectedApplicationStoreRead-only unified access to all registered applications across protocols (OIDC clients and SAML service providers)
ISamlServiceProviderStoreRetrieve SAML Service Provider configuration by entity ID

Register custom configuration stores with the IdentityServer builder:

builder.Services.AddIdentityServer()
.AddClientStore<MyClientStore>()
.AddResourceStore<MyResourceStore>()
.AddIdentityProviderStore<MyIdentityProviderStore>();

See the stores reference for the full interface contracts.

These interfaces back operational data: the runtime state that IdentityServer generates and consumes during authentication flows.

There are quite a few operational store interfaces in the Duende.IdentityServer.Stores namespace. The most commonly implemented ones are listed below, but explore the namespace (or the stores reference) for the full set. Note that several higher-level interfaces (IAuthorizationCodeStore, IRefreshTokenStore, IReferenceTokenStore, IUserConsentStore) are backed by IPersistedGrantStore by default. Replacing IPersistedGrantStore is usually sufficient, but you can also replace the higher-level interfaces individually if you need finer-grained control.

InterfaceResponsibility
IPersistedGrantStoreStore and retrieve authorization codes, refresh tokens, user consent, and reference tokens
ISigningKeyStorePersist automatically managed signing keys
IServerSideSessionStoreStore server-side user sessions
IDeviceFlowStoreStore device authorization grant data
IBackChannelAuthenticationRequestStoreStore CIBA authentication requests
IPushedAuthorizationRequestStoreStore Pushed Authorization Requests (PAR)

Register custom operational stores with the IdentityServer builder:

builder.Services.AddIdentityServer()
.AddPersistedGrantStore<MyPersistedGrantStore>()
.AddSigningKeyStore<MySigningKeyStore>()
.AddServerSideSessionStore<MyServerSideSessionStore>();

See the stores reference for the full interface contracts, and the DI reference for all available builder extension methods.