All Projects → gin-contrib → Authz

gin-contrib / Authz

Licence: mit
gin-authz is an authorization middleware for Gin

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Authz

iris-admin
Web admin for iris-go framwork
Stars: ✭ 602 (+18.5%)
Mutual labels:  gin, casbin
Gin Web
由gin + gorm + jwt + casbin组合实现的RBAC权限管理脚手架Golang版, 搭建完成即可快速、高效投入业务开发
Stars: ✭ 107 (-78.94%)
Mutual labels:  gin, casbin
ginadmin
基于Gin开发的后台管理系统,集成了、数据库操作、日志管理、权限分配管理、多模板页面、自动分页器、数据库迁移和填充、Docker集成部署等功能、静态资源打包
Stars: ✭ 149 (-70.67%)
Mutual labels:  gin, casbin
gt-crud
gin+gorm+mysql+api[两步自动crud]
Stars: ✭ 15 (-97.05%)
Mutual labels:  gin, casbin
Go Admin
基于Gin + Vue + Element UI的前后端分离权限管理系统脚手架(包含了:多租户的支持,基础用户管理功能,jwt鉴权,代码生成器,RBAC资源控制,表单构建,定时任务等)3分钟构建自己的中后台项目;文档:https://doc.go-admin.dev Demo: https://www.go-admin.dev Antd beta版本:https://preview.go-admin.dev
Stars: ✭ 5,439 (+970.67%)
Mutual labels:  gin, casbin
Go-Gin-Api
基于golang开源框架 gin封装的api框架
Stars: ✭ 42 (-91.73%)
Mutual labels:  gin, casbin
golang-gin-restfulAPI-example-app
An example Golang Restful API with [Gin, MongoDB, gin-jwt, gin-sessions, gin-authz, gin-swagger, validate.v9, casbin, go-ini]
Stars: ✭ 104 (-79.53%)
Mutual labels:  gin, casbin
Go Admin
go web api,包含gin+gorm+jwt+rbac等。
Stars: ✭ 298 (-41.34%)
Mutual labels:  gin, casbin
Ginpprof
A wrapper for golang web framework gin to use net/http/pprof easily.
Stars: ✭ 278 (-45.28%)
Mutual labels:  gin
Go Project Sample
Introduce the best practice experience of Go project with a complete project example.通过一个完整的项目示例介绍Go语言项目的最佳实践经验.
Stars: ✭ 344 (-32.28%)
Mutual labels:  gin
Ironinfoweapp
铜陵回归物资有限公司支持, 钢材信息小程序(基于uni-app), 后台账密: tour, tour520
Stars: ✭ 257 (-49.41%)
Mutual labels:  casbin
Go Simple Api Gateway
[deprecated] simple api gateway written by golang
Stars: ✭ 290 (-42.91%)
Mutual labels:  casbin
Casbin Forum
Next-generation forum software based on React + Golang, QQ group: 555019739
Stars: ✭ 348 (-31.5%)
Mutual labels:  casbin
Mdblog
用来显示 markdown 文档的,基于 gin 框架的, go 语言开发的博客
Stars: ✭ 264 (-48.03%)
Mutual labels:  gin
Casbin Rs
An authorization library that supports access control models like ACL, RBAC, ABAC in Rust.
Stars: ✭ 375 (-26.18%)
Mutual labels:  casbin
Go Blog
Golang+gin+vue+MySQL blog
Stars: ✭ 256 (-49.61%)
Mutual labels:  gin
fiber-boilerplate
This is the go boilerplate on the top of fiber web framework. With simple setup you can use many features out of the box
Stars: ✭ 184 (-63.78%)
Mutual labels:  casbin
Go Gin Example
An example of gin
Stars: ✭ 4,992 (+882.68%)
Mutual labels:  gin
Gorm Adapter
Gorm adapter for Casbin
Stars: ✭ 373 (-26.57%)
Mutual labels:  casbin
Go Gin Boilerplate
A starter project with Golang, Gin and DynamoDB
Stars: ✭ 330 (-35.04%)
Mutual labels:  gin

Authz

Build Status codecov Go Report Card GoDoc Join the chat at https://gitter.im/gin-gonic/gin

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"
    "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:

  1. subject: the logged-on user name
  2. object: the URL path for the web resource like "dataset1/item1"
  3. 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].