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

Pass request through go context #537

Closed
mitar opened this issue Nov 23, 2020 · 2 comments
Closed

Pass request through go context #537

mitar opened this issue Nov 23, 2020 · 2 comments

Comments

@mitar
Copy link
Contributor

mitar commented Nov 23, 2020

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

We use clients which are scoped to audience parameter (we require to be) passed to endpoints. The storage GetClient gets only client ID to resolve the client. We currently add audience parameter to context ctx and then use that (go has WithValue).

Describe the solution you'd like

I think fosite could just automatically for all requests (and responses, once they are ready) store them on ctx as well. It is pretty good on passing ctx around, request (and response) are naturally linked to ctx anyway. That should be pretty simple change in all codepaths where request and responses are made, we store a pointer to them also into ctx under some fosite-namespaced keys.

Describe alternatives you've considered

We are currently passing that ourselves, but it leads to a bit of duplication code in query preprocessing.

Additional context

I can make a PR for this if acked.

@mitar
Copy link
Contributor Author

mitar commented Apr 9, 2021

@aeneasr What do you think about this?

@aeneasr
Copy link
Member

aeneasr commented Apr 14, 2021

Yup we could do that - just keep in mind that things like the body can only be read once

narg95 pushed a commit to narg95/fosite that referenced this issue May 22, 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