Q.CAST 자동로그인 복호화 추가 및 유저 정보 조회 api 수정
This commit is contained in:
parent
5ed22e1bc1
commit
bd922d9788
@ -116,4 +116,42 @@ public class LoginController {
|
|||||||
return loginEncryptId;
|
return loginEncryptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(description = "자동 로그인에 사용하는 아이디를 복호화한다.")
|
||||||
|
@PostMapping("/v1.0/user/login/autoLoginDecryptData")
|
||||||
|
public String getAutoLoginDecryptData(@RequestBody LoginUser loginUser) throws Exception {
|
||||||
|
|
||||||
|
String loginDecryptId = "";
|
||||||
|
|
||||||
|
if ("".equals(loginUser.getLoginId()) || loginUser.getLoginId() == null) {
|
||||||
|
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||||
|
message.getMessage("common.message.required.data", "User Id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// [0]. AES 암호화 키 : 날짜(YYYYMMDD) + autoLoginAesKey
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||||
|
String formattedDate = today.format(formatter);
|
||||||
|
String decryptKey = formattedDate + autoLoginAesKey;
|
||||||
|
|
||||||
|
// [1]. 복호화 진행
|
||||||
|
byte[] keyData = loginPasswordAesKey.getBytes();
|
||||||
|
SecretKey secureKey = new SecretKeySpec(keyData, "AES");
|
||||||
|
Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||||
|
c.init(Cipher.DECRYPT_MODE, secureKey,
|
||||||
|
new IvParameterSpec(decryptKey.substring(0, 16).getBytes("UTF-8")));
|
||||||
|
|
||||||
|
byte[] byteStr = Base64.getDecoder().decode(loginUser.getLoginId().getBytes());
|
||||||
|
|
||||||
|
// [2]. 복호화 값 셋팅
|
||||||
|
loginDecryptId = new String(c.doFinal(byteStr), "UTF-8");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR,
|
||||||
|
message.getMessage("common.message.error"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return loginDecryptId;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,9 +14,23 @@
|
|||||||
<select id="getUser" parameterType="com.interplug.qcast.biz.login.dto.LoginUser"
|
<select id="getUser" parameterType="com.interplug.qcast.biz.login.dto.LoginUser"
|
||||||
resultType="com.interplug.qcast.biz.login.dto.UserResponse">
|
resultType="com.interplug.qcast.biz.login.dto.UserResponse">
|
||||||
/* sqlid : com.interplug.qcast.login.findByLoginId */
|
/* sqlid : com.interplug.qcast.login.findByLoginId */
|
||||||
select USER_ID, SALE_STORE_ID, NAME, MAIL, TEL
|
select USER_ID
|
||||||
|
, SALE_STORE_ID AS STORE_ID
|
||||||
|
, CATEGORY
|
||||||
|
, NAME AS USER_NM
|
||||||
|
, NAME_KANA AS USER_NM_KANA
|
||||||
|
, TEL AS TEL_NO
|
||||||
|
, FAX
|
||||||
|
, MAIL AS EMAIL
|
||||||
|
, GROUP_ID
|
||||||
|
, MODULE_SELECT_GROUP_ID
|
||||||
|
, VERSION_MANAGEMENT_ID
|
||||||
|
, DISP_COST_PRICE
|
||||||
|
, DISP_SELLING_PRICE
|
||||||
|
, REGIST_DATETIME
|
||||||
|
, LAST_EDIT_DATETIME
|
||||||
|
, LAST_EDIT_USER
|
||||||
from M_USER
|
from M_USER
|
||||||
where USER_ID = #{username}
|
where USER_ID = #{loginId}
|
||||||
and PASSWORD = #{password}
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user