将 Redis 缓存添加到 Identity Server 6

Stu*_*ish 5 c# redis duende-identity-server

我已经将基于 Identity Server 的项目从原始的 Identity Server 4 升级到Duende 的 Identity Server 6。升级似乎有效,但我必须删除一些现有代码才能使其正常工作。

这是我们以前的配置Startup.cs

services.AddIdentityServer()
   .AddOperationalStore(options => {
      options.RedisConnectionString = Configuration.GetConnectionString("Redis");
      options.Db = 1;
   })
   .AddRedisCaching(options => {
       options.RedisConnectionString = Configuration.GetConnectionString("Redis");
       options.KeyPrefix = "custom_prefix";
   })
   .AddSigningCredential(new X509Certificate2(Path.Combine(HostingEnvironment.WebRootPath, "secretauth.pfx"), "secret_key"))
   .AddUserStore() // Custom User Store
   .AddResourceStore<CustomResourceStore>()
   .AddClientStore<CustomClientStore>();
Run Code Online (Sandbox Code Playgroud)

之前的版本使用了IdentityServer4.Contrib.RedisStore,从 Identity Server 6 开始我们不再可用。

这意味着我们的新实现没有为会话数据添加 Redis 缓存的选项,而且我看不到可能提供该功能的 Duende 相关 nuget 包。

留给我们的只有这个;

services.AddIdentityServer(options =>
{
    options.LicenseKey = Configuration.GetValue<string>(key: "Duende.IdentityServer:licenseKey");
})
.AddUserStore() // Custom User Store
.AddClientStore<CustomClientStore>()
.AddResourceStore<CustomResourceStore>();
Run Code Online (Sandbox Code Playgroud)

我是否在某个地方缺少一个可能有用的 Nuget 扩展包,或者我们是否需要寻找一种在操作数据存储上实现 Redis 缓存的全新方法?