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