Asp.net core 具有持久数据库的IdentityServer4
我正在尝试将IdentityServer4用于持久数据库。我有一个Oracle数据库。我计划扩展Asp.net core 具有持久数据库的IdentityServer4,asp.net-core,asp.net-identity,identityserver4,Asp.net Core,Asp.net Identity,Identityserver4,我正在尝试将IdentityServer4用于持久数据库。我有一个Oracle数据库。我计划扩展ConfigurationDbContext和persistedgranddbcontext,以便进行一些特定于oracle的定制 PersistedGrandDBContext public class IdentityPersistedGrantDbContext : PersistedGrantDbContext { public IdentityPersistedGrantDbCon
ConfigurationDbContext
和persistedgranddbcontext
,以便进行一些特定于oracle的定制
PersistedGrandDBContext
public class IdentityPersistedGrantDbContext : PersistedGrantDbContext {
public IdentityPersistedGrantDbContext(DbContextOptions<PersistedGrantDbContext> options, OperationalStoreOptions storeOptions)
: base(options, storeOptions) {
}
}
public class IdentityConfigurationDbContext : ConfigurationDbContext {
public IdentityConfigurationDbContext(DbContextOptions<ConfigurationDbContext> options, ConfigurationStoreOptions storeOptions)
: base(options, storeOptions) {
}
}
公共类标识类型RSistedGrandDBContext:PersistedGrandDBContext{
公共标识类型RSistedGrandDBContext(DbContextOptions选项,OperationalStoreOptions storeOptions)
:base(选项、存储选项){
}
}
ConfigurationDbContext
public class IdentityPersistedGrantDbContext : PersistedGrantDbContext {
public IdentityPersistedGrantDbContext(DbContextOptions<PersistedGrantDbContext> options, OperationalStoreOptions storeOptions)
: base(options, storeOptions) {
}
}
public class IdentityConfigurationDbContext : ConfigurationDbContext {
public IdentityConfigurationDbContext(DbContextOptions<ConfigurationDbContext> options, ConfigurationStoreOptions storeOptions)
: base(options, storeOptions) {
}
}
公共类标识ConfigurationDbContext:ConfigurationDbContext{
公共标识配置DBContext(DbContextOptions、ConfigurationStoreOptions和storeOptions)
:base(选项、存储选项){
}
}
在startup类中,我会告诉IdentityServer使用自定义类吗?实现
IPersistedGrantStore
,如图所示。并将其添加到ASP.NET核心服务集合(也称为DI容器)
例如:
services.AddTransient();
其中MyPersistedGrantStore使用该DbContext执行接口/合同中定义的CRUD操作。它位于IdentityServer4.EntityFramework中。为IdentityServer4.EntityFramework.DbContexts添加using语句如何使用UserName和pwd验证用户。