All Projects → shuaicj → spring-boot-shiro-jwt

shuaicj / spring-boot-shiro-jwt

Licence: MIT license
Integration of Spring Boot & Apache Shiro & JWT for authentication/authorization.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to spring-boot-shiro-jwt

Spring Boot Shiro
Apache Shiro integration with Spring Boot.
Stars: ✭ 177 (+704.55%)
Mutual labels:  shiro
Wms
一个基于Spring MVC、Spring、MyBatis、Shiro框架的仓库管理系统Demo。A warehouse management system implement with Spring MVC, Spring Framework,MyBstis,Shiro and MySQL
Stars: ✭ 248 (+1027.27%)
Mutual labels:  shiro
teedao
权限管理平台
Stars: ✭ 18 (-18.18%)
Mutual labels:  shiro
Febs Vue
SpringBoot,Shiro,JWT,Vue & Ant Design 前后端分离权限管理系统(精力有限,停止维护)
Stars: ✭ 2,079 (+9350%)
Mutual labels:  shiro
Spring Dubbo Service
微服务 spring dubbo项目:dubbo rpc;druid数据源连接池;mybatis配置集成,多数据源;jmx监控MBean;定时任务;aop;ftp;测试;Metrics监控;参数验证;跨域处理;shiro权限控制;consul服务注册,发现;redis分布式锁;SPI服务机制;cat监控;netty服务代理;websocket;disconf;mongodb集成;rest;docker;fescar
Stars: ✭ 224 (+918.18%)
Mutual labels:  shiro
cloud-note
无道云笔记,原生JSP的仿有道云笔记项目
Stars: ✭ 66 (+200%)
Mutual labels:  shiro
Lzhpo Shiro
美观、漂亮,我抽离出来的,拿来即用的简单后台管理系统!
Stars: ✭ 170 (+672.73%)
Mutual labels:  shiro
spring-boot-web
Spring Boot脚手架工程
Stars: ✭ 29 (+31.82%)
Mutual labels:  shiro
Nutz Book Project
做个平台
Stars: ✭ 228 (+936.36%)
Mutual labels:  shiro
shiro-pac4j-spring-boot-starter
pac4j + shiro
Stars: ✭ 14 (-36.36%)
Mutual labels:  shiro
Grbac
权限管理服务平台, 利用shiro权限管理设计思想, 支持单用户多角色,比RBAC的资源管理更细粒度化
Stars: ✭ 186 (+745.45%)
Mutual labels:  shiro
Joice
Java分布式开发平台:Spring, Spring MVC, MyBatis, Dubbo, Redis, Shiro权限管理, Quartz分布式调度, RocketMQ通信, 本地缓存, Redis缓存, 分布式缓存, 分布式事务
Stars: ✭ 219 (+895.45%)
Mutual labels:  shiro
CampusForum
校园论坛
Stars: ✭ 62 (+181.82%)
Mutual labels:  shiro
Oauth2 Shiro
Integrate OAuth2(oltu) and Shiro
Stars: ✭ 178 (+709.09%)
Mutual labels:  shiro
waynboot-sso
基于SpringBoot,Shiro,Redis,Mybatis,SSO的多模块系统,包含了SSO单点登陆, 通用后台管理,NewBee-mall商城,每日一文等多个模块,支持Shiro与SSO模块的集成,易于上手,学习,二次开发。
Stars: ✭ 33 (+50%)
Mutual labels:  shiro
Spring Boot Plus
🔥 Spring-Boot-Plus is a easy-to-use, high-speed, high-efficient,feature-rich, open source spring boot scaffolding. 🚀
Stars: ✭ 2,198 (+9890.91%)
Mutual labels:  shiro
Sureness
A simple and efficient open-source security framework that focus on protection of restful api.
Stars: ✭ 254 (+1054.55%)
Mutual labels:  shiro
doit
spring cloud , CAS , JHipster hybrid sample app
Stars: ✭ 14 (-36.36%)
Mutual labels:  shiro
springboot-learning-demo
springboot学习示例
Stars: ✭ 17 (-22.73%)
Mutual labels:  shiro
rbac-shiro
基于shiro的分布式权限管理系统。超级管理员:admin 密码:123456q 试用账号:test_001 密码:123456q; QQ交流群:333597649 Rbac Shiro
Stars: ✭ 52 (+136.36%)
Mutual labels:  shiro

Spring Boot Shiro JWT

Example of integrating Spring Boot & Apache Shiro & JWT together to do the authentication/authorization stuff.

Get Started

1. Start the service

mvn spring-boot:run

2. Get tokens

curl -i -H "Content-Type: application/json" -X POST -d '{"username":"alice","password":"alice-password"}' http://localhost:8080/login

You will see the token in response header for user alice. Note that the status code 401 will be returned if you provide incorrect username or password. See all predefined users in section Users, Roles and Permissions.

3. Access protected APIs

The general command to verify if the auth works is as follows:

curl -i -H "Authorization: Bearer token-you-got-in-step-2" http://localhost:8080/admin-only

or without token:

curl -i http://localhost:8080/admin-only

You can change the token and the URL as need. See all predefined URLs in section APIs. The response status code varies in different situations:

public api protected api
token valid and with enough authorities 200 200
token valid and without enough authorities 200 403
token missing or invalid 200 401

Users, Roles and Permissions

The following users are defined in the demo. For details, see schema.sql and data.sql.

username password roles permissions
alice alice-password admin *
bob bob-password user files:read,write
chris chris-password file-operator files:*
david david-password log-archiver files:read,archive:log

Note: the in-memory database called H2 is used by default. It's very easy to switch to MySQL as need. See application.yml.

APIs

Role Based APIs
roles required
/admin-only admin
/user-only user
/admin-or-user admin or user
/public-to-all
Permission Based APIs
permissions required
/read files:read
/write files:write
/archive files:archive
/read-log files:read:log
/write-log files:write:log
/archive-log files:archive:log

Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].