# casbin-http-role-example **Repository Path**: yuxio/casbin-http-role-example ## Basic Information - **Project Name**: casbin-http-role-example - **Description**: https://studygolang.com/articles/12323 - **Primary Language**: Go - **License**: MIT - **Default Branch**: master - **Homepage**: https://github.com/zupzup/casbin-http-role-example.git - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-07-10 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # casbin-http-role-exampe Simplistic Example of role-based HTTP Authorization with [casbin](https://github.com/casbin/casbin) using [scs](https://github.com/alexedwards/scs) for session handling. Run with ```bash dep ensure go run main.go ``` Which starts a server at `http://localhost:8080` with the following routes: * `POST /login` - accessible if not logged in * takes `name` as a form-data parameter - there is no password * Valid Users: * `Admin` ID: `1`, Role: `admin` * `Sabine` ID: `2`, Role: `member` * `Sepp` ID: `3`, Role: `member` * `POST /logout` - accessible if logged in * `GET /member/current` - accessible if logged in as a member * `GET /member/role` - accessible if logged in as a member * `GET /admin/stuff` - accessible if logged in as an admin