使用 ASP.NET Core 进行 Ws-Federation 身份验证

Posted

技术标签:

【中文标题】使用 ASP.NET Core 进行 Ws-Federation 身份验证【英文标题】:Ws-Federation authentication with ASP.NET Core 【发布时间】:2017-01-29 14:16:59 【问题描述】:

我正在将 ASP.NET 应用程序迁移到 ASP.NET Core 上,但遇到了 Ws-Federation 身份验证问题:ASP.NET 中没有可用的 [Ws-Federation] (https://www.nuget.org/packages?q=Microsoft.Owin.Security.WsFederation) OWIN 中间件核心平台。

但我注意到 ASP.NET Core 的所有身份验证中间件现在都在 Microsoft.AspNetCore.Authentication 命名空间下,所以我搜索了 nuget.org 中的所有包,发现大部分身份验证包都在那里,但不幸的是只有 Microsoft.缺少 AspNetCore.Authentication.WsFederation。

所以,我想知道,如果包丢失是因为它还没有实现还是其他原因?或者,是否存在用于 Ws-Federation 的基于 ASP.NET Core 的身份验证中间件?

【问题讨论】:

【参考方案1】:

尚未实现,主要是因为 .NET Core 没有所需的加密 XML 和 XML dsig 类。

见https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/500

【讨论】:

截至 2017 年底,“WsFederation 预览支持现在可用于 ASP.NET Core 2.0.0。” github.com/aspnet/Security/issues/1473【参考方案2】:

我已将 Katana 中间件移植到 ASP.NET Core。它对完整的 .NET Framework 有很强的依赖性,因为这是目前所需库唯一存在的地方。

https://github.com/chrisdrobison/aspnetcore-wsfed

【讨论】:

【参考方案3】:

.NET Core 2.1 WS Federation 包似乎现在可用。 Microsoft.AspNetCore.Authentication.WsFederation。

更多信息见以下链接: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/ws-federation?view=aspnetcore-2.1

【讨论】:

以上是关于使用 ASP.NET Core 进行 Ws-Federation 身份验证的主要内容,如果未能解决你的问题,请参考以下文章

.Net Core 学习 - ASP.NET Core 概念学习

ASP.NET Core Web 应用程序系列- 使用ASP.NET Core内置的IoC容器DI进行批量依赖注入(MVC当中应用)

如何使用 ASP.NET Core 进行流式传输

ASP.NET Core Web 应用程序系列- 使用ASP.NET Core内置的IoC容器DI进行批量依赖注入

ASP.NET Core Web 应用程序系列- 在ASP.NET Core中使用Autofac替换自带DI进行构造函数和属性的批量依赖注入(MVC当中应用)

使用 ASP.NET Core 进行 Ws-Federation 身份验证