-
Notifications
You must be signed in to change notification settings - Fork 203
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
How to implement client authentication? #458
Comments
Thanks for your question! I think generally authentication would be done at the transport later, before initializing the rpc client / service. Maybe the TLS example would help clarify things? |
This example implements encrypted transmission, which is good, but it doesn't solve my problem. I hope that after the client connects, it can send some headers, and the server can get them through First, TCP is a long connection, so the user information should be valid throughout the current connection, there's no need to repeat send Second, I want to eliminate the |
Could you possibly implement a handshake using a separate rpc service, and after the handshake, move the transport into another channel for the post-handshake rpc service? |
I've tried, but I'm not very proficient in the tarpc framework, so I haven't implemented it yet. |
I hope there can be more examples. |
This doesn't really matter to me because I'm using my own already-authenticated custom transport, but grpc-go provides context metadata and I can see how that would be useful in this library, especially given the fact that there's already a propagated context type. |
For the context here, I think the most important thing should be the purpose of metadata transmission. |
The server needs to authenticate each request in order to know which user the request belongs to.
What I can think of is passing the user ID in each request method, but if there are too many request methods, a lot of such logic code needs to be written.
Is there a way to pass headers when the client connects?
The text was updated successfully, but these errors were encountered: