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

Add support for Interceptors #13

Open
public opened this issue Nov 3, 2019 · 4 comments
Open

Add support for Interceptors #13

public opened this issue Nov 3, 2019 · 4 comments

Comments

@public
Copy link
Owner

public commented Nov 3, 2019

Interceptors are gRPC specific middlewares that can apply both at the client and the server level.

@b3nav
Copy link

b3nav commented Jun 18, 2021

Hi @public - is this still in the works or has it been parked for the time being?

Currently we have a Django + gRPC that we run using Sonora and would be great to add an authentication interceptor to check for the provided credentials per each request.

Either that or having regular gRPC support would be awesome!

Love the project!

@public
Copy link
Owner Author

public commented Jun 18, 2021

Interceptors should not be too hard to implement, not sure when I can get around to doing it myself but happy to review a PR if you want to take a go :)

@b3nav
Copy link

b3nav commented Jun 18, 2021

Thanks for the prompt response - I personally am not exactly sure where to start to look to implement such feature so any initial pointers would be helpful to me or any potential contributor.

@public
Copy link
Owner Author

public commented Jun 19, 2021

I did a bit more digging and actually it's more complicated than I originally thought because the upstream API is quite weird and seems like they hacked it on as an after thought really.

I might take a look at it in the next few weeks but also I am reminded why I didn't bother originally. You can quite easily replicate the behaviour of interceptors for many use cases using ASGI/WSGI middleware on the server side and by messing around with (the admittedly undocumented but not going anywhere) WebChannel._session attribute on the client side. Both the urllib3 sync client and aiohttp async client let you do things like set default headers for every request which is usually sufficient for auth purposes.

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