V13: Fix members while using basic auth.#18206
Merged
nikolajlauridsen merged 6 commits intov13/devfrom Feb 3, 2025
Merged
Conversation
AndyButland
reviewed
Feb 3, 2025
Contributor
AndyButland
left a comment
There was a problem hiding this comment.
Code looks good... will now test it out.
src/Umbraco.Web.Common/Extensions/MemberClaimsPrincipalExtensions.cs
Outdated
Show resolved
Hide resolved
AndyButland
approved these changes
Feb 3, 2025
Contributor
AndyButland
left a comment
There was a problem hiding this comment.
And all tests out great - nice work. There was just one tiny comment about a comment to resolve, then it's fine from my side to merge in.
…ons.cs Co-authored-by: Andy Butland <[email protected]>
1 task
This was referenced Sep 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #18186.
Using basic auth breaks member functionality. This turned out to be multiple issues.
AuthenticateBackOfficeAsyncupdated the HttpContext user to the backoffice authenticated one, this breaks members entirely when using basic auth since the backoffice identity will then be the only one ever assigned to the user. I've fixed this by flowing any authenticated identity that is not the backoffice one to the new principal.Testing
MemberManager.IsLoggedIn()returns the correct responseMemberManager.GetCurrentMemberAsync()returns the correct member.I used this beauty of a test page to test:
@using Umbraco.Cms.Core.Security @using Umbraco.Cms.Web.Common.PublishedModels; @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage; @using ContentModels = Umbraco.Cms.Web.Common.PublishedModels; @inject IMemberManager MemberManager @{ Layout = null; } <h1>Member Tester 90000</h1> <p>Is member logged in: @MemberManager.IsLoggedIn()</p> @{ if (MemberManager.IsLoggedIn()) { var currentMember = await MemberManager.GetCurrentMemberAsync(); if (currentMember is null) { <p>Current member not found :(</p> } else { <p>@currentMember.Name is here...</p> } } } <hr> <h1>Login</h1> @await Html.PartialAsync("MyMemberLogin") <hr> <h1>Login Status</h1> @await Html.PartialAsync("MyMemberStatus")