프로젝트
GitHub에서 보기
gin-contrib/authz
소개
gin-authz는 Gin용 인가 미들웨어입니다.
보안 및 개인정보 보호측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalAuthz
Authz is an authorization middleware for Gin, it's based on https://github.com/casbin/casbin.
Installation
go get github.com/gin-contrib/authz
Simple Example
package main
import (
"net/http"
"github.com/casbin/casbin/v2"
"github.com/gin-contrib/authz"
"github.com/gin-gonic/gin"
)
func main() {
// load the casbin model and policy from files, database is also supported.
e := casbin.NewEnforcer("authz_model.conf", "authz_policy.csv")
// define your router, and use the Casbin authz middleware.
// the access that is denied by authz will return HTTP 403 error.
router := gin.New()
router.Use(authz.NewAuthorizer(e))
}
Documentation
The authorization determines a request based on {subject, object, action}, which means what subject can perform what action on what object. In this plugin, the meanings are:
subject: the logged-on user nameobject: the URL path for the web resource like "dataset1/item1"action: HTTP method like GET, POST, PUT, DELETE, or the high-level actions you defined like "read-file", "write-blog"
For how to write authorization policy and other details, please refer to the Casbin's documentation.
Getting Help
License
This project is under MIT License. See the LICENSE file for the full license text.
관련 프로젝트 살펴보기
불러오는 중…