{"id":19298199,"url":"https://github.com/casbin/negroni-authz","last_synced_at":"2025-09-13T05:38:38.270Z","repository":{"id":57501184,"uuid":"94594384","full_name":"casbin/negroni-authz","owner":"casbin","description":"negroni-authz is an authorization middleware for Negroni","archived":false,"fork":false,"pushed_at":"2023-08-06T14:54:20.000Z","size":5,"stargazers_count":157,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-07T13:40:58.571Z","etag":null,"topics":["abac","access-control","acl","authorization","casbin","middleware","negroni","plugin","rbac"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casbin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"casbin"}},"created_at":"2017-06-17T02:02:22.000Z","updated_at":"2023-09-26T01:10:47.000Z","dependencies_parsed_at":"2023-09-26T09:09:10.542Z","dependency_job_id":null,"html_url":"https://github.com/casbin/negroni-authz","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"6f3e866a7b287fd4da45bfe6215e8127a1cb237d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/casbin/negroni-authz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Fnegroni-authz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Fnegroni-authz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Fnegroni-authz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Fnegroni-authz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casbin","download_url":"https://codeload.github.com/casbin/negroni-authz/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Fnegroni-authz/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265558369,"owners_count":23787924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abac","access-control","acl","authorization","casbin","middleware","negroni","plugin","rbac"],"created_at":"2024-11-09T23:07:14.678Z","updated_at":"2025-07-25T04:04:48.672Z","avatar_url":"https://github.com/casbin.png","language":"Go","funding_links":["https://github.com/sponsors/casbin"],"categories":[],"sub_categories":[],"readme":"Negroni-authz [![Build Status](https://travis-ci.org/casbin/negroni-authz.svg?branch=master)](https://travis-ci.org/casbin/negroni-authz) [![Coverage Status](https://coveralls.io/repos/github/casbin/negroni-authz/badge.svg?branch=master)](https://coveralls.io/github/casbin/negroni-authz?branch=master) [![GoDoc](https://godoc.org/github.com/casbin/negroni-authz?status.svg)](https://godoc.org/github.com/casbin/negroni-authz)\n======\n\nNegroni-authz is an authorization middleware for [Negroni](https://github.com/urfave/negroni), it's based on [https://github.com/casbin/casbin](https://github.com/casbin/casbin).\n\n## Installation\n\n    go get github.com/casbin/negroni-authz\n\n## Simple Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"net/http\"\n\n    \"github.com/casbin/casbin\"\n    \"github.com/casbin/negroni-authz\"\n    \"github.com/urfave/negroni\"\n)\n\nfunc main() {\n    mux := http.NewServeMux()\n    mux.HandleFunc(\"/\", func(w http.ResponseWriter, req *http.Request) {\n        fmt.Fprintf(w, \"Welcome to the home page!\")\n    })\n\n    n := negroni.Classic()\n\n    // load the casbin model and policy from files, database is also supported.\n    e := casbin.NewEnforcer(\"authz_model.conf\", \"authz_policy.csv\")\n    n.Use(authz.Authorizer(e))\n\n    http.ListenAndServe(\":3000\", n)\n}\n```\n\n## How to control the access\n\nThe 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:\n\n1. ``subject``: the logged-on user name\n2. ``object``: the URL path for the web resource like \"dataset1/item1\"\n3. ``action``: HTTP method like GET, POST, PUT, DELETE, or the high-level actions you defined like \"read-file\", \"write-blog\"\n\nFor how to write authorization policy and other details, please refer to [the Casbin's documentation](https://github.com/casbin/casbin).\n\n## Getting Help\n\n- [Casbin](https://github.com/casbin/casbin)\n\n## License\n\nThis project is under MIT License. See the [LICENSE](LICENSE) file for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasbin%2Fnegroni-authz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasbin%2Fnegroni-authz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasbin%2Fnegroni-authz/lists"}