-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Extension: Add Authorization component #538
Comments
Marking as |
As a general framework approach for authorization, I've used Pundit extensively in Ruby on Rails and found it extremely flexible and powerful. SailsJs has something similar https://sailsjs.com/documentation/concepts/policies Pundit is really a documented pattern and a support library implementing it in very little code.
Thats it! How you implement the methods in b) is entirely arbitrary, and since it is just a plain class/object, you can use inheritance or whatever you like, and application code can arbitrarily instantiate a policy object and query it anywhere. I believe this approach can be adopted and recommended at a framework level, and used directly by app developers, or used to implement other authorization strategies. |
Is there going to be a Will the framework concern be annotation on the controllers to describe authorized roles per path/verb? |
I would proposal we provide built-in |
At the moment, we don't have a plan to ship built-in User/Role models. There are probably some interfaces to capture the basic requirements for such entities if necessary.
I expect to have decorators to allow developers express their authorization requirements at controller class/method level. |
+1 to for leaving out User/Role models from the core authorization framework. In my experience from LB3, built-in User/Role models were difficult to maintain and very often not flexible enough to support different real-world use cases. However, I think it probably makes sense to provide a standalone package offering a minimal implementation of User & Role models for demonstration purposes. LB4 users can then use this minimal implementation to build their own User & Role classes. |
@bajtos We did implement a separate authorisation component in our first lb4 application. It was implemented as decorators at method level in controllers. The permissions were picked from access token (JWT). The implementation was not as vast as mentioned here, but it was good workable solution for us. If there is any way I can help/contribute to this task, please do let me know. I can share our implementation if needed. But it was more or less following the same guidelines mentioned here for authentication component. These guidelines were really helpful. |
@samarpanB, I think that would be helpful if you could add documentation on how to create such component. |
Related: |
@dhmlau Sure. That's a good idea. I'll put that documentation up. Can you please help me with where to start ? I think https://github.com/strongloop/loopback-next/tree/master/docs/site is the place where all pages md files are kept. So I need to create a new one here, right ? |
@samarpanB , you're right. For sidebar, it's from https://github.com/strongloop/loopback-next/blob/master/docs/site/sidebars/lb4_sidebar.yml. Thanks! |
Add documentation specifying guidelines on creating an authorisation component re loopbackio#538
@dhmlau added documenation in above PR. Please have a look. |
Hi everone, I want to check whether user loged in berfore check I check his/her permission, I dont want to add "@authenticate" decorator to method when i added "@access" decorator to it (option configure the access control). How can I do that. |
Add documentation specifying guidelines on creating an authorisation component re loopbackio#538
Add documentation specifying guidelines on creating an authorisation component re loopbackio#538
Add documentation specifying guidelines on creating an authorisation component re loopbackio#538
Add documentation specifying guidelines on creating an authorisation component re loopbackio#538
Add documentation specifying guidelines on creating an authorisation component re loopbackio#538
Add documentation specifying guidelines on creating an authorization component re loopbackio#538
Add documentation specifying guidelines on creating an authorization component re loopbackio#538
Add documentation specifying guidelines on creating an authorization component re loopbackio#538
Add documentation specifying guidelines on creating an authorization component re loopbackio#538
Add documentation specifying guidelines on creating an authorization component re #538
@raymondfeng I was trying to look for the doc page on https://loopback.io/doc/en/lb4/Using-components.html. But it’s not there yet. Is it not yet moved there ? As per my understanding, there is a daily job which moves it there. |
We need to publish a release to npm 1st. |
@samarpanB I just made a release. The document site will be updated soon. |
@samarpanB, it's up: https://loopback.io/doc/en/lb4/Loopback-component-authorization.html. Thanks for your contribution! |
Thanks for your work @samarpanB. I've just been looking at your implementation. Could I ask if there are plans to map roles to scopes at this point in time? Personally I'd find an implementation or roles based on oath scopes a logical path to follow especially in conjunction jwt for auth. EDIT: NM Found this: #1035 (comment) |
See #1205 |
Closing as done. |
Related to #512
The text was updated successfully, but these errors were encountered: