Example of role-based HTTP Authorization with casbin
Example of role-based HTTP Authorization with casbin
Simplistic Example of role-based HTTP Authorization with casbin using scs for session handling.
Run with
dep ensure
go run main.goWhich starts a server at http://localhost:8080 with the following routes:
POST /login - accessible if not logged inname as a form-data parameter - there is no passwordAdmin ID: 1, Role: adminSabine ID: 2, Role: memberSepp ID: 3, Role: memberPOST /logout - accessible if logged inGET /member/current - accessible if logged in as a memberGET /member/role - accessible if logged in as a memberGET /admin/stuff - accessible if logged in as an adminNo open issues yet, or sync has not completed.