I'm working on ASP.Net Core 2.2 Web Service + SignarR Core with JWT authentication and want ensure that all my hubs could be accessed only with valid token.
I can set [Authorize] attribute on all hubs to ensure that, but is it possible to require authorization by default (otherwise one can forget it when implementing a new hub in the future).
Just like I can do it for controllers:
services.AddMvc(config =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
config.Filters.Add(new AuthorizeFilter(policy));
})