{"id":21252634,"url":"https://github.com/jcasbin/jfinal-authz","last_synced_at":"2025-07-11T01:33:00.990Z","repository":{"id":47770691,"uuid":"134684367","full_name":"jcasbin/jfinal-authz","owner":"jcasbin","description":"Casbin Authorization Plugin for JFinal","archived":false,"fork":false,"pushed_at":"2022-11-26T19:56:22.000Z","size":21,"stargazers_count":7,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-02T05:06:41.724Z","etag":null,"topics":["abac","access-control","authorization","casbin","jfinal","plugin","rbac"],"latest_commit_sha":null,"homepage":"https://github.com/casbin/jcasbin","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcasbin.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}},"created_at":"2018-05-24T08:21:10.000Z","updated_at":"2022-09-16T15:05:05.000Z","dependencies_parsed_at":"2023-01-22T20:01:13.959Z","dependency_job_id":null,"html_url":"https://github.com/jcasbin/jfinal-authz","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fjfinal-authz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fjfinal-authz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fjfinal-authz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fjfinal-authz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcasbin","download_url":"https://codeload.github.com/jcasbin/jfinal-authz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225669664,"owners_count":17505386,"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","authorization","casbin","jfinal","plugin","rbac"],"created_at":"2024-11-21T03:48:17.722Z","updated_at":"2024-11-21T03:48:18.336Z","avatar_url":"https://github.com/jcasbin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jcasbin-jfinal-plugin \n[![Build Status](https://github.com/jcasbin/jfinal-authz/actions/workflows/maven-ci.yml/badge.svg)](https://github.com/jcasbin/jfinal-authz/actions/workflows/maven-ci.yml)\n[![Maven Central](https://img.shields.io/maven-central/v/org.casbin/jcasbin-jfinal-plugin.svg)](https://central.sonatype.com/artifact/org.casbin/jcasbin-jfinal-plugin)\n\n\njcasbin-jfinal-plugin is an authorization middleware for [JFinal](http://www.jfinal.com/), it's based on [https://github.com/casbin/jcasbin](https://github.com/casbin/jcasbin). It is developed under the latest JFinal ``3.4`` and Java ``8``.\n\n## Installation\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.casbin\u003c/groupId\u003e\n    \u003cartifactId\u003ejcasbin-jfinal-plugin\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Simple Example\n\nThis project itself is a working JFinal project that integrates with jCasbin. The steps to use jCasbin in your own JFinal project are:\n\n1. Copy the [JCasbinAuthzInterceptor](https://github.com/jcasbin/jcasbin-jfinal-plugin/blob/master/src/main/java/org/jcasbin/plugins/JCasbinAuthzInterceptor.java) class to your own project.\n2. Copy [authz_model.conf](https://github.com/jcasbin/jcasbin-jfinal-plugin/blob/master/examples/authz_model.conf) and [authz_policy.csv](https://github.com/jcasbin/jcasbin-jfinal-plugin/blob/master/examples/authz_policy.csv) to your project. You can modify them to your own jCasbin model and policy (or loading policy from DB), see [Model persistence](https://github.com/casbin/casbin/wiki/Model-persistence) and [Policy persistence](https://github.com/casbin/casbin/wiki/Policy-persistence).\n3. Replace the [HttpBasicAuthnInterceptor](https://github.com/jcasbin/jcasbin-jfinal-plugin/blob/master/src/main/java/org/jcasbin/plugins/HttpBasicAuthnInterceptor.java) class (which provides [HTTP basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication)) with your own authentication like OAuth, Apache Shiro, Spring Security, etc. Rewrite ``JCasbinAuthzInterceptor``'s [String getUser(HttpServletRequest request)](https://github.com/jcasbin/jcasbin-jfinal-plugin/blob/master/src/main/java/org/jcasbin/plugins/JCasbinAuthzInterceptor.java#L40-L54) method to make sure jCasbin can get the authenticated user name.\n4. Make sure the ``JCasbinAuthzInterceptor`` interceptor is loaded, so it can filter all your requests. To do this, you can use the following code in your ``XXXConfig`` class:\n\n```java\npublic class DemoConfig extends JFinalConfig {\n    public void configInterceptor(Interceptors me) {\n        me.add(new JCasbinAuthzInterceptor());\n    }\n}\n```\n\n## Tutorials\n\n- [加强JFinal的权限管理：与jCasbin权限管理框架进行整合](http://www.jfinal.com/share/842)\n\n## Getting Help\n\n- [jCasbin](https://github.com/casbin/jcasbin)\n\n## License\n\nThis project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcasbin%2Fjfinal-authz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcasbin%2Fjfinal-authz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcasbin%2Fjfinal-authz/lists"}