فهرست منبع

fixed encryption

zero 1 سال پیش
والد
کامیت
b94bf3bd7d

+ 1 - 2
PCS/src/main/java/cn/cslg/permission/service/LoginService.java

@@ -405,7 +405,7 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
     }
 
     public void updatePersonnel(String privateKey, String publicKey, String symmetryKey, Integer personId) throws Exception {
-        if (StringUtils.isEmpty(privateKey) || StringUtils.isEmpty(publicKey) || StringUtils.isEmpty(symmetryKey)) {
+        if (StringUtils.isEmpty(privateKey) || StringUtils.isEmpty(publicKey) || Boolean.TRUE.equals(StringUtils.isEmpty(symmetryKey))) {
             Map<String, String> map = RSAUtils.generateKey();
             String publicKeyStr = map.get("publicKeyStr");
             String privateKeyStr = map.get("privateKeyStr");
@@ -518,7 +518,6 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
                     .eq(AssoFunctionModule::getAuthType, type));
             if (ObjectUtils.isNotEmpty(functionModule) && StringUtils.isNotEmpty(functionModule.getCode())) {
                 String moduleCode = functionModule.getCode();
-//                String encryptInfo = RSAUtils.encryptByPublicKey(moduleCode, publicKey);
                 String encryptInfo = AESUtils.encrypt(moduleCode, symmetryKey);
                 EncryptionFunctionVO functionVO = new EncryptionFunctionVO();
                 functionVO.setPermission(functionPath);

+ 1 - 1
PCS/src/test/java/cn/cslg/permission/EncryptionPersonTest.java

@@ -25,7 +25,7 @@ public class EncryptionPersonTest {
 
 
     @Test
-    public void test() {
+    public void test() throws Exception {
         EncryptionLoginDTO vo = new EncryptionLoginDTO();
         vo.setUsername("gaochangkui-qy");
         vo.setPassword("Xiaoshi221101*");