Thinktecture Id.Srv 的服务器会话(IsReference 模式)。 3个

Server sessions (IsReference mode) for Thinktecture Id.Srv. 3

有参考。布罗卡伦。com/2013/02/21/server-side-session-token-caching-in-wif-and-thinktecture-identitymodel

我想与 Id.Srv 一起使用 服务器端会话。 3 并使用 Redis 缓存作为会话存储.

创建了 ITokenCacheRepository 的实现

除了实现之外,我在Id.Srv的Global.asax中添加了以下代码。项目:

    protected void Application_Start(object sender, EventArgs e)
    {
        PassiveSessionConfiguration.ConfigureSessionCache(new SessionManagerCache(sessionManager));
    }

    public override void Init()
    {
        PassiveModuleConfiguration.CacheSessionsOnServer();
    }

其中 SessionManagerCache 是 ITokenCacheRepository 实现,sessionManager 是其中使用的 Redis 缓存。

我在 web.Config -

中也有这些 configSections
<section name="system.identityModel" ...
<section name="system.identityModel.services" ...

还有 system.identityModel 部分 -

<system.identityModel>
<identityConfiguration>
    <claimsAuthorizationManager type="Identity.TestServer.AuthorizationManager, Identity.TestServer" />
</identityConfiguration>
</system.identityModel>

其中 AuthorizationManager 是 ClaimsAuthorizationManager 派生。

在 运行 之后,从 CacheSessionsOnServer() 内部抛出此异常 -

抛出新的 ArgumentException("SessionAuthenticationModule is null");

我检查了 Init() 中 FederatedAuthentication.SessionAuthenticationModule 的值,它始终为 null。

这条评论说 Id.Srv。使用 SAM 跟踪用户登录会话 -

https://github.com/IdentityModel/Thinktecture.IdentityModel.45/issues/118#issuecomment-24202385

然而,在检查后 Id.Srv。代码,这适用于 Id.Srv。 2.

在Id.Srv。 3、cookie授权。似乎已经被使用 - https://github.com/IdentityServer/IdentityServer3/blob/master/source/Core/Configuration/AppBuilderExtensions/ConfigureCookieAuthenticationExtension.cs#L49

在 CookieAuthenticationOptions 上,有一个选项可以设置 SessionStore 以使用自定义会话存储。但是,似乎没有为 Id.Srv 设置 SessionStore 的选项。因为这些是正在创建的局部变量。

任何人都可以建议如何解决上述错误。我是否遗漏了一些明显的东西?

可以 Thinktecture.IdentityModel 用于与 Id.Srv 的服务器会话。 3? 如果不是,使用 Id.Srv 为登录会话实现服务器会话(IsReference 模式)的替代方案是什么? 3?

任何帮助将不胜感激。

对于遇到此问题的任何人,Brock Allen 已澄清:

"Since IdSvr 3 does not use the SAM, you can't use this feature from IdentityModel. IdSvr3, since it's OWIN based, uses the new cookie authentication middleware for the authentication sessions. These cookies tend to be much smaller than the older SAM cookies, thus there's less need for the cache."