Skip to content

Commit 1bc5466

Browse files
elit0451Zeegaan
authored andcommitted
Update the HttpContext's user with the authenticated user's principal
1 parent d83daf4 commit 1bc5466

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Umbraco.Web.Common/Extensions/HttpContextExtensions.cs

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ public static async Task<AuthenticateResult> AuthenticateBackOfficeAsync(this Ht
5959
await httpContext.AuthenticateAsync(Constants.Security.BackOfficeExternalAuthenticationType);
6060
}
6161

62+
// Update the HttpContext's user with the authenticated user's principal to ensure
63+
// that subsequent requests within the same context will recognize the user
64+
// as authenticated.
65+
if (result.Succeeded)
66+
{
67+
httpContext.User = result.Principal;
68+
}
69+
6270
return result;
6371
}
6472

0 commit comments

Comments
 (0)