azure-signalr
azure-signalr copied to clipboard
Can JWT access token be reused?
The client gets signalr service endpoint and JWT access token back, can client reuse this JWT access token to establish more than 1 connection? From the code, seems yes, want to confirm this.
Yes, it can. Sharing token means sharing the user info, which means all the connections for this client is one user. Could you share with us your scenario to share the token?
In our case, we supports anonymous clients. We plan to issue signalr service endpoint and JWT access token back to the client, without specifying user id or auto-generate an unique user id. So the client may use this JWT access token to connect to our signalr service, and they can build as many connections. If that's the case, no other clients may be able to connect to the signalr service, since signalr service allows X number of connections. Is my understanding right? Thanks.
If that's the case, no other clients may be able to connect to the signalr service, since signalr service allows X number of connections
Yeah, that's the challenge when you allow anonymous clients that you might reach your instance connection limits quickly.
Any idea to mitigate this? This sounds like a simple DOS.
You can abort the connection in Hub when OnConnectedAsync if the connections from one client exceeds your expectation using Context.Abort()
You can abort the connection in Hub when OnConnectedAsync if the connections from one client exceeds your expectation using
Context.Abort()
Hello @vicancy, How would you call Context.Abort()
in Serverless mode? I'm using Azure Functions in Serverless mode which doesn't interface with hub classes.
@kwasak For Serverless there is no such feature exposed yet, we are adding the feature and they will be available soon. (REST API for closing a connection will be available this month)
@vicancy thanks for letting me know, I look forward to the API!
Close a client connection is now supported https://github.com/Azure/azure-signalr/blob/dev/docs/management-sdk-guide.md