Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 684
capiono Avatar asked Jul 14 '26 22:07

capiono


1 Answers

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.

like image 161
Lutando Avatar answered Jul 18 '26 02:07

Lutando



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!