Author : HASSAN MD TAREQ

Authorization

  • SignalR is built on top of ASP.Net core, therefore same authentication and authorization is applied (as like MVC or Razor pages app)
  • use [Authorize] annotation to restrict hub access

Hubs/ChatHub.cs

using Microsoft.AspNetCore.SignalR;
using System.Threading.Tasks;

namespace SignalRChat.Hubs
{
    [Authorize]
    public class ChatHub : Hub
    {
        // ... ... ...
    }
}