17 lines
484 B
C#
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;
|
|
}
|
|
}
|
|
}
|