From the course: Building Real-Time Web Apps with SignalR 2

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Authentication with SignalR

Authentication with SignalR

From the course: Building Real-Time Web Apps with SignalR 2

Start my 1-month free trial

Authentication with SignalR

- [Instructor] If you're familiar with how to do authentication and authorization with a standard ASP.NET MVC application, you'll be pleased to know that it works pretty much the same in SignalR hubs as it does in standard MVC controllers. SignalR doesn't provide and special features for authentication, instead it just provides access to the authentication context built into ASP.NET MVC. Within a hub, you have access to Context.User.Identity, and this will give you the I identity of the currently authenticated user. SignalR also provides an attribute called Authorize, which lets you restrict access and set authorization roles. This attribute can be used on a hub or on an individual method within a hub. Next up, we'll see how we can use authentication and authorization to send private messages in Front Chat.

Contents