ASP.NET WebForms App with OpenId Connect and Azure AD Connect
- ASP.NET WebForms App with OpenId Connect and Azure AD Connect
- Create ASP.Net Web Form application. Configure application to run on "https"
- Install NuGet Package
- Install-Package Microsoft.Owin.Security.OpenIdConnect -Pre
- Install-Package Microsoft.Owin.Security.Cookies –Pre
- Install-Package Microsoft.Owin.Host.SystemWeb –Pre
- Register application on Azure
- Add initialization code, reference. Ensure to have following namespace added in Startup.Auth.cs under App_Start folder. using Microsoft.Owin.Security; using Microsoft.Owin.Security.Cookies; using Microsoft.Owin.Security.OpenIdConnect; using Owin;
- Change ConfigureAuth method of Startup.Auth.cs with following code app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions()); app.UseOpenIdConnectAuthentication( new OpenIdConnectAuthenticationOptions { ClientId = "1d0d7532-fdfe-4152-b283-d3e38ab70d1c", Authority = "https://login.windows.net/44cc3e29-963c-4dce-b794-f2137647b0d8" });
Tags:
Cloud Tech