繁体   English   中英

有没有办法使用 Azure AD 对 ASP.NET Core MVC web 应用程序中的用户进行身份验证,但使用您自己的登录页面,而不是使用 Microsoft 的登录门户

[英]Is there a way to authenticate users in an ASP.NET Core MVC web app using Azure AD, but with a your own login page, not using Microsoft’s login portal

I'm trying to make my own login page for an ASP.NET Core MVC web app using Azure AD (not Azure AD B2C). 但是,如果不使用 Microsoft 自己的登录页面,我找不到一种对用户进行身份验证的好方法。 我不想用那个。

那么有没有一种方法可以验证用户名和密码,并获得 boolean 作为回报? ASP.NET 核心 MVC web 应用程序使用 C#。

官方允许使用email和密码登录,但不推荐。 为安全起见,请在使用后自行评估。

您可以先阅读官方文档 而从http请求详情中,我们可以发现它支持用户名和密码登录。

// Line breaks and spaces are for legibility only.  This is a public client, so no secret is required.

POST {tenant}/oauth2/v2.0/token
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

client_id=6731de76-14a6-49ae-97bc-6eba6914391e
&scope=user.read%20openid%20profile%20offline_access
&username=MyUsername@myTenant.com
&password=SuperS3cret
&grant_type=password

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM