我们想开发一个新的 ASP.NET Web 应用程序,如果可能的话,我们想采用 ASP.NET Core。实现这一愿望的原因之一是,我们爱上了 ASP.NET Core Identity。但一个问题是,Identity 依赖于 Entity Framework,而 Entity Framework Core 仍然有一些我们需要的未实现的功能(https://github.com/aspnet/EntityFramework/wiki/Roadmap) .
我找到一篇文章,其中作者提供了将 Entity Framework 6 与 ASP.NET Core ( https://learn.microsoft.com/en-us/aspnet/core/data/entity-framework-6 ) 一起使用的可能性。使用 EF 6 和 ASP.NET Core 的推荐方法是,创建一个针对 .NET Framework 4.6.something 的新 dll,并将所有 EF 内容放入其中。由于这种方法是我们的一般数据处理计划,因此也需要以某种方式访问身份数据。并且有许多专门用于身份的 EF 函数(例如 AspNetCore.Identiy.EntityFrameworkCore),使授权/身份验证的东西更好、更容易、更快、更方便 - 无论如何。
但是使用不同的框架(甚至更糟糕的是一个框架的不同版本)来访问同一个数据库,或者在两个不同的地方使用不同的技术访问相同的数据两次并不是我们所想的那种一扫而空的事情.
可能我完全被难住了,这很清楚,但我现在真的没有一个干净的方法或可接受的方法来解决这个问题。
有什么想法吗?
最佳答案
如果我是你,我会看看 Brock Allen 的 IdentityServer4。这里https://github.com/IdentityServer/IdentityServer4在这里 http://docs.identityserver.io/en/release/用于文档。
你甚至会在 msdn 网站上找到一些推荐它的博客。 https://blogs.msdn.microsoft.com/webdev/2016/09/19/introducing-identityserver4-for-authentication-and-access-control-in-asp-net-core/
我认为您会发现它是一个更完整的解决方案。
引自MSDN博客;
IdentityServer4 allows building the following features into your applications:
Authentication as a Service Centralized login logic and workflow for all of your applications (web, native, mobile, services and SPAs).
Single Sign-on / Sign-out Single sign-on (and out) over multiple application types.
Access Control for APIs Issue access tokens for APIs for various types of clients, e.g. server to server, web applications, SPAs and native/mobile apps.
Federation Gateway Support for external identity providers like Azure Active Directory, Google, Facebook etc. This shields your applications from the details of how to connect to these external providers.
Focus on Customization The most important part – many aspects of IdentityServer can be customized to fit your needs. Since IdentityServer is a framework and not a boxed product or a SaaS, you can write code to adapt the system the way it makes sense for your scenarios.
关于c# - Identity Core 与 Entity Framework 6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42860133/