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.

Developer technologies ASP.NET ASP.NET Core
Microsoft Security Microsoft Entra Microsoft Entra External ID
Microsoft Security Microsoft Entra Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.