Identity Server 4 可以使用 NoSQL 吗?
Is it possible to use a NoSQL for Identity Server 4?
我正在尝试将 NoSql 数据存储集成到 Identity Server 4(例如 Cosmos DB)中。我想知道是否有人做过类似的事情 and/or 如果可能的话。
当然,IdentityServer4可以使用NoSQL数据库。为什么不呢?
这里有一个 MongoDB
的例子
"initial plumbing" in ConfigureServices() method at startup.cs.
public void ConfigureServices(IServiceCollection services)
{
...
// --- configure identity server with MONGO Repository for stores, keys, clients and scopes ---
services.AddIdentityServer()
.AddTemporarySigningCredential()
.AddMongoRepository()
.AddClients()
.AddIdentityApiResources()
.AddPersistedGrants()
.AddTestUsers(Config.GetUsers());
...
}
还有另一个 github 项目 cloudscribe、ASP.NET 核心多租户 Web 应用程序基础,用于管理站点、用户、角色、声明等。该项目正在为 IdentityServer 实施 PostgreSQL (ORDBMS) 和 MySql。在这个项目中,您可以了解如何实现一个允许在数据库之间切换的系统。
以上答案有效但有点过时。截至 2021 年 9 月,我已经通过直接在 IdentityServer() 管道中注册自定义商店来实现相同的功能。
默认情况下,这些自定义实现将在 Transient 生命周期内注册。在我的例子中,使用了 MongoDB,因此实现了自定义存储以从 NoSQL 集合中读取身份数据。
services.AddIdentityServer()
.AddAspNetIdentity<ApplicationUser>()
.AddClientStore<CustomClientStore>()
.AddCorsPolicyService<InMemoryCorsPolicyService>()
.AddResourceStore<CustomResourceStore>()
.AddPersistedGrantStore<CustomPersistedGrantStore>()
.AddDeveloperSigningCredential();
我正在尝试将 NoSql 数据存储集成到 Identity Server 4(例如 Cosmos DB)中。我想知道是否有人做过类似的事情 and/or 如果可能的话。
当然,IdentityServer4可以使用NoSQL数据库。为什么不呢?
这里有一个 MongoDB
的例子"initial plumbing" in ConfigureServices() method at startup.cs.
public void ConfigureServices(IServiceCollection services)
{
...
// --- configure identity server with MONGO Repository for stores, keys, clients and scopes ---
services.AddIdentityServer()
.AddTemporarySigningCredential()
.AddMongoRepository()
.AddClients()
.AddIdentityApiResources()
.AddPersistedGrants()
.AddTestUsers(Config.GetUsers());
...
}
还有另一个 github 项目 cloudscribe、ASP.NET 核心多租户 Web 应用程序基础,用于管理站点、用户、角色、声明等。该项目正在为 IdentityServer 实施 PostgreSQL (ORDBMS) 和 MySql。在这个项目中,您可以了解如何实现一个允许在数据库之间切换的系统。
以上答案有效但有点过时。截至 2021 年 9 月,我已经通过直接在 IdentityServer() 管道中注册自定义商店来实现相同的功能。
默认情况下,这些自定义实现将在 Transient 生命周期内注册。在我的例子中,使用了 MongoDB,因此实现了自定义存储以从 NoSQL 集合中读取身份数据。
services.AddIdentityServer()
.AddAspNetIdentity<ApplicationUser>()
.AddClientStore<CustomClientStore>()
.AddCorsPolicyService<InMemoryCorsPolicyService>()
.AddResourceStore<CustomResourceStore>()
.AddPersistedGrantStore<CustomPersistedGrantStore>()
.AddDeveloperSigningCredential();