A simple example of casbin-spring-boot-starter.
JDK 17+
Run with:
./gradlew bootRun
Which will start a server at http://localhost:8080
with following api:
-
GET /auth/login
: login to system.Request params:
username
:admin
oruser
password
:pwd
Example:
GET /auth/login?username=admin&password=pwd
-
GET /auth/logout
: logout the system. -
GET /data/admins/all
: available when login withadmin
account. -
PUT /data/admins/state/{state}
: Change the protected data, available when login withadmin
/user
account. -
GET /data/users/all
: available when login withadmin
/user
account.
Special thanks to https://github.com/jveverka/spring-examples/tree/java-17/spring-jcasbin