capiono
capiono

Reputation: 2997

IdentityServer4 with persistent database

I'm trying to use IdentityServer4 with persistent database. I have an Oracle db. I'm planning on Extending the ConfigurationDbContext and PersistedGrantDbContext in order to do some oracle specific customization.

PersistedGrantDbContext

 public class IdentityPersistedGrantDbContext : PersistedGrantDbContext {
    public IdentityPersistedGrantDbContext(DbContextOptions<PersistedGrantDbContext> options, OperationalStoreOptions storeOptions)
         : base(options, storeOptions) {
    }
}

ConfigurationDbContext

public class IdentityConfigurationDbContext : ConfigurationDbContext {
    public IdentityConfigurationDbContext(DbContextOptions<ConfigurationDbContext> options, ConfigurationStoreOptions storeOptions)
         : base(options, storeOptions) {
    }
}

In the startup class, I do I tell the IdentityServer to use the custom classes?

Upvotes: 3

Views: 3483

Answers (2)

Lutando
Lutando

Reputation: 5010

Implement IPersistedGrantStore as seen here. And add it to the ASP.NET Core ServiceCollection (aka the DI container).

eg:

        services.AddTransient<IPersistedGrantStore, MyPersistedGrantStore>();

where MyPersistedGrantStore uses that DbContext to do those CRUD operations as defined in the interface/contract.

Upvotes: 3

Elan Hasson
Elan Hasson

Reputation: 1270

It's located in IdentityServer4.EntityFramework. add a using statement for IdentityServer4.EntityFramework.DbContexts

Upvotes: 0

Related Questions