Skip to content

Infer sign out scheme when using external identity providers and asp.net identity#1265

Merged
brockallen merged 2 commits intoDuendeSoftware:mainfrom
okhara:main
Sep 7, 2023
Merged

Infer sign out scheme when using external identity providers and asp.net identity#1265
brockallen merged 2 commits intoDuendeSoftware:mainfrom
okhara:main

Conversation

@okhara
Copy link
Copy Markdown
Contributor

@okhara okhara commented May 2, 2023

Redirecting back to client application after logging out from the external identity provider

User is not redirected back to the client application from external identity provider, when identity server is configured for asp.net identity.

Link to the Issue

After some debugging of the duende and Microsoft sources, I've discovered that the reason for the redirection problem is the absence of id token. SignOutScheme which is used to retrieve id token from the user is set to default value, but default authentication scheme after configuring identity server for asp.net identity is changed to Application.Identity.

// Identity's cookie at sign out time. If the sign out scheme is explicitly
// set, then we don't override that though.

if (DefaultAuthSchemeIsAspNetIdentity() &&
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic has been refactored a bit to make the intentions clearer

/// <summary>
/// Gets a value indicating if the SignOutScheme was set explicitly, either by application logic or by options binding.
/// </summary>
public bool SignOutSchemeSetExplicitly { get => _signOutScheme != null; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The options class now understands if the sign out scheme has actually been set. We use that in our configuration so that we don't override a user who is trying to set the scheme explicitly.

@josephdecock
Copy link
Copy Markdown
Member

@brockallen I've made some changes to this PR, would you take a look and review please?

@brockallen brockallen merged commit 219d344 into DuendeSoftware:main Sep 7, 2023
@josephdecock josephdecock changed the title Add post configuration of identity server options Infer the correct sign out scheme when using external identity providers and asp.net identity Nov 10, 2023
@josephdecock josephdecock changed the title Infer the correct sign out scheme when using external identity providers and asp.net identity Infer sign out scheme when using external identity providers and asp.net identity Nov 10, 2023
@josephdecock josephdecock mentioned this pull request Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants