Compare commits

..

No commits in common. "0ae5974dc655525e2818feb4e075bde91ae99429" and "de05316d11f9ff4a83c3a635878235df171b9272" have entirely different histories.

1 changed files with 3 additions and 7 deletions

View File

@ -3,7 +3,6 @@ package com.chinaweal.aiccs.org.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chinaweal.aiccs.common.base.controller.BaseController;
import com.chinaweal.aiccs.common.base.entity.dto.login.LoginMessage;
import com.chinaweal.aiccs.common.util.OAuthTokenUtils;
import com.chinaweal.aiccs.common.util.SM4Utils;
import com.chinaweal.aiccs.common.util.StringUtils;
@ -523,14 +522,11 @@ public class OAuth2Controller extends BaseController {
@ApiOperation("获取一个加密登录的登录用数据串")
@GetMapping("sm4/encrypted/data")
public RestResult<String> getSm4EncryptedData(HttpServletRequest request) {
LoginMessage loginMessage = getLoginMessage(request);
if (loginMessage == null) {
AICUser loginUser = getLoginUser(request);
if (loginUser == null) {
return RestResult.error(ResultCode.USER_NOT_LOGGED_IN);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", loginMessage.getUserId());
jsonObject.put("username", loginMessage.getUsername());
jsonObject.put("nickname", loginMessage.getNickName());
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(loginUser));
jsonObject.put("expired", System.currentTimeMillis() + 1000 * 60 * 5);// 增加有效期
return RestResult.ok(SM4Utils.encrypt(jsonObject.toJSONString(), sm4Key));
}