Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

We may need a sample request for beginner #2

Open
pomcho555 opened this issue May 13, 2021 · 0 comments
Open

We may need a sample request for beginner #2

pomcho555 opened this issue May 13, 2021 · 0 comments

Comments

@pomcho555
Copy link

This repository is so helpful to understand casbin works under the gin web application. But, there are no sample requests to feel RBAC. So I wrote a tiny snippet for beginner. You can adapt it into README, if you like it.

  1. Login as Bob

    curl -c cookie.txt -d "username=bob" -d "password=123" "http://localhost:8081/user/login"
  2. Read resource

    curl -b cookie.txt http://localhsot:8081/api/resource

    You can get a following output

    {“code”:1,“message”:“read resource successfully”,“data”:“resource”}
    
  3. Write resource

    curl -XPOST -b cookie.txt localhost:8081/api/resource

    You can be denied a request because of the defined policy

    {“code”:0,“message”:“forbidden”,“data”:null}
    
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant