Skip to content
Spring Boot's RBAC & ABAC Authorization Plug-in based on jCasbin
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Add the code. Apr 30, 2018
src Move shared methods to top in HttpBasicAuthnFilter. May 8, 2018
.gitignore Ignore target folder. Apr 30, 2018
.travis.yml Add Travis CI and code coverage. Apr 30, 2018
LICENSE Initial commit Apr 28, 2018
README.md Add Java version to README. May 3, 2018
pom.xml Update jCasbin's version to 0.0.4-FIX in POM. May 3, 2018

README.md

jcasbin-springboot-plugin Build Status Coverage Status

jcasbin-springboot-plugin is an authorization middleware for Spring Boot, it's based on https://github.com/casbin/jcasbin. It is developed under the latest Spring Boot 2.0.1 and Java 8.

Installation

git clone https://github.com/jcasbin/jcasbin-springboot-plugin

Simple Example

This project itself is a working SpringBoot project that integrates with jCasbin. The steps to use jCasbin in your own SpringBoot project are:

  1. Copy the JCasbinAuthzFilter class to your own project.
  2. 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.
  3. 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.
  4. Make sure the JCasbinAuthzFilter filter is loaded, so it can filter all your requests. To do this, you can copy the WebComponentConfig class into the same folder with JCasbinAuthzFilter.

Getting Help

License

This project is under Apache 2.0 License. See the LICENSE file for the full license text.

You can’t perform that action at this time.