mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-22 14:09:34 -10:00
* Return null from ClaimsPrincipal.Current if no thread principal. In the .NET Framework, the AppDomain's default PrincipalPolicy is UnauthenticatedPrincipal. When falling back to the thread's principal, this would no throw because a GenericPrincipal was returned. If the policy was changed to NoPrincipal, ClaimsPrincipal.Current would throw constructing the ClaimsPrincipal since there is no principal. However that behavior was opt-in. In .NET Core, the default policy was changed to NoPrincipal, which would mean unless a principal was explicitly set, Current would always throw. This changes the behavior to return null instead of throw for NoPrincipal. This is to continue supporting the existing behavior in .NET Core 3 of returning null if there is no principal, but continue to allow falling back to the thread's principal. * Code review feedback. Co-authored-by: Stephen Toub <[email protected]> * Fix typos Co-authored-by: Kevin Jones <[email protected]> Co-authored-by: Stephen Toub <[email protected]>