All Projects → casbin → Caddy Authz

casbin / Caddy Authz

Licence: apache-2.0
Caddy-authz is a middleware for Caddy that blocks or allows requests based on access control policies.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Caddy Authz

Negroni Authz
negroni-authz is an authorization middleware for Negroni
Stars: ✭ 152 (-31.22%)
Mutual labels:  middleware, plugin, 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 (-86.43%)
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 (-48.87%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Casbin Server
Casbin as a Service (CaaS)
Stars: ✭ 171 (-22.62%)
Mutual labels:  authorization, rbac, acl, 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 (+695.02%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Casbin.net
An authorization library that supports access control models like ACL, RBAC, ABAC in .NET (C#)
Stars: ✭ 535 (+142.08%)
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 (-88.69%)
Mutual labels:  acl, authorization, rbac, access-control, abac, casbin
Chi Authz
chi-authz is an authorization middleware for Chi
Stars: ✭ 248 (+12.22%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
sequelize-adapter
Sequelize adapter for Casbin
Stars: ✭ 51 (-76.92%)
Mutual labels:  acl, authorization, rbac, access-control, abac, casbin
Laravel Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.
Stars: ✭ 136 (-38.46%)
Mutual labels:  middleware, authorization, acl, access-control, casbin, abac
Casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Golang
Stars: ✭ 10,872 (+4819.46%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Casbin Rs
An authorization library that supports access control models like ACL, RBAC, ABAC in Rust.
Stars: ✭ 375 (+69.68%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Gorm Adapter
Gorm adapter for Casbin
Stars: ✭ 373 (+68.78%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
lua-casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Lua (OpenResty)
Stars: ✭ 43 (-80.54%)
Mutual labels:  acl, authorization, rbac, access-control, abac, casbin
Jcasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Java
Stars: ✭ 1,335 (+504.07%)
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 (-83.26%)
Mutual labels:  acl, authorization, rbac, access-control, abac, casbin
Pycasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Python
Stars: ✭ 625 (+182.81%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Openstack Policy Editor
A Casbin Policy Editor for OpenStack
Stars: ✭ 28 (-87.33%)
Mutual labels:  authorization, rbac, acl, access-control, casbin, abac
Casbin Authz Plugin
Docker Authorization Plugin based on Casbin
Stars: ✭ 204 (-7.69%)
Mutual labels:  plugin, authorization, rbac, access-control, casbin, abac
Think Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in ThinkPHP 6.0 .
Stars: ✭ 155 (-29.86%)
Mutual labels:  authorization, rbac, acl, access-control, casbin

Caddy-authz Build Status Coverage Status GoDoc

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

Installation

go get github.com/casbin/caddy-authz

Caddyfile syntax

localhost {
    route { 
        authz "/folder/to/caddy_binary/authz_model.conf" "/folder/to/caddy_binary/authz_policy.csv"
    }
    respond "Hello, world!"
    ...
}

or

{
    order authz before respond
}

localhost {
	authz "/folder/to/caddy_binary/authz_model.conf" "/folder/to/caddy_binary/authz_policy.csv"
	respond "Hello, world!"
    ...
}

The authz directive specifies the path to Casbin model file (.conf) and Casbin policy file (.csv). The Casbin model file describes access control models like ACL, RBAC, ABAC, etc. The Casbin policy file describes the authorization policy rules. For how to write these files, please refer to: https://github.com/casbin/casbin#get-started

A working example

  1. cd into the folder of caddy binary.

  2. Put your Casbin model file authz_model.conf and Casbin policy file authz_policy.csv into this folder.

  3. Add authz directive to your Caddyfile like:

localhost:666 {
    route { 
        authz "authz_model.conf" "authz_policy.csv"
    }
    respond "Hello, world!"
    ...
}
  1. Run caddy and enjoy.

Note: This plugin only supports HTTP basic authentication to get the logged-in user name, if you use other kinds of authentication like OAuth, LDAP, etc, you may need to customize this plugin.

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