[英]Server sessions (IsReference mode) for Thinktecture Id.Srv. 3
與參考。 到brockallen.com/2013/02/21/server-side-session-token-caching-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為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)明確指出:
“由於IdSvr 3不使用SAM,因此您無法使用IdentityModel的此功能。由於IdSvr3基於OWIN,因此它使用新的Cookie身份驗證中間件進行身份驗證會話。這些cookie往往比舊的SAM cookie小得多。 ,因此對緩存的需求減少了。”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.