Asp.net-Core

是否可以將 NoSQL 用於 Identity Server 4?

  • September 25, 2021

我正在嘗試將 NoSql 數據儲存集成到 Identity Server 4(例如 Cosmos DB)中。我想知道那裡是否有人做過類似的事情和/或是否有可能。

當然,可以為 IdentityServer4 使用 NoSQL 數據庫。為什麼不?

這是MongoDB的範例

startup.cs 的 ConfigureServices() 方法中的“初始管道”。

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 Core 多租戶 Web 應用程序基礎,可管理站點、使用者、角色、聲明等。這個項目正在為 IdentityServer 實現 PostgreSQL (ORDBMS) 和 MySql。在這個項目中,您可以了解如何實現一個允許在數據庫之間切換的系統。

引用自:https://stackoverflow.com/questions/45847426