W.I.F.:将 IsSessionMode 设置为 true,似乎无法实现 [英] W.I.F.: Setting IsSessionMode to true, can't seem to make it happen

查看:25
本文介绍了W.I.F.:将 IsSessionMode 设置为 true,似乎无法实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在使用 Safari(和 Opera)时遇到了问题,据我所知,FedAuth cookie 太大了.

We are having problems with Safari(and Opera) and from what I have read the FedAuth cookies are just too big.

有一个巧妙的技巧";解决这个问题:"WIF RTM 向 SessionAuthenticationModule 添加了一个属性 IsSessionMode.当翻转为 true 时,IsSessionMode 的作用是确保 SessionSecurityToken 在整个会话期间保留在缓存中,并生成一个仅包含会话标识符而不是会话本身内容的 cookie."

There is an "neat trick" to fix this: "WIF RTM added a property to the SessionAuthenticationModule, IsSessionMode. When flipped to true, IsSessionMode has the effect of ensuring that the SessionSecurityToken remains in the cache for the whole duration of the session and generating a cookie which contains just a session identifier rather than the content of the session itself."

我在 global.asax 中有此代码:

I have this code in global.asax:

void WSFederationAuthenticationModule_SessionSecurityTokenCreated(object sender, Microsoft.IdentityModel.Web.SessionSecurityTokenCreatedEventArgs e)
{
    FederatedAuthentication.SessionAuthenticationModule.IsSessionMode = true;
}

问题,FederatedAuthentication.SessionAuthenticationModule.IsSessionMode = true"从不跑……为什么?

The Problem , "FederatedAuthentication.SessionAuthenticationModule.IsSessionMode = true" never runs ... why?

是否与PassiveSignInControl"有关?将 IsSessionMode 设置为 true?

Is it related to the "PassiveSignInControl" to set IsSessionMode to true?

MSDN 帖子

your-fedauth-cookies-on-a-diet-issessionmode-true.aspx

来自Programming Windows® Identity Foundation"一书:

From the book "Programming Windows® Identity Foundation":

"SAM 的一个有趣属性是 IsSessionMode.当设置为true,IsSessionMode 有存储会话大容量的作用在服务器端令牌缓存中,而不是将所有内容写入曲奇饼.cookie 本身将只包含一个小的上下文标识符,将用于检索会话服务器.不幸的是,在这个版本的 92 Part II WindowsIdentity Foundation for Identity Developers 产品没有办法从配置文件设置 IsSessionMode.您可以通过一个PassiveSignInControl 的属性,或在 global.asax 文件中作为如下(与上面相同的代码)"

"An interesting property of the SAM is IsSessionMode. When set to true, IsSessionMode has the effect of storing the bulk of the session on a server-side token cache instead of writing everything in the cookie. The cookie itself will just contain a small context identifier, which will be used for retrieving the session on the server. Unfortunately, in this version of the92 Part II Windows Identity Foundation for Identity Developers product there is no way to set IsSessionMode from the configuration file. You can set it via a property of the PassiveSignInControl, or in the global.asax file as follows(same code as above)"

推荐答案

旧线程,但我相信 SessionSecurityTokenCreated 是处理此问题的正确事件 - 对其进行了测试,它可以在具有适当命名空间的旧 WIF"和 NET 4.5 下工作变化.

Old thread, but I believe SessionSecurityTokenCreated is the proper event to handle this--tested it and it works under "old WIF" and NET 4.5 with the appropriate namespace variations.

void WSFederationAuthenticationModule_SessionSecurityTokenCreated(object sender, System.IdentityModel.Services.SessionSecurityTokenCreatedEventArgs e)
{
    e.SessionToken.IsReferenceMode = true;
}

这篇关于W.I.F.:将 IsSessionMode 设置为 true,似乎无法实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆