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

12 lines
281 B
C#

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