Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src/main
.gitignore
README.md
build.gradle
settings.gradle

README.md

Simple SpringBoot security demo with jCasbin

Really simple spring security demo. Protected data is accessible only after login. After login, each request must use same cookie JSESSIONID, because server is tracking http sessions by this cookie.

  • Authentication is handled by internal service itx.examples.springboot.security.services.UserAccessService
  • Authorization is handled by jCasbin library using RBAC model example in combination with Spring's Method Security.

Login

{
	"userName": "bob",
	"password": "secret"
}

Logout

Users, Passwords and Roles

  • alice / secret, ROLE_USER
  • bob / secret, ROLE_USER, ROLE_ADMIN

Get protected data

GET protected data for different user roles:

Change protected data

Set protected data for admin user roles:

Build and run

gradle clean build 
java -jar build/libs/spring-jcasbin-0.0.1-SNAPSHOT.jar 
You can’t perform that action at this time.