简体   繁体   English

MicrosoftAccount、AzureAD 和 OpenIdConnect 身份验证有什么区别?

[英]What is the difference between MicrosoftAccount, AzureAD and OpenIdConnect authentication?

I got absolutely confused when trying to understand the differences between MicrosoftAccount , AzureAD and OpenIDConnect authentications.当我试图了解MicrosoftAccountAzureADOpenIDConnect身份验证之间的区别时,我感到非常困惑。

I am trying to build a.Net Core MVC app that allows some users to authenticate with local accounts, but some with Microsoft accounts.我正在尝试构建一个.Net Core MVC 应用程序,该应用程序允许一些用户使用本地帐户进行身份验证,但有些用户使用 Microsoft 帐户进行身份验证。 I do need to have a local user in DB for both types of authentications as I have some custom authorization mechanisms built on that.对于这两种类型的身份验证,我确实需要在 DB 中有一个本地用户,因为我有一些基于此的自定义授权机制。

I started with creating the app from template and selected "local accounts" authentication.我首先从模板创建应用程序并选择“本地帐户”身份验证。 Then I added the MicrosoftAccount authentication according to this tutorial ( https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/microsoft-logins?view=aspnetcore-3.1 ) .然后我根据本教程添加了 MicrosoftAccount 身份验证https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/microsoft-logins?view=aspnetcore-3.1 This is using Microsoft.AspNetCore.Authentication.MicrosoftAccount and seems to be working fine.这是使用 Microsoft.AspNetCore.Authentication.MicrosoftAccount 并且似乎工作正常。

However, when I create a new app from template and select "work or school account" authentication I can see it uses a different library - Microsoft.AspNetCore.Authentication.AzureAD.UI.但是,当我从模板和 select“工作或学校帐户”身份验证创建一个新应用程序时,我可以看到它使用不同的库 - Microsoft.AspNetCore.Authentication.AzureAD.UI。 It seems to do the same thing.它似乎做同样的事情。 I can see there are events I could hook into to connect the AAD user with my local DB.我可以看到我可以挂钩以将 AAD 用户与我的本地数据库连接的事件。

Looking through the web I found some other tutorials that were using OpenIDConnect for the same purpose.通过查看 web,我发现了一些其他教程使用 OpenIDConnect 用于相同目的。

How are those methods different?这些方法有何不同? Which one should I use and why?我应该使用哪一个,为什么?

In future I would like to be able to query the user's directory for a list of other users.将来我希望能够在用户目录中查询其他用户的列表。 Would that requirement be easier met with either of those three methods?这三种方法中的任何一种都会更容易满足这一要求吗?

  • MicrosoftAccount : This is the login with a general Microsoft account, using OAuth2. MicrosoftAccount :这是使用普通 Microsoft 帐户的登录,使用 OAuth2。 This is also what Microsoft will refer to as “private account” and useful when you want to authenticate someone just using their Microsoft login as an external authentication provider.这也是 Microsoft 将其称为“私人帐户”的内容,当您想要仅使用他们的 Microsoft 登录作为外部身份验证提供程序来对某人进行身份验证时很有用。 This is similar to how you would sign in to sites with your Google account.这类似于您使用 Google 帐户登录网站的方式。
  • AzureAD : This is the sign in to a specific Azure tenant. AzureAD :这是对特定 Azure 租户的登录。 This is often understood as a “work or school account” because it doesn't sign people in using a public account but rather some account bound to some organization.这通常被理解为“工作或学校帐户”,因为它不使用公共帐户登录,而是使用绑定到某个组织的某个帐户。 Usually, you would have an Azure tenant where you have direct users (or configure it to allow external users) but you want to control access through that Azure AD.通常,您将拥有一个 Azure 租户,其中您有直接用户(或将其配置为允许外部用户),但您希望通过该 Azure AD 控制访问。
  • OpenIdConnect : This is the general OpenID Connect protocol which you can use to sign in with many different authentication providers because it is a protocol that many of them will support. OpenIdConnect :这是通用的 OpenID Connect 协议,您可以使用它来登录许多不同的身份验证提供程序,因为它是其中许多人将支持的协议。 You can use OIDC to sign in to either of the above (and many other services) but that will require you to do some more configuration as you will need to figure out specific addresses for example.您可以使用 OIDC 登录上述任何一项(以及许多其他服务),但这需要您进行更多配置,因为您需要找出特定的地址。

You can always use the OpenIdConnect or the OAuth authentication scheme to authenticate with most authentication providers but those are the “manual” schemes which will require you to configure additional things.您始终可以使用OpenIdConnectOAuth身份验证方案与大多数身份验证提供程序进行身份验证,但这些是“手动”方案,需要您配置其他内容。 All the other authentication schemes, including MicrosoftAccount and AzureAD but also the other ones like Google or Twitter build on top of those protocols and come preconfigured so that you do not need to set up much else.所有其他身份验证方案,包括MicrosoftAccountAzureAD ,以及GoogleTwitter等其他身份验证方案都建立在这些协议之上并进行了预配置,因此您无需进行太多其他设置。 So those are mostly for convenience and for more specialized support.所以这些主要是为了方便和更专业的支持。

So when you want to authentication through Microsoft or Azure, then you should choose MicrosoftAccount or AzureAD .所以当你想通过微软或 Azure 进行身份验证时,你应该选择MicrosoftAccountAzureAD Which of those depends on where you want to authenticate with.其中哪一个取决于您要在哪里进行身份验证。 If you have an Azure AD, then you should use that.如果您有 Azure AD,那么您应该使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Azure MobileServices进行MicrosoftAccount身份验证 - MicrosoftAccount Authentication with Azure MobileServices 基本认证和密码认证有什么区别? - What is the difference between basic authentication and cryptographic authentication? jhipster 2:认证选项有什么区别? - jhipster 2 : What is the difference between the authentication option? 摘要和基本身份验证有什么区别? - What is the difference between Digest and Basic Authentication? OAuth 用户身份验证和 Active Directory 用户身份验证有什么区别? - What is the difference between OAuth user authentication and Active Directory user authentication? OpenIDConnect 与 AAD 的身份验证到期 - Authentication expiry with OpenIDConnect with AAD laravel中Eloquent和数据库身份验证驱动程序之间的区别是什么 - what is the difference between Eloquent and database authentication drivers in laravel 对SPA使用刷新令牌和静默身份验证有什么区别? - What is the difference between using refresh token and Silent Authentication for SPA? 普通MVC和Azure MVC表单身份验证系统有什么区别? - What is the difference between normal MVC and Azure MVC forms authentication systems? Spring Security 上下文中的身份验证和授权有什么区别? - What is the difference between authentication and authorization in context of Spring Security?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM