Compare commits
3 Commits
b89d962a50
...
0969a7cd1f
Author | SHA1 | Date | |
---|---|---|---|
0969a7cd1f | |||
20f3edaeec | |||
4add59d197 |
@ -144,6 +144,10 @@ public class CaptchaController {
|
|||||||
Expression exp = parser.parseExpression(StringUtils.remove(code, "="));
|
Expression exp = parser.parseExpression(StringUtils.remove(code, "="));
|
||||||
code = exp.getValue(String.class);
|
code = exp.getValue(String.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("图片验证码:{}", code);
|
||||||
|
log.info("图片验证码uuid:{}", uuid);
|
||||||
|
|
||||||
RedisUtils.setCacheObject(verifyKey, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
|
RedisUtils.setCacheObject(verifyKey, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
|
||||||
CaptchaVo captchaVo = new CaptchaVo();
|
CaptchaVo captchaVo = new CaptchaVo();
|
||||||
captchaVo.setUuid(uuid);
|
captchaVo.setUuid(uuid);
|
||||||
|
@ -208,6 +208,8 @@ springdoc:
|
|||||||
packages-to-scan: com.fuyuanshen.generator
|
packages-to-scan: com.fuyuanshen.generator
|
||||||
- group: 5.工作流模块
|
- group: 5.工作流模块
|
||||||
packages-to-scan: com.fuyuanshen.workflow
|
packages-to-scan: com.fuyuanshen.workflow
|
||||||
|
- group: 设备管理模块
|
||||||
|
packages-to-scan: com.fuyuanshen.equipment
|
||||||
|
|
||||||
# 防止XSS攻击
|
# 防止XSS攻击
|
||||||
xss:
|
xss:
|
||||||
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.fuyuanshen.common.encrypt.utils;
|
||||||
|
|
||||||
|
import com.fuyuanshen.common.core.domain.model.LoginBody;
|
||||||
|
import com.fuyuanshen.common.core.domain.model.PasswordLoginBody;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录测试
|
||||||
|
*
|
||||||
|
* @author: 默苍璃
|
||||||
|
* @date: 2025-06-3014:29
|
||||||
|
*/
|
||||||
|
public class EncryptUtilsTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// System.out.println(EncryptUtils.encryptByBase64("123456"));
|
||||||
|
|
||||||
|
System.out.println(EncryptUtils.encryptByBase64("1234567890abcdef"));
|
||||||
|
|
||||||
|
String g = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==";
|
||||||
|
String s = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKNPuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gAkM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWowcSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99EcvDQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthhYhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3UP8iWi1Qw0Y=";
|
||||||
|
|
||||||
|
|
||||||
|
String s1 = EncryptUtils.encryptByRsa("MTIzNDU2Nzg5MGFiY2RlZg==", g);
|
||||||
|
System.out.println(s1);
|
||||||
|
String s2 = EncryptUtils.decryptByRsa("jJPaW7hgFXD/gjdkrfBOEUdXpPZnQg/LZUASoOJAOLU/XRVXO/5666CzyALjw7neK1ujvRuys4MdKCvr9cRARw==", s);
|
||||||
|
System.out.println(s2);
|
||||||
|
|
||||||
|
String s3 = EncryptUtils.decryptByBase64(s2);
|
||||||
|
System.out.println(s3);
|
||||||
|
|
||||||
|
String s4 = EncryptUtils.encryptByAes("123456", s3);
|
||||||
|
System.out.println(s4);
|
||||||
|
|
||||||
|
String s5 = EncryptUtils.decryptByAes(s4, s3);
|
||||||
|
System.out.println(s5);
|
||||||
|
|
||||||
|
|
||||||
|
// 1. 构造 LoginBody 对象
|
||||||
|
PasswordLoginBody loginBody = new PasswordLoginBody();
|
||||||
|
loginBody.setClientId("e5cd7e4891bf95d1d19206ce24a7b32e");
|
||||||
|
loginBody.setGrantType("password");
|
||||||
|
loginBody.setTenantId("000000");
|
||||||
|
loginBody.setCode("9");
|
||||||
|
loginBody.setUuid("04ab60c877ae4bb19e3c09ff5cb2a638");
|
||||||
|
loginBody.setUsername("admin");
|
||||||
|
loginBody.setPassword("admin123");
|
||||||
|
|
||||||
|
// 2. 使用更清晰的方式拼接 JSON 字符串
|
||||||
|
String jsonLoginBody = String.format(
|
||||||
|
"{"
|
||||||
|
+ "\"clientId\":\"%s\","
|
||||||
|
+ "\"grantType\":\"%s\","
|
||||||
|
+ "\"tenantId\":\"%s\","
|
||||||
|
+ "\"code\":\"%s\","
|
||||||
|
+ "\"uuid\":\"%s\","
|
||||||
|
+ "\"username\":\"%s\","
|
||||||
|
+ "\"password\":\"%s\""
|
||||||
|
+ "}",
|
||||||
|
loginBody.getClientId(),
|
||||||
|
loginBody.getGrantType(),
|
||||||
|
loginBody.getTenantId(),
|
||||||
|
loginBody.getCode(),
|
||||||
|
loginBody.getUuid(),
|
||||||
|
loginBody.getUsername(),
|
||||||
|
loginBody.getPassword()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
String S5 = EncryptUtils.encryptByAes(jsonLoginBody, s3);
|
||||||
|
System.out.println(S5);
|
||||||
|
|
||||||
|
String S6 = EncryptUtils.decryptByAes(S5, s3);
|
||||||
|
System.out.println(S6);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user