How to implement Single Sign-out of both .net core mvc?

TEJENDRA PRASAD PATEL 111 Reputation points
2022-12-02T13:25:54.147+00:00

Hi All,

I am implementing Azure AD authentication (b2b) in both web application .NET CORE 6 MVC.

I am looking for an example to authenticate and authorize two .NET Core MVC Web Applications to communicate with one another.

Example:

Webapplication-1 and WebApplication-2 (Both are under same domain and IIS)

Below is the way application is configured currently which uses Identity Server and we moving to Azure AD

Webapplication-1 - Will load all the menus in that few menus will be part of Webapplication-2 and rest part of Webapplication-1

Example:

Webapplication-1 Menus

Webapplication-2/Home
Webapplication-2/Edit
Webapplication-1/View
Webapplication-1/Download

When user click Sign Out in Webapplication-2, "Microsoft.Identity.Web" automatically logs out and clear cookies of Webapplication-2 and I am able to override SignedOut.cshtml to have custom logout page.

Issue is Webapplication-1 cookies still is in browser..

I want to implement Single Sign-out when user click Sign Out button either of the application.

How to implement Single Sign-out.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,187 questions
Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,652 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,559 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 56,686 Reputation points
    2022-12-02T16:34:50.123+00:00

    you will need to use the same cookie for both applications (set subdomain as cookie path). this will require both sites use the same custom roles if any. also you will need to configure DataProtection services to use the same encryption/decryption key for both sites.

    cookie settings:

    https://learn.microsoft.com/en-us/aspnet/core/security/authentication/cookie?view=aspnetcore-7.0

    data protection services configuration:

    https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?view=aspnetcore-7.0


0 additional answers

Sort by: Most helpful