Skip to content

Commit 1fbcf5d

Browse files
Merge pull request #60 from geekidea/dev
🇨🇳 1.3.0.RELEASE shiro+jwt
2 parents f182a87 + 1e00051 commit 1fbcf5d

File tree

61 files changed

+2218
-1044
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2218
-1044
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@
3131
logs
3232

3333

34+

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# 更新日志 CHANGELOG
22

3+
## [V1.3.0-RELEASE]
4+
5+
### ⭐️ New Features
6+
7+
### ⚡️ Optimization
8+
9+
### 📝 Added/Modified
10+
11+
12+
### 📔 Documentation
13+
14+
### 🔨 Dependency Upgrades
15+
- Upgrade to `Fastjson` 1.2.61
16+
17+
318
## [V1.2.3-RELEASE] 2019.09.09 :computer:
419
> spring-boot-plusV1.2.3发布,CentOS快速安装环境/构建/部署/启动项目
520

README-zh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ tail -f -n 1000 /root/spring-boot-plus-server/logs/spring-boot-plus.log
293293
```
294294
295295
## spring-boot-plus 视频 :movie_camera:
296+
- [5分钟完成增删改查](https://www.bilibili.com/video/av67401204)
296297
- [CentOS 快速安装 JDK/Git/Maven/Redis/MySQL](https://www.bilibili.com/video/av67218836/)
297298
- [CentOS 快速部署/构建/打包/运行项目](https://www.bilibili.com/video/av67218970/)
298299

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,17 +298,11 @@ tail -f -n 1000 /root/spring-boot-plus-server/logs/spring-boot-plus.log
298298
```
299299
300300
301-
## spring-boot-plus Video :movie_camera:
301+
## spring-boot-plus Videos :movie_camera:
302+
- [5-Minutes-Finish-CRUD](https://www.bilibili.com/video/av67401204)
302303
- [CentOS Quick Installation JDK/Git/Maven/Redis/MySQL](https://www.bilibili.com/video/av67218836/)
303304
- [CentOS Quick Build / Deploy / Launch Spring-boot-plus Project](https://www.bilibili.com/video/av67218970/)
304305
305306
306-
## Contact
307-
- Email: [springbootplus@aliyun.com](mailto:springbootplus@aliyun.com)
308-
- QQ Group
309-
310-
![spring-boot-plus QQ Group](https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/img/spring-boot-plus-qq-group.png)
311-
312-
313307
## License
314308
spring-boot-plus is under the Apache 2.0 license. See the [LICENSE](https://github.com/geekidea/spring-boot-plus/blob/master/LICENSE) file for details.

pom.xml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<groupId>io.geekidea</groupId>
2323
<artifactId>spring-boot-plus</artifactId>
24-
<version>1.2.3.RELEASE</version>
24+
<version>1.3.0.RELEASE</version>
2525
<packaging>jar</packaging>
2626

2727
<name>spring-boot-plus</name>
@@ -47,7 +47,7 @@
4747
<project.reporting.outputEncoding>${utf8}</project.reporting.outputEncoding>
4848
<project-parent.version>${parent.version}</project-parent.version>
4949
<java.version>1.8</java.version>
50-
<spring-boot.version>2.1.8.RELEASE</spring-boot.version>
50+
<spring-boot.version>2.1.0.RELEASE</spring-boot.version>
5151
<mybatis-plus-boot-starter.version>3.2.0</mybatis-plus-boot-starter.version>
5252
<fastjson.version>1.2.60</fastjson.version>
5353
<swagger2.version>2.6.1</swagger2.version>
@@ -67,6 +67,7 @@
6767
<spring-boot-admin.version>2.1.6</spring-boot-admin.version>
6868
<hutool.version>4.6.4</hutool.version>
6969
<junit.version>4.12</junit.version>
70+
<mapstruct.version>1.3.0.Final</mapstruct.version>
7071

7172
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
7273
<maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
@@ -239,12 +240,6 @@
239240
<artifactId>snakeyaml</artifactId>
240241
</dependency>
241242

242-
<dependency>
243-
<groupId>io.jsonwebtoken</groupId>
244-
<artifactId>jjwt</artifactId>
245-
<version>${jwt.version}</version>
246-
</dependency>
247-
248243
<dependency>
249244
<groupId>cn.hutool</groupId>
250245
<artifactId>hutool-all</artifactId>
@@ -256,6 +251,12 @@
256251
<groupId>de.codecentric</groupId>
257252
<artifactId>spring-boot-admin-starter-server</artifactId>
258253
<version>${spring-boot-admin.version}</version>
254+
<exclusions>
255+
<exclusion>
256+
<groupId>de.codecentric</groupId>
257+
<artifactId>spring-boot-admin-server-cloud</artifactId>
258+
</exclusion>
259+
</exclusions>
259260
</dependency>
260261
<dependency>
261262
<groupId>de.codecentric</groupId>
@@ -265,12 +266,44 @@
265266
<!-- spring boot admin end -->
266267

267268
<dependency>
268-
<groupId>junit</groupId>
269-
<artifactId>junit</artifactId>
270-
<version>${junit.version}</version>
271-
<scope>test</scope>
269+
<groupId>org.ini4j</groupId>
270+
<artifactId>ini4j</artifactId>
271+
<version>0.5.4</version>
272+
</dependency>
273+
274+
<dependency>
275+
<groupId>org.mapstruct</groupId>
276+
<artifactId>mapstruct</artifactId>
277+
<version>${mapstruct.version}</version>
278+
</dependency>
279+
<dependency>
280+
<groupId>org.mapstruct</groupId>
281+
<artifactId>mapstruct-processor</artifactId>
282+
<version>${mapstruct.version}</version>
283+
<scope>provided</scope>
272284
</dependency>
273285

286+
<!-- Shiro JWT start -->
287+
<dependency>
288+
<groupId>org.apache.shiro</groupId>
289+
<artifactId>shiro-spring-boot-web-starter</artifactId>
290+
<version>1.4.0</version>
291+
</dependency>
292+
293+
<dependency>
294+
<groupId>com.auth0</groupId>
295+
<artifactId>java-jwt</artifactId>
296+
<version>3.8.3</version>
297+
</dependency>
298+
299+
<!-- <dependency>-->
300+
<!-- <groupId>io.jsonwebtoken</groupId>-->
301+
<!-- <artifactId>jjwt</artifactId>-->
302+
<!-- <version>${jwt.version}</version>-->
303+
<!-- </dependency>-->
304+
305+
<!-- Spring Security JWT start -->
306+
274307
</dependencies>
275308

276309
<build>
@@ -387,7 +420,6 @@
387420
</executions>
388421
</plugin>
389422

390-
391423
</plugins>
392424

393425
</build>

src/bin/startup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ STARTUP_LOG="${STARTUP_LOG}application JAVA_OPT : ${JAVA_OPT}\n"
116116

117117

118118
# 打印启动命令
119-
STARTUP_LOG="${STARTUP_LOG}application background startup command: nohup java ${JAVA_OPT} -jar ${BASE_PATH}/lib/${APPLICATION_JAR} --spring.config.location=${CONFIG_DIR} > ${LOG_PATH} 2>&1 &\n"
119+
STARTUP_LOG="${STARTUP_LOG}application background startup command: nohup java ${JAVA_OPT} -jar ${BASE_PATH}/lib/${APPLICATION_JAR} --spring.config.location=${CONFIG_DIR} --logging.config=${CONFIG_DIR}logback.xml > ${LOG_PATH} 2>&1 &\n"
120120

121121

122122
#======================================================================

src/main/java/io/geekidea/springbootplus/common/api/ApiCode.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ public enum ApiCode {
3232

3333
NOT_PERMISSION(403, "没有权限"),
3434

35-
NOT_FOUND(404, "你请求的路径不存在"),
35+
NOT_FOUND(404, "你请求的资源不存在"),
3636

3737
FAIL(500, "操作失败"),
3838

39+
40+
LOGIN_EXCEPTION(4000,"登陆失败"),
41+
42+
3943
SYSTEM_EXCEPTION(5000,"系统异常!"),
4044

4145
PARAMETER_EXCEPTION(5001,"请求参数校验异常"),
@@ -44,7 +48,6 @@ public enum ApiCode {
4448

4549
HTTP_MEDIA_TYPE_EXCEPTION(5003,"HTTP Media 类型异常"),
4650

47-
SYSTEM_LOGIN_EXCEPTION(5005,"系统登录异常")
4851

4952
;
5053

src/main/java/io/geekidea/springbootplus/common/api/ApiResult.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ public static ApiResult ok(Object data){
9393
return result(ApiCode.SUCCESS,data);
9494
}
9595

96-
public static ApiResult ok(String key,Object value){
96+
public static ApiResult ok(Object data,String msg){
97+
return result(ApiCode.SUCCESS,msg,data);
98+
}
99+
100+
public static ApiResult okMap(String key,Object value){
97101
Map<String,Object> map = new HashMap<>();
98102
map.put(key,value);
99103
return ok(map);
@@ -122,4 +126,7 @@ public static ApiResult fail(String key,Object value){
122126
return result(ApiCode.FAIL,map);
123127
}
124128

129+
public static ApiResult fail() {
130+
return fail(ApiCode.FAIL);
131+
}
125132
}

src/main/java/io/geekidea/springbootplus/common/constant/CommonConstant.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,25 @@ public interface CommonConstant {
4141
/**
4242
* 登陆token
4343
*/
44-
String TOKEN = "token";
44+
String JWT_TOKEN_NAME = "token";
45+
46+
/**
47+
* JWT用户名
48+
*/
49+
String JWT_USERNAME = "username";
50+
51+
4552
/**
46-
* 刷新token
53+
* JWT刷新新token响应状态码
4754
*/
48-
String REFRESH_TOKEN = "refresh_token";
55+
int JWT_REFRESH_TOKEN_CODE = 460;
56+
57+
/**
58+
* JWT刷新新token响应状态码,
59+
* Redis中不存在,但jwt未过期,不生成新的token,返回361状态码
60+
*/
61+
int JWT_INVALID_TOKEN_CODE = 461;
62+
4963

5064
/**
5165
* 初始密码

src/main/java/io/geekidea/springbootplus/common/constant/CommonRedisKey.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,23 @@
2626
public interface CommonRedisKey {
2727

2828
/**
29-
* 系统登录用户
29+
* 登陆用户token信息key
3030
*/
31-
String LOGIN_SYS_USER = "login:sys:user:%s";
31+
String LOGIN_TOKEN = "login:token:%s";
32+
33+
/**
34+
* 登陆用户信息key
35+
*/
36+
String LOGIN_USER = "login:user:%s";
37+
38+
/**
39+
* 登陆用户盐值信息key
40+
*/
41+
String LOGIN_SALT= "login:salt:%s";
42+
3243
/**
33-
* 系统登录token
44+
* 登陆user hash key
3445
*/
35-
String LOGIN_TOKEN = "login:token";
46+
String LOGIN_USER_HASH = "login:user:hash";
3647

3748
}

0 commit comments

Comments
 (0)