ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

C#-实体框架6的身份核心

2019-10-26 06:08:27  阅读:189  来源: 互联网

标签:asp-net-core net-core asp-net-identity c entity-framework


我们希望开发一个新的ASP.NET Web应用程序,如果可能的话,我们希望采用ASP.NET Core.产生此愿望的原因之一是,我们爱上了ASP.NET Core标识.但是一个问题是,标识依赖于Entity Framework,而Entity Framework Core仍具有我们需要的一些未实现的功能(https://github.com/aspnet/EntityFramework/wiki/Roadmap) .

我找到了一篇文章,作者在其中提供了将Entity Framework 6与ASP.NET Core(https://docs.microsoft.com/en-us/aspnet/core/data/entity-framework-6)结合使用的可能性.使用EF 6和ASP.NET Core的推荐方法是,创建一个针对.NET Framework 4.6.something的新dll,并将所有EF-stuff放入其中.由于这种方法通常是我们用于数据处理的计划,因此也需要以某种方式访问​​身份数据.并且有许多用于身份的专用EF功能(例如AspNetCore.Identiy.EntityFrameworkCore),使授权/身份验证变得更好,更轻松,更快,更方便-前所未有.

但是,我们想到的是,使用不同的Framework(或更糟的是一个Framework的不同版本)来访问相同的数据库,或者使用不同的技术在两个不同的位置两次访问相同的数据,并不是一种彻底的清除.

可能是我完全被困住了,这很清楚,但是现在我真的没有一个干净的方法或可接受的方法来解决这个问题.

有任何想法吗?

解决方法:

如果我是我,我会看一下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.

标签:asp-net-core,net-core,asp-net-identity,c,entity-framework
来源: https://codeday.me/bug/20191026/1934276.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有