Authorization decoration of generated/dynamic CRUDRestControllers - is it in anyway possible? #7812
Unanswered
roberttaylortech
asked this question in
Q&A
Replies: 1 comment 1 reply
-
There was some prior discussion if we wanted to expand the API of Generally, there's been no consensus on this matter as the JSON-style API itself is quite opinionated (i.e. Not as flexible as full-blown Controllers), which was a similar issue seen in LoopBack 3. The discussion was a while back, so it could be a good opportunity to revisit; Though the problems stated by #6086 (comment) are still open. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can we best tap into the potential of generated CrudRestControllers while also achieving great authorization? Is there a way?
Wondering if anybody in the community has any experience or guidance on how one could use
Authorization decorators (or any custom decoration?)(https://loopback.io/doc/en/lb4/Decorators_authorize.html) on generated CrudRestControllers/endpoints? (https://loopback.io/doc/en/lb4/Creating-crud-rest-apis.html).
Looked at the src for crud-rest.controller.ts and it just seems like there is no way to really do it.
It seems like it's not easily possible to use any decoration of endpoints in a CrudRestController without taking a very hacky approach and/or wholesale duplicating the code in crud-rest.controller.ts and that we'll have to basically write every endpoint for every model by hand.
Maybe someone has come up with something or has some guidance on an approach? Is the only way to use auth with CrudRestController with the AuthorizationComponent as of now to use Authorizer functions (https://loopback.io/doc/en/lb4/Authorization-component-authorizer.html)
Thanks to all! :)
Beta Was this translation helpful? Give feedback.
All reactions