Skip to content
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

Ktor integration: lack of access to Ktor's principal (e.g. web session) #187

Open
LoneEngineer opened this issue Oct 12, 2021 · 1 comment

Comments

@LoneEngineer
Copy link

Ktor's intergration completely hides DefaultWebSocketServerSession (which provides access to Ktor's sessions) from a RequestHandler

Let's consider following case. An user logs into a ktor-based service. The service authorizes the user and sets http-only cookie with session-id (which refer to the authorized user). Now web client (js) sets up web-socket connection (web-client has no access to 'session cookie' as security best practice). The only way to verify web session currently - use a connection interceptor, that's okay.

The question is - how to pass result of validation from the interceptor to a request handler?
Of course it's possible to create a token which is bound to the user's session for setting up web-connection and pass that token in setup frame - but it looks like undesired overhead since http already provides us with secure mechanism.

Without rsocket, it can be done in raw Ktor's web-socket solution quite easily.

  • RSocket version(s) used: 0.13.0
@olme04
Copy link
Contributor

olme04 commented Dec 13, 2021

In my mind, better to use setupPayload for some session sharing, because it will be easier to switch to another transport, f.e. QUIC in future, which will not have headers and so on.
But I will think about an API to provide serverSession.

@whyoleg whyoleg added this to the 0.17.0 milestone Oct 5, 2022
@whyoleg whyoleg modified the milestone: 0.16.0 - Transport API/Internals rework, QUIC, Netty Nov 24, 2022
@whyoleg whyoleg removed this from the 0.16.0 - Transport API/Internals rework, QUIC, Netty milestone May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants