2017-02-21 143 views
1

我正在嘗試將IdentityServer4與持久性數據庫一起使用。我有一個Oracle分貝。我正在計劃擴展ConfigurationDbContextPersistedGrantDbContext以執行一些特定於oracle的自定義。IdentityServer4與持久性數據庫

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) { 
    } 
} 

在啓動類的,我做我告訴IdentityServer使用自定義類?

回答

2

實施IPersistedGrantStore如所見here。並將其添加到ASP.NET Core ServiceCollection(又名DI容器)中。

例如:

services.AddTransient<IPersistedGrantStore, MyPersistedGrantStore> 

其中MyPersistedGrantStore使用該的DbContext做那些CRUD操作如在接口/合同所定義。

+0

如何使用userame和pwd驗證用戶。 – User

0

它位於IdentityServer4.EntityFramework中。爲IdentityServer4.EntityFramework.DbContexts添加using語句