.NET Core身份与IdentityServer4 [英] .NET Core Identity vs IdentityServer4

查看:105
本文介绍了.NET Core身份与IdentityServer4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:我应该将.Net Core Identity或IdentityServer 4与Identity一起使用

我需要构建具有登录/注册功能的应用程序,并允许用户使用API​​从我的软件导入/导出数据.我还希望拥有Google,Twitter等外部登录名.

I need to build app with login/register functionality and allow users to use APIs to import/export data from my software. I also want to have external logins like google, twitter, etc.

而且我无法理解为什么仅使用Identity就能完成所有事情,所以为什么需要Identity Server.

And I'm not able to understand why would I need Identity Server when all things can be done using only Identity.

我为什么需要或想要IdentityServer?我只需要把工作做好并尽可能简单.

Why would I need or want IdentityServer ? I just need to get work done right and as simple as possible.

推荐答案

这要视情况而定.

IdentityServer将为您提供OAuth 2.0和OpenID Connect实施,并将为您处理所有详细信息(为您提供端点,令牌管理,范围,授予等).它独立运行,因此您可以将其用于多个客户端(SPA,移动设备,Web应用程序),并且可以与其他应用程序很好地隔离.如果愿意,可以将其与ASP.NET Core Identity一起使用.

IdentityServer will provide you with OAuth 2.0 and OpenID Connect implementation, and it will handle all details for you (providing you endpoints, token management, scopes, grants and so on). It runs independently so you can use it for multiple clients (SPA, mobile, web apps) and it is nicely isolated from rest of your app. If you wish so, you can use it together with ASP.NET Core Identity.

如果您不使用IdentityServer,则必须自己编写其中的一些内容,因为ASP.NET Core Identity是成员资格系统,它不提供任何现成的终结点,并且不提供令牌管理或以其他方式支持如何授权.

If you don't use IdentityServer, you will have to write some of these things yourself because ASP.NET Core Identity is a membership system and it does not provide any ready to use endpoints and neither token management or support for different ways how to authorize.

您需要评估是否最好自己编写这些东西,但设置起来更直接,因为您可能不需要IdentityServer提供的所有功能,尽管将来可能会限制您的工作.

You need to evaluate whether it is better for you to write these things yourself but have a more straightforward setup because you probably don't need everything IdentityServer provides although it might limit you in future.

您还可以查看 OpenIddict ,它比IdentityServer复杂.

You can also have a look at OpenIddict that is less complicated than IdentityServer.

这篇关于.NET Core身份与IdentityServer4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆