-
Notifications
You must be signed in to change notification settings - Fork 7
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
[API] Add a RBAC solution #1115
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Role names should not be hardcoded.
It should be possible to define new roles without changing the go source code, and what endpoints they have access to.
a5e1882
to
c008762
Compare
That would make this extremely complex to almost no gain. |
The code in this file should not become more complicated (probably less). It's basically one annotation per endpoint. RBAC is a solved problem. |
e7d3fd2
to
30bf145
Compare
This allows the use of an annotated JSON file instead of the default compact CSV format used by the casbin library.
473ecd4
to
fa01d4a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I added some minor suggestions for the documentaiton. Will do some testing before I approve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
7d0486b
to
029d423
Compare
029d423
to
c5956f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Description
A RBAC solution for the admin API.
RBAC is configured through a JSON structure as shown below:
Each endpoint needs an entry or access will be disallowed, a role entry of "*" in the
policy
section will allow access to any user with a valid token. Theaction
can be a single entry GET/POST/PUT or several separate by|
as per example.Specific roles are mapped to the
roles
section, where the role is either a role name or a username. the rolebinding allows a role to function as a group where multiple roles/users can be bound to the same role. This simplifies the policy section as only the top level role needs to be specified for an endpoint