massive checkpoint
This commit is contained in:
18
Gameboard.ShogiUI.Sockets/Extensions/Extensions.cs
Normal file
18
Gameboard.ShogiUI.Sockets/Extensions/Extensions.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace Gameboard.ShogiUI.Sockets.Extensions
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static string? UserId(this ClaimsPrincipal self)
|
||||
{
|
||||
return self.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value;
|
||||
}
|
||||
|
||||
public static bool IsGuest(this ClaimsPrincipal self)
|
||||
{
|
||||
return self.HasClaim(c => c.Type == ClaimTypes.Role && c.Value == "Guest");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user