How to implement IAuthorizationRequirement for SignalR in Asp.Net Core v5.0
Been battling this for a couple of days, and eventually ended up raising an issue on Asp.Net Core gitHub to find the answer.
Wanting to do some custom authorization on a SignalR Hub when the client makes a connection (Hub is created) and when an endpoint (Hub method) is called:
I was assuming I could use the same Policy for both class & method attributes, but it ain't so - not because you can't, because you need the signatures to be different.
Method implementation has a resource type of HubInnovationContext:
I assumed class implementation would have a resource type of HubConnectionContext - client connects etc... This isn't the case, it's infact of type DefaultHttpContext. For me I don't even need that, it can be removed completely from the inheritence signature and override implementation.
Only other thing to note, and this could be a biggy, is the ordering of the statements in the Startup class:
Post a Comment