我的任务是通过以下设置在 Umbraco v 8 应用程序中实现 SSO:
第 3 方应用程序将发起对 Umbraco 网站的调用,以便其用户无需登录即可使用 Umbraco 内容。 第 3 方网站也将充当 ID 提供商。
在研究时我想到了这里使用的方法:
https://skrift.io/issues/integrating-saml-into-umbraco/
因此,我所要做的就是设置 SAML 并处理传入的签名断言。 之前没有这样做过,我希望有任何意见:
这是正确的做法吗?
文章中提到的 SAML.config 应该放在哪里? (我已经安装了 nuget 包,并认为我可能会在解决方案中看到它,但那里什么也没有。)
文章还提到在应用程序启动时创建自定义路由,Umbraco 相当于什么?
“在身份提供商发起的单点登录场景中, 会员已访问身份提供商,并点击了一个链接 已将它们重定向回服务提供商(我们的网站)。这 重定向包含 SAML 断言。
要启用此功能,请在应用程序启动时创建自定义路由 可以由身份提供者调用,然后加载 使用 SAMLConfiguration.Load() 将 saml.config 文件加载到组件空间中。”
另一个问题可能是,一旦配置了 SAML,我假设它仅适用于该特定客户端以及正常登录,因此我无法为多个客户端实现此功能,除非我为每个客户端配置了单独的 SSO 应用程序客户?
任何信息将不胜感激。
谢谢。
public class SsoController : Controller
{
public ActionResult AssertionConsumerService()
{
try
{
bool isInResponseTo = false;
string partnerIdP = null;
string userName = null;
string targetUrl = null;
// Receive and process the SAML assertion contained in the SAML response.
SAMLServiceProvider.ReceiveSSO(Request, out isInResponseTo, out partnerIdP, out userName, out attributes, out targetUrl);
//Get the member from their user name
var memberService = ApplicationContext.Current.Services.MemberService;
var checkMember = memberService.GetByUsername(userName);
if (checkMember == null)
{
TempData["ErrorMessage"] = string.Format("The user {0} does not exist in this application.", userName);
return Redirect("~/error");
}
FormsAuthentication.SetAuthCookie(userName, false);
return RedirectToLocal("~/");
}
catch (Exception ex)
{
TempData["ErrorMessage"] = "There was a problem authenticating the user.";
return Redirect("~/error");
}
}
}
默认情况下,saml.config 应该位于应用程序的根文件夹中。
如果您下载免费试用版,而不仅仅是 NuGet 包,您将看到各种示例项目及其 saml.config 文件。
您的 saml.config 将特定于您的环境,但示例和文档应该有助于设置。
在研究将 SAML 或 OAuth 单点登录 (SSO) 集成到 Umbraco 应用程序中时,我偶然发现了 Umbraco 的技术合作伙伴,他们专门帮助多个客户实施 SAML。
您可以通过此链接找到更多信息:https://umbraco.com/integrations-and-tech-partners/miniorange-umbraco-saml-single-sign-on-sso/
此外,它们还为所有 Umbraco 版本提供支持,涵盖会员和后台登录。