【发布时间】:2018-10-24 06:36:23
【问题描述】:
我将 IdentityServer4 与两个外部 Idp 一起使用,一个使用 WSFederation (ADFS),一个使用 SAML。
对于 SAML 实施,我使用商业产品 ComponentSpace SAML 2 for ASP.Net Core。我使用基于中间件的配置。
用两个 Idp 记录它都可以完美地工作,但现在我遇到了这样的情况,根据客户端,我需要将额外的参数传递给 SAML AuthnRequest。我知道如何在请求中传递这个额外的参数(我可以使用中间件中的 OnAuthnRequestCreated),但我不知道如何在请求来自的地方进行测试,即来自哪个客户端。
我可以控制客户端,所以我还可以传递额外的 acr_values(我认为它可以用来传递自定义数据),但我不知道如何在 OnAuthnRequestCreated 事件中获取它们,如下面的代码所示.
任何帮助将不胜感激。
services.AddSaml(Configuration.GetSection("SAML"));
services.AddAuthentication()
.AddWsFederation("adfs", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
//...rest of config (SSO is working)
})
.AddSaml("saml", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
//...rest of config (SSO is working)
options.OnAuthnRequestCreated = request =>
{
//Here I would need to know from which client the request is coming (either by client name or url or acr_values or whatever)
//to be able to perform conditional logic. I've checked on the request object itself but the info is not in there
return request;
};
});
【问题讨论】:
标签: saml identityserver4 component-space