.NET Mvc app with MS Azure Authentication refresh

Francesco Ancona 1 Reputation point
2020-06-16T08:34:59.207+00:00

've integrated the Azure authentication in an MVC application via Owin libraries.

HttpContext.Current.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties { RedirectUri = baseurl + "Login/Index", AllowRefresh = true },
OpenIdConnectAuthenticationDefaults.AuthenticationType);

After this, i faced a problem with the Azure session expiration after an hour. To solve this, i implemented a call (for test purposes every 45 minutes) to the Challenge method, like this:

HttpContext.ApplicationInstance.Context.GetOwinContext().Authentication.Challenge(
                new AuthenticationProperties { RedirectUri = MvcApplication.Authentication.AdfsAzure.ADFSUrl + "Reserved/Main/VoidAction/", AllowRefresh = true, IsPersistent = true },
                OpenIdConnectAuthenticationDefaults.AuthenticationType);

The call ended succesfully but, after this, the Session cookie for the .NET mvc application (with name .ASPXAUTH_ARCHIFLOW_CURRENT) changed and the instance Session lost. Have you any idea to solve this? Or is there a different way to implement this token refresh? To give a complete view of the environment, i've removed the tag in the application web.config.

Many thanks at all!

Active Directory Federation Services
Active Directory Federation Services
An Active Directory technology that provides single-sign-on functionality by securely sharing digital identity and entitlement rights across security and enterprise boundaries.
1,187 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,389 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Laude 85,646 Reputation points
    2020-06-16T12:15:23.583+00:00

    .NET MVC is currently not supported in the Q&A forums, the supported products are listed over here https://learn.microsoft.com/en-us/answers/products (more to be added later on).

    You can ask the experts in the dedicated .NET MVC forum over here:
    https://forums.asp.net/1146.aspx/1?MVC

    (Please don't forget to accept helpful replies as answer)

    Best regards,
    Leon

    0 comments No comments