All Projects → casbin → Negroni Authz

casbin / Negroni Authz

Licence: mit
negroni-authz is an authorization middleware for Negroni

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Negroni Authz

Caddy Authz
Caddy-authz is a middleware for Caddy that blocks or allows requests based on access control policies.
Stars: ✭ 221 (+45.39%)
Mutual labels:  middleware, plugin, authorization, rbac, acl, access-control, casbin, abac
Casbin Authz Plugin
Docker Authorization Plugin based on Casbin
Stars: ✭ 204 (+34.21%)
Mutual labels:  plugin, authorization, rbac, access-control, casbin, abac
Node Casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Node.js and Browser
Stars: ✭ 1,757 (+1055.92%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Golang
Stars: ✭ 10,872 (+7052.63%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Pycasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Python
Stars: ✭ 625 (+311.18%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Casbin4D
An authorization library that supports access control models like ACL, RBAC, ABAC in Delphi
Stars: ✭ 25 (-83.55%)
Mutual labels:  acl, authorization, rbac, access-control, abac, casbin
Openstack Policy Editor
A Casbin Policy Editor for OpenStack
Stars: ✭ 28 (-81.58%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Casbin Server
Casbin as a Service (CaaS)
Stars: ✭ 171 (+12.5%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
dart-casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Dart/Flutter
Stars: ✭ 30 (-80.26%)
Mutual labels:  acl, authorization, rbac, access-control, abac, casbin
Casbin Cpp
An authorization library that supports access control models like ACL, RBAC, ABAC in C/C++
Stars: ✭ 113 (-25.66%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Gorm Adapter
Gorm adapter for Casbin
Stars: ✭ 373 (+145.39%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Jcasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Java
Stars: ✭ 1,335 (+778.29%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
casbin-ex
An authorization library that supports access control models like ACL, RBAC, ABAC in Elixir
Stars: ✭ 37 (-75.66%)
Mutual labels:  acl, authorization, rbac, access-control, abac, casbin
Casbin.net
An authorization library that supports access control models like ACL, RBAC, ABAC in .NET (C#)
Stars: ✭ 535 (+251.97%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Chi Authz
chi-authz is an authorization middleware for Chi
Stars: ✭ 248 (+63.16%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Laravel Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.
Stars: ✭ 136 (-10.53%)
Mutual labels:  middleware, authorization, acl, access-control, casbin, abac
lua-casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Lua (OpenResty)
Stars: ✭ 43 (-71.71%)
Mutual labels:  acl, authorization, rbac, access-control, abac, casbin
sequelize-adapter
Sequelize adapter for Casbin
Stars: ✭ 51 (-66.45%)
Mutual labels:  acl, authorization, rbac, access-control, abac, casbin
Casbin Rs
An authorization library that supports access control models like ACL, RBAC, ABAC in Rust.
Stars: ✭ 375 (+146.71%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Php Casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in PHP .
Stars: ✭ 865 (+469.08%)
Mutual labels:  authorization, rbac, acl, access-control, abac

Negroni-authz Build Status Coverage Status GoDoc

Negroni-authz is an authorization middleware for Negroni, it's based on https://github.com/casbin/casbin.

Installation

go get github.com/casbin/negroni-authz

Simple Example

package main

import (
    "fmt"
    "net/http"

    "github.com/casbin/casbin"
    "github.com/casbin/negroni-authz"
    "github.com/urfave/negroni"
)

func main() {
    mux := http.NewServeMux()
    mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
        fmt.Fprintf(w, "Welcome to the home page!")
    })

    n := negroni.Classic()

    // load the casbin model and policy from files, database is also supported.
    e := casbin.NewEnforcer("authz_model.conf", "authz_policy.csv")
    n.Use(authz.Authorizer(e))

    http.ListenAndServe(":3000", n)
}

How to control the access

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].