Skip to content

Commit

Permalink
Merge pull request #373 from GridProtectionAlliance/anon-noauth
Browse files Browse the repository at this point in the history
Ensure the anonymous principal is not authenticated
  • Loading branch information
StephenCWills authored Feb 13, 2025
2 parents e7a8d3d + 9e90555 commit 5e75700
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/Libraries/GSF.Web/Security/AuthenticationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
using System.Net;
using System.Net.Http.Headers;
using System.Runtime.CompilerServices;
using System.Security.Claims;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -109,8 +110,9 @@ private IPrincipal AnonymousPrincipal
{
get
{
IIdentity anonymousIdentity = new GenericIdentity("anonymous");
return new GenericPrincipal(anonymousIdentity, Array.Empty<string>());
Claim name = new(ClaimTypes.Name, "anonymous");
IIdentity anonymousIdentity = new ClaimsIdentity([name]);
return new ClaimsPrincipal(anonymousIdentity);
}
}

Expand Down

0 comments on commit 5e75700

Please sign in to comment.