HRM-10/HRM.UI/Realtime/UserIdClaimProvider.cs
2026-11-30 13:35:21 +06:00

17 lines
484 B
C#

using Microsoft.AspNetCore.SignalR;
namespace HRM.UI.Realtime
{
/// <summary>
/// Ties a connection to the app's own user id (the "UserID" claim of the JWT), so
/// IRealtimePublisher.ToUserAsync reaches every tab that user has open.
/// </summary>
public class UserIdClaimProvider : IUserIdProvider
{
public string GetUserId(HubConnectionContext connection)
{
return connection.User?.FindFirst("UserID")?.Value;
}
}
}