Skip to content
This repository was archived by the owner on Feb 23, 2025. It is now read-only.

Commit 0ce9d9a

Browse files
authored
Merge pull request #169 from linhaojun857/dev
Fix safety problem
2 parents f355e03 + 168d504 commit 0ce9d9a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

aurora-springboot/src/main/java/com/aurora/constant/AuthConstant.java

-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ public interface AuthConstant {
1010

1111
String TOKEN_PREFIX = "Bearer ";
1212

13-
String SECRET = "huaweimian";
14-
1513
}

aurora-springboot/src/main/java/com/aurora/service/impl/TokenServiceImpl.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.jsonwebtoken.Jwts;
88
import io.jsonwebtoken.SignatureAlgorithm;
99
import org.springframework.beans.factory.annotation.Autowired;
10+
import org.springframework.beans.factory.annotation.Value;
1011
import org.springframework.stereotype.Service;
1112
import org.springframework.util.StringUtils;
1213

@@ -26,6 +27,9 @@
2627
@Service
2728
public class TokenServiceImpl implements TokenService {
2829

30+
@Value("${jwt.secret}")
31+
private String secret;
32+
2933
@Autowired
3034
private RedisService redisService;
3135

@@ -89,7 +93,7 @@ public String getUuid() {
8993
}
9094

9195
public SecretKey generalKey() {
92-
byte[] encodedKey = Base64.getDecoder().decode(SECRET);
96+
byte[] encodedKey = Base64.getDecoder().decode(secret);
9397
return new SecretKeySpec(encodedKey, 0, encodedKey.length, "AES");
9498
}
9599

aurora-springboot/src/main/resources/application-prod.yml

+3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ mybatis-plus:
7777
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
7878
map-underscore-to-camel-case: true
7979

80+
jwt:
81+
secret: aurora
82+
8083
search:
8184
mode: elasticsearch
8285

0 commit comments

Comments
 (0)