Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
在jwt令牌新增时间戳,使得jwt更加安全,优化前端
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanyutin753 committed Dec 8, 2023
1 parent d815919 commit 296ec66
Show file tree
Hide file tree
Showing 46 changed files with 54 additions and 48 deletions.
2 changes: 1 addition & 1 deletion PandoraNext-TokensTool/src/views/homeIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
>
TokensTool
</span>
<el-tag>v0.4.7.1</el-tag>
<el-tag>v0.4.7.2</el-tag>
</div>
</template>
</el-page-header>
Expand Down
2 changes: 1 addition & 1 deletion PandoraNext-TokensTool/src/views/homeIphone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
<br />
欢迎大家来扩展
<a href="https://github.com/Yanyutin753/PandoraNext-TokensTool"
>PandoraNext-TokensTool v0.4.7.1
>PandoraNext-TokensTool v0.4.7.2
</a>
</h2>
</div>
Expand Down
4 changes: 2 additions & 2 deletions PandoraNext-TokensTool/src/views/loginIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<a href="https://ai.fakeopen.com/auth">Pandora地址</a>
欢迎大家来扩展
<a href="https://github.com/Yanyutin753/PandoraNext-TokensTool"
>PandoraNext-TokensTool v0.4.7.1
>PandoraNext-TokensTool v0.4.7.2
</a>
</h3>
</div>
Expand All @@ -89,7 +89,7 @@
<br />
欢迎大家来扩展
<a href="https://github.com/Yanyutin753/PandoraNext-TokensTool"
>PandoraNext-TokensTool v0.4.7.1
>PandoraNext-TokensTool v0.4.7.2
</a>
</h3>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Objec
String password = systemSetting.getLoginPassword();
String username = systemSetting.getLoginUsername();

JwtUtils.setSignKey(password);

//1.获取请求url。
String url = req.getRequestURL().toString();
log.info("请求的url: {}",url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.yyandywt99.pandoraNext.pojo.tls;
import com.yyandywt99.pandoraNext.pojo.validation;
import com.yyandywt99.pandoraNext.service.systemService;
import com.yyandywt99.pandoraNext.util.JwtUtils;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONArray;
import org.json.JSONException;
Expand All @@ -16,6 +17,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -88,10 +90,20 @@ public String requiredSetting(systemSetting tem){
else {
jsonObject.put("whitelist", JSONObject.NULL);
}
updateJsonValue(jsonObject,"license_id",tem.getLicense_id());

//4.7.2
if(! tem.getLoginPassword().equals(jsonObject.optString("loginPassword"))
|| ! tem.getLoginUsername().equals(jsonObject.optString("loginUsername"))){
Instant instant = Instant.now();
//时间戳
String key = String.valueOf(instant.toEpochMilli());
JwtUtils.setSignKey(key);
}

updateJsonValue(jsonObject,"loginUsername",tem.getLoginUsername());
updateJsonValue(jsonObject,"loginPassword",tem.getLoginPassword());

updateJsonValue(jsonObject,"license_id",tem.getLicense_id());
updateJsonValue(jsonObject,"autoToken_url",tem.getAutoToken_url());
updateJsonValue(jsonObject,"getTokenPassword",tem.getGetTokenPassword());
updateJsonValue(jsonObject,"containerName",tem.getContainerName());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.yyandywt99.pandoraNext;

import com.yyandywt99.pandoraNext.util.JwtUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.time.Instant;

/**
* @author YANGYANG
*/
Expand All @@ -17,8 +20,10 @@
@SpringBootApplication
public class tokensToolApplication {
public static void main(String[] args) {
log.info("PandoraNext-tokensTool v 0.4.7.1 版本,修改了jwt的漏洞问题,感谢您的使用!");
log.info("PandoraNext-tokensTool v 0.4.7.2 版本,修改了jwt的漏洞问题,新增时间戳来加强防御,感谢您的使用!");
Instant instant = Instant.now();
String key = String.valueOf(instant.toEpochMilli());
JwtUtils.setSignKey(key);
SpringApplication.run(tokensToolApplication.class, args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
@Data
@NoArgsConstructor
public class JwtUtils{
private static String signKey = "硬编码的伤";
//硬编码的伤
private static String signKey = "123456";
private static Long expire = 43200000L;

/**
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion rearServer/src/main/resources/static/css/540.e8716cf7.css

This file was deleted.

1 change: 1 addition & 0 deletions rearServer/src/main/resources/static/css/793.2d9edf6a.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rearServer/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Welcome to PandoraNext-TokensTool</title><script defer="defer" src="js/chunk-vendors.0ce29eef.js"></script><script defer="defer" src="js/app.d802ccc6.js"></script><link href="css/chunk-vendors.8a308144.css" rel="stylesheet"></head><body><div id="app"></div></body></html>
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Welcome to PandoraNext-TokensTool</title><script defer="defer" src="js/chunk-vendors.0ce29eef.js"></script><script defer="defer" src="js/app.031a48f4.js"></script><link href="css/chunk-vendors.8a308144.css" rel="stylesheet"></head><body><div id="app"></div></body></html>
2 changes: 0 additions & 2 deletions rearServer/src/main/resources/static/js/540.85c3d8f6.js

This file was deleted.

Loading

0 comments on commit 296ec66

Please sign in to comment.