1

I was wondering if it is a possibility to reauthenticate to another Azure app when the authentication failed of the first app. In multiple .NET apps, I'm using OpenIdConnect to authenticate to an Azure app. When a user is not assigned, it will trigger the AuthenticationFailed event.

In Azure I've created two apps and I would like to check authentication of those apps in a single web app. For the user at the frontend there should not change a thing. They should stay at the same website. This would mean that you should change the client id at runtime.

AuthenticationFailed = context =>
{
       // set new client id and authenticate again
}

So, I would like to know if it is possible to reauthenticate to another app at the AuthenticationFailed event. A redirect to another webapp would be the last option. What would be the best solution for this?

NiAu
  • 535
  • 1
  • 12
  • 32

1 Answers1

1

The apps will not have access to each other's directories and if they are under the same tenant then the authentication would need to be successful for both. So from my understanding the second authentication would need to be done separately, but you should be able to just redirect to a new site if Request.IsAuthenticated = false. https://learn.microsoft.com/en-us/azure/application-gateway/redirect-overview

private void Page_Load(object sender, EventArgs e)
{
    // Check whether the current request has been
    // authenticated. If it has not, redirect the 
    // user to the new page.
    if (!Request.IsAuthenticated)
    {
        Response.Redirect("mysite.cpm");
    }
}

Redirect to external URI from ASP.NET MVC controller

Marilee Turscak - MSFT
  • 7,367
  • 3
  • 18
  • 28
  • I just would like to know if the configuration of OpenIdConnect can be reset and perform the authentication again. – NiAu Jul 12 '19 at 05:54