https://github.com/clevergo/authz
:shield: CleverGo Authorization Middleware
https://github.com/clevergo/authz
authorization casbin clevergo middleware
Last synced: 4 months ago
JSON representation
:shield: CleverGo Authorization Middleware
- Host: GitHub
- URL: https://github.com/clevergo/authz
- Owner: clevergo
- License: mit
- Created: 2020-04-21T15:09:41.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-24T13:09:39.000Z (almost 6 years ago)
- Last Synced: 2024-11-23T16:37:44.737Z (over 1 year ago)
- Topics: authorization, casbin, clevergo, middleware
- Language: Go
- Homepage: https://clevergo.tech
- Size: 17.6 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# CleverGo Authorization Middleware
[](https://travis-ci.org/clevergo/authz)
[](https://coveralls.io/github/clevergo/authz?branch=master)
[](https://pkg.go.dev/clevergo.tech/authz?tab=doc)
[](https://goreportcard.com/report/github.com/clevergo/authz)
[](https://github.com/clevergo/authz/releases)
[](https://pkg.clevergo.tech/)
## Usage
```go
import (
"clevergo.tech/authz"
"clevergo.tech/clevergo"
)
```
```go
enforcer, _ := casbin.NewEnforcer("casbin_model.conf", "casbin_policy.csv")
userFunc := func(c *clevergo.Context) (id string, err error) {
// returns the authenticated user ID.
return
}
app := clevergo.New()
app.Use(authz.New(enforcer, userFunc))
```