1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2024-12-22 16:42:50 +01:00
Minecraft-Phantom-Panel/Web/Phantom.Web.Services/Authentication/CustomClaimsPrincipal.cs

19 lines
538 B
C#

using System.Security.Claims;
using Phantom.Common.Data.Web.Users;
namespace Phantom.Web.Services.Authentication;
sealed class CustomClaimsPrincipal : ClaimsPrincipal {
internal AuthenticatedUser User { get; }
internal CustomClaimsPrincipal(AuthenticatedUser user) : base(GetIdentity(user.Info)) {
User = user;
}
private static ClaimsIdentity GetIdentity(AuthenticatedUserInfo userInfo) {
var identity = new ClaimsIdentity("Phantom");
identity.AddClaim(new Claim(ClaimTypes.Name, userInfo.Name));
return identity;
}
}