2018-07-12 06:21:53 +08:00
|
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
|
|
|
|
namespace SignalRAuthenticationSample
|
|
|
|
{
|
2019-02-02 06:03:44 +08:00
|
|
|
#region NameUserIdProvider
|
2018-07-12 06:21:53 +08:00
|
|
|
public class NameUserIdProvider : IUserIdProvider
|
|
|
|
{
|
|
|
|
public string GetUserId(HubConnectionContext connection)
|
|
|
|
{
|
|
|
|
return connection.User?.Identity?.Name;
|
|
|
|
}
|
|
|
|
}
|
2019-02-02 06:03:44 +08:00
|
|
|
#endregion
|
2018-07-12 06:21:53 +08:00
|
|
|
}
|