$ go get -u github.com/kgosse/buffalo-mw-rbac
// setup casbin auth rules.
authEnforcer, err := casbin.NewEnforcer("rbac_model.conf", "rbac_policy.csv")
if err != nil {
log.Fatal(err)
}
// Create role func.
roleFunc := func(c buffalo.Context) (string, error) {
// implement your logic to get user's role
role := "anonymous"
return role, nil
}
app.Use(rbac.New(authEnforcer, roleFunc))