我们在ADFS联合SharePoint应用程序中实现了HTTP模块(使用global.asax),该模块执行一些身份验证后检查,并将一些数据存储在ASP.NET会话状态对象中,以确保在随后的检查中不会进行检查往返。
我们注意到,在联合注销时未清除ASP.NET会话ID,并且在同一浏览器中以其他用户身份登录时将回收ASP.NET会话ID。我们想加入一个联合身份验证模块,以注销事件以显式调用session.Clear()和session.Abandon(),以确保在每次登录时再次分配新的会话ID。
但是我无法激发SessionAuthenticationModule_SigningOut事件。我也可以在SessionSecurityTokenReceived事件期间放弃/清除任何会话,但是不确定这是否是最干净的方法。关于我所缺少的东西有什么想法吗?下面的代码位于Global.asax文件中。
public override void Init()
{
FederatedAuthentication.SessionAuthenticationModule.SessionSecurityTokenReceived += new EventHandler<SessionSecurityTokenReceivedEventArgs>(SessionAuthenticationModule_SessionSecurityTokenReceived);
FederatedAuthentication.SessionAuthenticationModule.SigningOut += new EventHandler<SigningOutEventArgs>(SessionAuthenticationModule_SigningOut);
base.Init();
}
void SessionAuthenticationModule_SigningOut(object sender, SigningOutEventArgs e)
{
this.Session.Clear();
this.Session.Abandon();
}
编辑:再次重新部署DLL之后,我触发了该事件。会话状态对象似乎在此事件处理程序中不可用,所以我不确定我可以加入哪些其他事件来执行此操作?