Files
ClubPenguinServer/MareSynchronosServer/MareSynchronosServer/Hubs/IdBasedUserIdProvider.cs
rootdarkarchon f9e4fd4f2d minor refactoring
2022-08-22 14:24:47 +02:00

15 lines
386 B
C#

using System.Linq;
using System.Security.Claims;
using Microsoft.AspNetCore.SignalR;
namespace MareSynchronosServer.Hubs
{
public class IdBasedUserIdProvider : IUserIdProvider
{
public string GetUserId(HubConnectionContext context)
{
return context.User!.Claims.SingleOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value;
}
}
}