git clone https://github.com/jcasbin/jcasbin-springboot-plugin
This project itself is a working SpringBoot project that integrates with jCasbin. The steps to use jCasbin in your own SpringBoot project are:
- Copy the JCasbinAuthzFilter class to your own project.
- Copy authz_model.conf and 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 and Policy persistence.
- Replace the HttpBasicAuthnFilter class (which provides HTTP basic authentication) with your own authentication like OAuth, Apache Shiro, Spring Security, etc. Rewrite
JCasbinAuthzFilter's String getUser(HttpServletRequest request) method to make sure jCasbin can get the authenticated user name.
- Make sure the
JCasbinAuthzFilterfilter is loaded, so it can filter all your requests. To do this, you can copy the WebComponentConfig class into the same folder with
This project is under Apache 2.0 License. See the LICENSE file for the full license text.