Skip to content

Commit

Permalink
Merge pull request #169 from linhaojun857/dev
Browse files Browse the repository at this point in the history
Fix safety problem
  • Loading branch information
linhaojun857 authored Feb 19, 2024
2 parents f355e03 + 168d504 commit 0ce9d9a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ public interface AuthConstant {

String TOKEN_PREFIX = "Bearer ";

String SECRET = "huaweimian";

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

Expand All @@ -26,6 +27,9 @@
@Service
public class TokenServiceImpl implements TokenService {

@Value("${jwt.secret}")
private String secret;

@Autowired
private RedisService redisService;

Expand Down Expand Up @@ -89,7 +93,7 @@ public String getUuid() {
}

public SecretKey generalKey() {
byte[] encodedKey = Base64.getDecoder().decode(SECRET);
byte[] encodedKey = Base64.getDecoder().decode(secret);
return new SecretKeySpec(encodedKey, 0, encodedKey.length, "AES");
}

Expand Down
3 changes: 3 additions & 0 deletions aurora-springboot/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ mybatis-plus:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true

jwt:
secret: aurora

search:
mode: elasticsearch

Expand Down

0 comments on commit 0ce9d9a

Please sign in to comment.