-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Websocket URLs with Query Strings and make query string accessible for validations (extension to #208) #221
Comments
I am testing with 4.2.4 - and there it seems that the websocket handshake is not completed as soon as you add a query parameter - probably (but not yet confirmed) due to "io.netty.handler.codec.http.websocketx.WebSocketServerProtocolConfig#checkStartsWith set to false because it is configured like that in io.vertx.mqtt.impl.MqttServerImpl#initChannel The current behaviour is: |
@vietj : I am willing to help - but it seems to be indeed only a very small change - so if you have anyway something open in the area you can probably just sneak it it in. Inside io.vertx.mqtt.impl.MqttServerImpl#initChannel `
` The alternative would be to give the user a chance to replace the complete WebSocketServerProtocolHandler with one that he creates via a callback or overload - this would also solve various other configuration demands in a one shot Greetings! |
so I think there are two things here 1/ we should correctly handle a WebSocket handshake failure so you can provide a PR for that with a test |
Describe the feature
With #208 it is now possible to access the http headers and the URI that was used by MQTT clients to connect to the MQTT Broker. But unfortunately it seems access to the URI is not of much use for the endpoint handler because the only allowed base address of the URI that the Server will accept correctly is "/mqtt" (without any query parameters).
Would it be possible to allow at least /mqtt?key=value style URLs to end up correctly in the EndpointHandler so that authentication parameters can be given with the URI to decide inside the endpoint handler if a connection attempt is legitimate?
I was unsure if this should already work (and this ticket should be a bug) or if it is a new feature.
Use cases
Authentication of clients based on a URL query parameter (concret mqtt url used by the client: ws://[hostname]:[port]/mqtt?auth=<AUTHENTICATION_TOKEN>
The reason why I would like to be able to access the authentication token inside the MQTT Endpoint Handler is that I want to be sure that the authentication token in the URL (which potentially is validated upstream by a reverse proxy) matches the given mqtt username/clientID/pw combination which I can only validate inside the MQTT Endpoint Handler - so that I can be sure that MQTT topic permissions match the identity of the WS connection.
The text was updated successfully, but these errors were encountered: