You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand that the library uses Request.Env as a way to pass context between middlewares (#153) but this "context" doesn't go beyond middlewares that don't understand rest.Request. For example it is possible to imaging having the authenticated user on a native Golang context.Context object that is available across a system as the first parameter of all functions as per Golang recommendations. This becomes more useful for example when TLS client certificates are used and there is more than just the username that can be passed around (like PeerCertificates).
It would be very helpful to know if there is a way to make this happen. Attempting to fetch objects from Request.env in a middleware and putting them on the request.Context() using WithContext doesn't work as WithContext returns an http.Request which cannot be passed as a rest.Request. Also even if we open up the entire stack to include a context and add a context attribute to rest.Request all the existing middleware need to change without a backward compatible way.
I understand that the library uses
Request.Env
as a way to pass context between middlewares (#153) but this "context" doesn't go beyond middlewares that don't understandrest.Request
. For example it is possible to imaging having the authenticated user on a native Golangcontext.Context
object that is available across a system as the first parameter of all functions as per Golang recommendations. This becomes more useful for example when TLS client certificates are used and there is more than just the username that can be passed around (likePeerCertificates
).It would be very helpful to know if there is a way to make this happen. Attempting to fetch objects from
Request.env
in a middleware and putting them on therequest.Context()
usingWithContext
doesn't work asWithContext
returns anhttp.Request
which cannot be passed as arest.Request
. Also even if we open up the entire stack to include a context and add a context attribute torest.Request
all the existing middleware need to change without a backward compatible way.I wonder what @ant0ine and others think of this.
The text was updated successfully, but these errors were encountered: