基于mall4j产品的二开项目后端
lee
2024-12-18 921461a3f906d74403aeb6a27051deb77eca10fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.yami.shop.systemtest.test;
 
import cn.hutool.crypto.symmetric.AES;
import com.yami.shop.security.common.dto.AuthenticationDTO;
import com.yami.shop.security.common.vo.TokenInfoVO;
import com.yami.shop.systemtest.constants.Constant;
import com.yami.shop.systemtest.util.HttpUtil;
 
import java.nio.charset.StandardCharsets;
 
public class LoginTest {
 
 
//    @Test
    public void doTest() {
        String url = Constant.API_URL + "/login";
        String userName = "ping";
        String password = "ping";
 
        AES aes = new AES("-mall4j-password".getBytes(StandardCharsets.UTF_8));
        password = aes.encryptBase64(System.currentTimeMillis() + password);
 
        AuthenticationDTO authenticationDTO = new AuthenticationDTO();
        authenticationDTO.setUserName(userName);
        authenticationDTO.setPassWord(password);
 
        TokenInfoVO token = HttpUtil.post(url, authenticationDTO, TokenInfoVO.class);
    }
 
}