在ASPNet Web应用程序中,我们当前使用Sustainsys.Saml2对Okta进行身份验证。 效果很好,但是我们希望在应用程序内部跟踪用户的登录信息。
到目前为止,我们尝试了多个事件处理程序HttpApplication.PostAuthenticateRequest或SessionAuthenticationModule上的事件,但似乎无法找到捕获事件的场所。
解决方案是具有框架4.7.2的ASP.Net MVC 5和具有Identitymodel实现的SustainSys.Saml2 1.0.2。
除了“升级”以外,还有其他想法吗?
TIA
我最终使用了AcsCommandResultCreated
。
为了将来参考,我将其添加到Application_Start:
// Capture the Login Event
Sustainsys.Saml2.Configuration.Options.FromConfiguration.Notifications
.AcsCommandResultCreated = (commandResult, response) =>
{
var username = commandResult.Principal.FindFirst(c => c.Type ==
ClaimTypes.NameIdentifier).Value;
System.Diagnostics.Debug.Write($"{username} logged in at {DateTime.Now}");
};
答案 0 :(得分:0)
使用AcsCommandResultCreated
通知。名称可能不太清楚,但是在验证Saml2消息之后以及在调用?SessionAuthenticationModule