longPolling does not trigger start().fail when authorization fails #2493

Closed
halter73 opened this Issue Sep 5, 2013 · 1 comment

3 participants

@halter73
SignalR member

It seems like if you add an AuthorizeAttribute to your hub, this does not extend to the longpolling 'negotiate' call, so if your connection falls back to longPolling, SignalR does not properly reject the promise on the call to $.connection.hub.start.

It seems like the dynamic resources SignalR creates (handlers) should be in a context that receives the authorization treatment (unfortunately they are in /signalR/*, not specific to a hub).

Alternatively, since it does eventually fail (some point after the ping loop), this should reject the promise.

Steps to reproduce:

  • Create hub with AuthorizeAttribute
  • Create page that connects to it, and call start({transport: ["longPolling"]});
  • attach a fail() to the call to start. It does not get called!

#2288

@halter73 halter73 was assigned Oct 22, 2013
@davidfowl davidfowl added a commit that referenced this issue Oct 22, 2013
@davidfowl davidfowl Made auth work for hubs
- Made auth work for hubs when there's a challenge that happens after a
failed request.
- Added connectionData (the list of hubs) to all urls including
negotiate send and abort.

#2493
8d39c07
@davidfowl davidfowl added a commit that referenced this issue Oct 22, 2013
@davidfowl davidfowl Made auth work for hubs
- Made auth work for hubs when there's a challenge that happens after a
failed request.
- Added connectionData (the list of hubs) to all urls including
negotiate send and abort.

#2493
f779708
@davidfowl davidfowl added a commit that referenced this issue Oct 23, 2013
@davidfowl davidfowl Made auth work for hubs
- Made auth work for hubs when there's a challenge that happens after a
failed request.
- Added connectionData (the list of hubs) to all urls including
negotiate send and abort.

#2493
70e67b5
@davidfowl davidfowl added a commit that referenced this issue Oct 24, 2013
@davidfowl davidfowl Made auth work for hubs
- Made auth work for hubs when there's a challenge that happens after a
failed request.
- Added connectionData (the list of hubs) to all urls including
negotiate send and abort.

#2493
e47a8c7
@gustavo-armenta

added [Authorize] to HubConnectionAPI
navigated to http://localhost:40476/Hubs/HubConnectionAPI/Default.aspx?transport=longPolling
it raises OnError and triggers start.fail but showing full http response content explaining the 401 error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment