Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support Key Matching #15

Closed
peterzernia opened this issue Oct 7, 2020 · 16 comments
Closed

Support Key Matching #15

peterzernia opened this issue Oct 7, 2020 · 16 comments
Assignees
Labels
enhancement New feature or request

Comments

@peterzernia
Copy link

I'd like to use the keymatching I use on my backend on the frontend. An example policy using keyMatch would looks like

p, admin, *, GET
p, admin, *, POST

with a corresponding model.conf

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = r.sub == p.sub && keyMatch(r.obj, p.obj) && r.act == p.act

The returned permissions from the casbin backend for admin looks like

{
  'GET': ['*'],
  'POST': ['*']
}

Then on the frontend using keyMatch would allow

authorizer.setUser('admin')
console.log(authorizer.can('GET', '/users/1') // true
console.log(authorizer.can('POST', '/posts')) //true
@hsluoyz
Copy link
Member

hsluoyz commented Oct 7, 2020

@kingiw

@Manoj-Bharti
Copy link

Hi, Any update on this?

I would like to use https://casbin.org/docs/en/abac#scaling-the-model-for-complex-and-large-number-of-abac-rules in my frontend app.

@kingiw
Copy link
Collaborator

kingiw commented Oct 30, 2020

@Manoj-Bharti Hi, currently Casbin.js doesn't support ABAC model. If you would like to use ABAC model at the frontend, we would like to raise this feature asap.

BTW, which language of Casbin do you use at your server side?

@Manoj-Bharti
Copy link

@kingiw Thanks for the quick response.

We are evaluating casbin currently so it's not in use. We have multiple backend applications where we want to take casbin in use in combination with AWS Cognito. Most of applications are in Node but we have some legacy applications which are written in golang and php.

@kingiw
Copy link
Collaborator

kingiw commented Oct 30, 2020

@Manoj-Bharti Casbin.js requires some server-side utilities. Now such server-side utilities are available only in Node-Casbin environment.

@Manoj-Bharti
Copy link

@kingiw ok so currently it's not possible, Do we have some kind of visibility when ABAC model will be supported by Casbin.js?

I was reading this #12 and here it says
Casbin.js is now perfectly support diverse access control models that Casbin originally supports, including the ACL, RBAC and ABAC. which is why i thought it should be working.

@kingiw
Copy link
Collaborator

kingiw commented Oct 30, 2020

@Manoj-Bharti It was a very naive implementation for support ABAC. The implementation is to pass the configuration and all related policies to the frontend.

We are now trying to optimize the implementation and let Casbin.js support all models in Casbin as well as guarantee not leaking so many info (like policies details) to the frontend.

@Manoj-Bharti
Copy link

@kingiw Ok, Thanks for the info. It would be nice to know if we have some timeline for this.

@hsluoyz hsluoyz self-assigned this Feb 10, 2021
@hsluoyz hsluoyz added the enhancement New feature or request label Feb 10, 2021
@hsluoyz
Copy link
Member

hsluoyz commented Dec 6, 2021

@nodece @Zxilly has this issue been done already?

@hsluoyz hsluoyz pinned this issue Dec 7, 2021
@nodece
Copy link
Member

nodece commented Dec 8, 2021

Currently, we migrate node-casbin to casbin.js, you can use all features from node-casbin on any js environment.

@hsluoyz
Copy link
Member

hsluoyz commented Dec 8, 2021

@nodece can this issue be closed?

@nodece
Copy link
Member

nodece commented Dec 8, 2021

maybe we need to waiting for the user's response.

@danverde
Copy link

So just to clarify, Casbin.js still doesn't support ABAC?

@hsluoyz
Copy link
Member

hsluoyz commented Mar 18, 2022

@nodece

@nodece
Copy link
Member

nodece commented Mar 19, 2022

@danverde Yes. Currently, using node-casbin is enough, I'm working on node-casbin, you can use the casbin@next in any JavaScript project.

@hsluoyz hsluoyz unpinned this issue Mar 26, 2022
@hsluoyz
Copy link
Member

hsluoyz commented Feb 3, 2023

@peterzernia @danverde Casbin.js now bases on casbin-core and contains all Casbin functionalities (keymatch, RBAC, ABAC) now: #271

@hsluoyz hsluoyz closed this as completed Feb 3, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants