Skip to content


Repository files navigation

Casbin HTTP FileSystem Adapter

GoDoc Reference Latest Version License Name Build Status Coverage Status Report Card Status

Package casbin-httpfs is a convenient http.FileSystem adapter for Casbin v2. It enables Casbin to load policy and model from anything that implements the http.FileSystem interface.


Make sure you have a working Go workspace, then:

go get

For updating to latest stable release, do:

go get -u


Here is a basic example for this package:

package main

import (

	casbinfs ""

var fs http.FileSystem = http.Dir("/")

func main() {
	// Initialize a new adapter instance.
	adapter := casbinfs.NewAdapter(fs, "/path/to/policy.csv")

	// Initialize a new enforcer instance by passing the adapter.
	enforcer, _ := casbin.NewEnforcer("/path/to/model.conf", adapter)

	// Start checking for permissions.
	enforcer.Enforce("alice", "data1", "read")


MIT © Lyntor Paul Figueroa. See LICENSE for full license text.