AspNetCore.Docs/aspnetcore/signalr/authn-and-authz/sample/NameUserIdProvider.cs

14 lines
319 B
C#

using Microsoft.AspNetCore.SignalR;
namespace SignalRAuthenticationSample
{
#region NameUserIdProvider
public class NameUserIdProvider : IUserIdProvider
{
public string GetUserId(HubConnectionContext connection)
{
return connection.User?.Identity?.Name;
}
}
#endregion
}