https://github.com/hiwepy/security-jwt-spring-boot-starter
Spring Security 整合 JWT 登录
https://github.com/hiwepy/security-jwt-spring-boot-starter
jwt security spring-boot
Last synced: 2 months ago
JSON representation
Spring Security 整合 JWT 登录
- Host: GitHub
- URL: https://github.com/hiwepy/security-jwt-spring-boot-starter
- Owner: hiwepy
- License: apache-2.0
- Created: 2018-03-07T06:53:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-03-06T15:55:08.000Z (over 1 year ago)
- Last Synced: 2025-08-16T13:53:29.424Z (10 months ago)
- Topics: jwt, security, spring-boot
- Language: Java
- Homepage:
- Size: 501 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# security-jwt-spring-boot-starter
security starter for spring boot
### 组件简介
> 基于 Security 的 Spring Boot Starter 实现
主要 扩展 Security + JWT 与Spring Boot的整合,实现通过yaml配置即可实现权限拦截扩展,类似Shiro的 shiro.ini 配置方式
### 使用说明
##### 1、Spring Boot 项目添加 Maven 依赖
``` xml
com.github.hiwepy
security-jwt-spring-boot-starter
${project.version}
```
##### 2、在`application.yml`文件中增加如下配置
```yaml
spring:
# Spring Security 配置
security:
# 默认路径拦截规则定义
filter-chain-definition-map:
'[/]' : anon
'[/**/favicon.ico]' : anon
'[/webjars/**]': anon
'[/assets/**]' : anon
'[/error*]' : anon
'[/logo/**]' : anon
'[/swagger-ui.html**]' : anon
'[/swagger-resources/**]' : anon
'[/doc.html**]' : anon
'[/bycdao-ui/**]' : anon
'[/v2/**]' : anon
'[/kaptcha*]' : anon
'[/actuator*]' : anon
'[/actuator/**]' : anon
'[/druid/*]' : ipaddr[192.168.1.0/24]
'[/monitoring]' : roles[admin]
'[/monitoring2]' : roles[1,admin]
'[/monitoring3]' : perms[1,admin]
'[/monitoring4]' : perms[1]
stateless: true
jwt:
authc:
enabled: true
continue-chain-before-successful-authentication: false
login-url-patterns: /login/jwt
password-parameter: pwd
post-only: true
use-forward: false
authz:
enabled: true
allow-session-creation: false
continue-chain-before-successful-authentication: true
path-pattern: /**
```
##### 3、使用示例
```java
SecurityPrincipal principal = SubjectUtils.getPrincipal(SecurityPrincipal.class);
```
## Jeebiz 技术社区
Jeebiz 技术社区 **微信公共号**、**小程序**,欢迎关注反馈意见和一起交流,关注公众号回复「Jeebiz」拉你入群。
|公共号|小程序|
|---|---|
| | |