forked from dyf/fys-Multi-tenant
登录测试
This commit is contained in:
@ -24,6 +24,13 @@ public class DecryptRequestBodyWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
private final byte[] body;
|
||||
|
||||
|
||||
/**
|
||||
* @param request
|
||||
* @param privateKey
|
||||
* @param headerFlag encrypt-key
|
||||
* @throws IOException
|
||||
*/
|
||||
public DecryptRequestBodyWrapper(HttpServletRequest request, String privateKey, String headerFlag) throws IOException {
|
||||
super(request);
|
||||
// 获取 AES 密码 采用 RSA 加密
|
||||
|
@ -19,31 +19,36 @@ public class EncryptUtilsTest {
|
||||
String s = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKNPuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gAkM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWowcSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99EcvDQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthhYhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3UP8iWi1Qw0Y=";
|
||||
|
||||
|
||||
/**
|
||||
* encrypt-key
|
||||
*/
|
||||
String s1 = EncryptUtils.encryptByRsa("MTIzNDU2Nzg5MGFiY2RlZg==", g);
|
||||
System.out.println(s1);
|
||||
System.out.println("-------------s1--------------");
|
||||
|
||||
String s2 = EncryptUtils.decryptByRsa("jJPaW7hgFXD/gjdkrfBOEUdXpPZnQg/LZUASoOJAOLU/XRVXO/5666CzyALjw7neK1ujvRuys4MdKCvr9cRARw==", s);
|
||||
System.out.println(s2);
|
||||
|
||||
System.out.println("-------------s2--------------");
|
||||
String s3 = EncryptUtils.decryptByBase64(s2);
|
||||
System.out.println(s3);
|
||||
|
||||
System.out.println("-------------s2--------------");
|
||||
String s4 = EncryptUtils.encryptByAes("123456", s3);
|
||||
System.out.println(s4);
|
||||
|
||||
System.out.println("-------------s2--------------");
|
||||
String s5 = EncryptUtils.decryptByAes(s4, s3);
|
||||
System.out.println(s5);
|
||||
|
||||
System.out.println("-------------s2--------------");
|
||||
|
||||
// 1. 构造 LoginBody 对象
|
||||
PasswordLoginBody loginBody = new PasswordLoginBody();
|
||||
loginBody.setClientId("e5cd7e4891bf95d1d19206ce24a7b32e");
|
||||
loginBody.setGrantType("password");
|
||||
loginBody.setTenantId("894078");
|
||||
loginBody.setCode("0");
|
||||
loginBody.setUuid("1c285b27f516486f9535face77023aeb");
|
||||
loginBody.setCode("2");
|
||||
loginBody.setUuid("d339659cea5245aab7df92642326218e");
|
||||
// loginBody.setUsername("admin");
|
||||
// loginBody.setPassword("admin123");
|
||||
loginBody.setUsername("dyf");
|
||||
loginBody.setUsername("fel");
|
||||
loginBody.setPassword("123456");
|
||||
|
||||
// 2. 使用更清晰的方式拼接 JSON 字符串
|
||||
@ -67,9 +72,12 @@ public class EncryptUtilsTest {
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* body
|
||||
*/
|
||||
String S5 = EncryptUtils.encryptByAes(jsonLoginBody, s3);
|
||||
System.out.println(S5);
|
||||
|
||||
System.out.println("-------------s5--------------");
|
||||
String S6 = EncryptUtils.decryptByAes(S5, s3);
|
||||
System.out.println(S6);
|
||||
|
||||
|
Reference in New Issue
Block a user