Skip to content

Pass handshake request up to connection handler #42

@adrianhopebailie

Description

@adrianhopebailie

I'd like to be able to use rsocket over WS and leverage the HTTP handshake for authentication of the client.

In the connection event on the WS server I get both the new socket and the incoming handshake request which allows me to, for example, authenticate the request by looking for an auth token in the headers.

Unfortunately the transport abstraction in rsocket-js means there is no way to pass this up from the transport to the server when a new DuplexConnection is published by the transport.

I haven't explored the details but it seems like mutual TLS could also be used to secure the TCP transport. In that case a similar issue arises of needing to pass the output of the auth on the transport up to the server with the DuplexConnection.

It seems like the place to do this is in the getRequestHandler: (socket, payload) callback as a third variable. To expose this from the transport it would need to be added as a new property on the DuplexConnection published by the transport.

If this sounds workable I can try and put a PR together

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions