简体   繁体   中英

Azure Ad authentication and authorization using azure active directory (single tenant) in .net core 3.1?

i am using jwt token authentication by sql using entity framework in my project which is working perfectly fine. now we have to add Microsoft azureAD login in the project? QUESTION 1: we have two type of user 1st one is stored in sql and other are stored in azure and they are not same.

now we have to provide username and password login for sql user(This part completed using jwt token based login) and microsoft login for azure use?

when i use openidconnect to login with microsoft its not working in my project?

services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
            .AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd"));

its not working. what i actually want is to add both authentication like this.

services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
            .AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd"));
        services.AddJwtAuthentication(Configuration);

If you are having new non-Azure users, you will have to use B2C. Refer to An ASP.NET Core web app with Azure AD B2C

The above sample shows how to build an MVC web application that performs identity management with Azure AD B2C using the ASP.Net Core OpenID Connect middleware. It assumes you have some familiarity with Azure AD B2C. If you'd like to learn all that B2C has to offer, start with it's documentation at aka.ms/aadb2c.

The app is a basic web application that performs three functions: sign-in, sign-up, and sign-out. It is intended to help get you started with Azure AD B2C in a ASP.NET Core application, giving you the necessary tools to execute Azure AD B2C policies & securely identify uses in your application.

If you also want to integrate Identity (SQL) in your code, refer Introduction to Identity on ASP.NET Core .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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