File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/Umbraco.Web.Common/Extensions Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,13 @@ public static async Task<AuthenticateResult> AuthenticateBackOfficeAsync(this Ht
6868 // Otherwise we can't log in as both a member and a backoffice user
6969 // For instance if you've enabled basic auth.
7070 ClaimsPrincipal ? authenticatedPrincipal = result . Principal ;
71- IEnumerable < ClaimsIdentity > existingIdentities = httpContext . User . Identities . Where ( x => x . IsAuthenticated && x . AuthenticationType != authenticatedPrincipal . Identity . AuthenticationType ) ;
71+
72+ // Make sure to copy into a list before attempting to update the authenticated principal, so we don't attempt to modify
73+ // the collection while iterating it.
74+ // See: https://github.com/umbraco/Umbraco-CMS/issues/18509
75+ var existingIdentities = httpContext . User . Identities
76+ . Where ( x => x . IsAuthenticated && x . AuthenticationType != authenticatedPrincipal . Identity . AuthenticationType )
77+ . ToList ( ) ;
7278 authenticatedPrincipal . AddIdentities ( existingIdentities ) ;
7379
7480 httpContext . User = authenticatedPrincipal ;
You can’t perform that action at this time.
0 commit comments