Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casbin Auth Middleware's sample code has compilation error #129

Open
MasatoshiTada opened this issue Jan 14, 2020 · 1 comment
Open

Casbin Auth Middleware's sample code has compilation error #129

MasatoshiTada opened this issue Jan 14, 2020 · 1 comment

Comments

@MasatoshiTada
Copy link
Contributor

The code below has a compilation error:

e := echo.New()
e.Use(casbin_mw.Middleware(casbin.NewEnforcer("casbin_auth_model.conf", "casbin_auth_policy.csv")))
$ go build src/server.go 
# command-line-arguments
src/server.go:46:27: too many arguments in call to "github.com/labstack/echo-contrib/casbin".Middleware
        have (*"github.com/casbin/casbin".Enforcer, error)
        want (*"github.com/casbin/casbin".Enforcer)

We have to change this code like this:

e := echo.New()
enforcer, err := casbin.NewEnforcer("casbin_auth_model.conf", "casbin_auth_policy.csv")
e.Use(casbin_mw.Middleware(enforcer))
@MasatoshiTada MasatoshiTada mentioned this issue Jan 14, 2020
@MasatoshiTada
Copy link
Contributor Author

I sent a PR. Please take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant