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
Proposal: Add Route metadata to request attributes or allow adding attributes to routes #459
Comments
interesting. Yes, the attributes field was introduced at a time that Context was not available or not part of the standard pkgs. |
have a look at #462 . I will create a test before merging it |
@Fapiko does this help your usecase? |
emicklei
added a commit
that referenced
this issue
Apr 10, 2021
emicklei
added a commit
that referenced
this issue
Apr 10, 2021
this feature is include in v.3.5.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be nice to see metadata or some way to inject attributes of routes into the request object so they are accessible in handlers and filters. It seems like it would be fairly easy to do it when the request is wrapped:
go-restful/route.go
Lines 69 to 77 in 80bbcf8
Attributes
field but those seem to be scoped to an inbound request so I'm not sure how that field usage is intended to differ fromContext
This would be incredibly handy for handling things like authorization. In my case I'd like to tag each of the routes with an
object
andpermission
required to access that resource, then add a filter to verify the authenticated client has authorization to that object and permission.It would allow something like this when building the routes:
I was attempting to use the
metadata
field but as it stands right now I cannot figure out a way to link a request from the handler or a filter back to a route to look that info up.The text was updated successfully, but these errors were encountered: