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

[feature] Add connection Info of client to SubscribeRequest when proxying to proxy_subscribe_endpoint #457

Closed
longlonghands opened this issue Jul 10, 2021 · 4 comments
Milestone

Comments

@longlonghands
Copy link

Hi Alexander, Love the work you are doing on this awesome project. I wanted to ask about this feature because I think it helps users to have more flexibility in their logic when using this awesome project. Thanks for all of your great work on this.
I can code this feature and send you the PR.

Is your feature request related to a problem? Please describe.

sometimes, granting access to a channel depends on the information of the user on connection authentication (conn_info or connection info). but the SubscribeRequest doesn't have the conn info of the client in its fields. so the channel authenticator service has to ask the connection authenticator for more info about the 'client' and 'user' of that SubscribeRequest which is already given by the connection proxy mechanism and is defined in Client.info.

Describe the solution you'd like.

What would the feature look like? How would it work? How would it change the API?

for this feature, we have to expose the Client.info and then add it to SubscribeRequest and change here to include the connection info of the client:

ClientID: client.ID(),

@FZambia
Copy link
Member

FZambia commented Jul 10, 2021

@longlonghands hello, thanks for kind words :)

I think it's reasonable to have, can be done in 2 steps:

  1. Add Client.Info() method to Centrifuge library
  2. Use it in subscribe proxy request where you pointed

I am currently concentrated on Centrifugo v3, would like to avoid adding new features to v2 branch, especially like this one where adding Info to Centrifuge library will require additional backporting work. What do you think if we plan this for v3?

@longlonghands
Copy link
Author

oh, V3! that's exciting. I like it.
right now I have designed a workaround for the current behavior of Centrifugo. we at our company, don't need this feature urgently. I wanted you to consider it. but the plan is up to you and I fully support delegating it for v3. And remember I can help you with this.

actually, I have a suggestion for version 3 too. which is not just a simple feature. I appreciate it if you hear it out.

idea: "proxy to backend" gives us some extensibility functionalities to Centrifugo. but it has a conflict with auth/access functionality. for example right now if you enable token authentication or channels accessibilities you can not use proxy calls. I believe if we add an option to select auth/access method ('jwt' or 'proxy') we can use both jwt auth/access check and proxy calls for extensibility.
this idea needs lots of changes both in client libraries and on the centrifuge implementation too.
what do you think about this idea?

I will move this idea to the related issue (v3), later.

@FZambia
Copy link
Member

FZambia commented Sep 3, 2021

@longlonghands hello, I decided to go a bit different way.

In Centrifugo v3 it's possible to attach meta JSON to connection (adding meta field to connect proxy result). The important thing is that this meta will never be exposed to clients. Actually this is the reason I think reusing info for things like you described can be not enough (what if you want to put some information you don't want other users receive in presence or inside join/leave messages). That's why a separate explicit field is better I believe.

See meta field in connect proxy result fields.

As soon as you attached meta it's possible to add option "proxy_include_connection_meta": true to Centrifugo config – and then this meta information will be added to all the following subscribe, publish, rpc and refresh proxy requests.

Hope this will do the job for you. Do you have a chance to try it out?

@FZambia
Copy link
Member

FZambia commented Sep 17, 2021

Closing since no response from op. This is possible to do with Centrifugo v3 in a way described above.

@FZambia FZambia closed this as completed Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants