Files
StandManager/StandManager/Utils/MembershipUtils.cs
2025-12-04 09:53:39 +01:00

15 lines
404 B
C#

using Microsoft.AspNetCore.Components.Authorization;
namespace StandManager.Utils;
public static class MembershipUtils
{
public static async Task<Guid> GetUserId(AuthenticationStateProvider auth)
{
var state = await auth.GetAuthenticationStateAsync();
var idClaim = state.User.FindFirst("UserId")?.Value;
return Guid.Parse(idClaim ?? Guid.Empty.ToString());
}
}