什么是单点登录 (SSO)?
单点登录 (SSO) 是一种会话和用户身份验证服务,它允许用户使用一组登录凭证(例如,名称和密码)来访问多个应用程序。
使用单点登录可以消除多次登录,即用户只需登录一次即可访问多个 Web 应用程序。在 ASP.NET MVC 中使用 ITfoxtec SAML 2.0 实现 SSO 非常简单。下面是逐步实现它的方法。
设置基本设置,如 Issuer url、Destination、AssertionConsumerServiceUrl
使用下面给出的代码在 AssertionConsumerService 方法中获取身份
var useridentity = saml2AuthnResponse.ClaimsIdentity as ClaimsIdentity; var username = useridentity.Claims.Where(c => c.Type == "username") .Select(c => c.Value).SingleOrDefault();