我想使用基于 Owin 的 SAML2 身份验证,而无需“硬编码”任何数据。我有来自 IdP 所有者的元数据文件。有什么办法,如何只加载这个文件(或指向带有元数据的 url)并让提供者初始化自己?
public void ConfigureAuth(IAppBuilder app)
{
...
app.UseSaml2Authentication(CreateSaml2Options());
}
private static Saml2AuthenticationOptions CreateSaml2Options()
{
var spOptions = CreateSpOptions();
var saml2Options = new Saml2AuthenticationOptions(false)
{
SPOptions = spOptions
};
var idp = new IdentityProvider(new EntityId("XXXXXXXXX"), spOptions)
{
AllowUnsolicitedAuthnResponse = true,
Binding = Saml2BindingType.HttpPost,
SingleSignOnServiceUrl = new Uri("XXXXXXXXX")
};
saml2Options.IdentityProviders.Add(idp);
return saml2Options;
}
如何从元数据中获取 XXXXXXXXX 值?