saml-2.0 - 我如何在 ASP.NetCore 2.1 mvc 应用程序中包含 System.Identity Model 4.0
问题描述
在 ASP.NetCore2.1 MVC 应用程序中实现 saml2.0 的最佳方法是什么?
我正在使用 Sustainsys.AspNetCore2.1Saml2 nuget,下面是代码。但其中的 EntityId 需要 System.IdentityModel.dll 4.0 听起来我无法运行它在错误下方显示的应用程序。
代码
services.AddAuthentication()
.AddSaml2(options =>
{
options.SPOptions.EntityId = new EntityId("https://localhost:44349/Saml2");
options.IdentityProviders.Add(
new IdentityProvider(
new EntityId("http://localhost:59410//Metadata"), options.SPOptions)
{
LoadMetadata = true
});
options.SPOptions.ServiceCertificates.Add(new X509Certificate2("Sustainsys.Saml2.Tests.pfx"));
});
我得到以下错误
解决方案
您可以使用 ITfoxtec Identity Saml2 在 ASP.NET Core 2.1 中支持 SAML 2.0。NuGet 包:https ://www.nuget.org/packages/ITfoxtec.Identity.Saml2.MvcCore/
项目https://itfoxtec.com/IdentitySaml2和代码示例https://github.com/ITfoxtec/ITfoxtec.Identity.Saml2/tree/master/test
推荐阅读
- r - 使用自定义函数同时改变几个特征
- conditional-statements - 在 AQL 中使用 IF THEN 的正确方法是什么?
- sql - Oracle SQL:如何合并 n 行并在结果中创建附加列?
- angular - 如何刷新 Ionic 页面中的数据?
- python - 如何使用 PySpark 在给定日期获取每个类别的百分比
- python - 根据 Pandas 数据框的其他列中的值计算列值
- python - 如何从 python 复制 pyspark / hadoop 中的文件
- java - 我应该在哪里验证用户是否有权访问资源?
- python - 我的函数返回一个函数,但它显示错误,没有输出?
- android - 在android中支持多种屏幕尺寸和旋转