casbin-http-role-example

Example of role-based HTTP Authorization with casbin

  • Owner: zupzup/casbin-http-role-example
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

casbin-http-role-exampe

Simplistic Example of role-based HTTP Authorization with casbin using scs for session handling.

Run with

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

Main metrics

Overview
Name With Ownerzupzup/casbin-http-role-example
Primary LanguageGo
Program languageGo (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2018-01-04 19:05:22
Pushed At2020-08-10 11:11:08
Last Commit At
Release Count0
用户参与
Stargazers Count98
Watchers Count5
Fork Count61
Commits Count3
Has Issues Enabled
Issues Count4
Issue Open Count2
Pull Requests Count0
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private