I have an Azure App Service Running a Web Application (NOT a single page app and NOT using MSAL). I am using C# MVC ASP.NET CORE I am using the MicrosoftIdentityWebAppAuthentication service.
My authentication currently works perfectly however, I have a senario where I need the authentication to happen in a popup window instead of redirecting to a new page for the authentication and back again.
I know popup authentication can be accomplished with a single page app and MSAL.js but I dont want to start again. I am open to options for a hybrid approch but I would like to stay with my current authentication process if possible.
Can the services.AddMicrosoftIdentityWebAppAuthentication(Configuration)
be extended to include a popup window?
Here is a snippet from my startup.cs file:
public void ConfigureServices(IServiceCollection services) {
services.AddOptions();
var graphBaseUrl = Configuration["Graph:BaseUrl"]; //"https://graph.microsoft.com/v1.0";
var userReadScope = "user.read";
string[] initialScopes = new string[] { userReadScope };
services.AddMicrosoftIdentityWebAppAuthentication(Configuration)
.EnableTokenAcquisitionToCallDownstreamApi(initialScopes)
.AddMicrosoftGraph(graphBaseUrl, userReadScope)
.AddSessionTokenCaches();
services.AddControllersWithViews(options =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.Filters.Add(new AuthorizeFilter(policy));
}).AddMicrosoftIdentityUI();
services.AddRazorPages();
}
Ive tried to create a hybrid with MSAL.js but I could not figure out how to merge them.