feat(系统设置): 增加查询公钥的接口
This commit is contained in:
parent
b6d43a7846
commit
d350d9fa96
|
@ -39,7 +39,6 @@ public class LoginController {
|
|||
@GetMapping(value = "/is-login")
|
||||
@Operation(summary = "是否登录")
|
||||
public ResultHolder isLogin(HttpServletResponse response) throws Exception {
|
||||
RsaKey rsaKey = RsaUtil.getRsaKey();
|
||||
SessionUser user = SessionUtils.getUser();
|
||||
if (user != null) {
|
||||
UserDTO userDTO = baseUserService.getUserDTO(user.getId());
|
||||
|
@ -57,7 +56,14 @@ public class LoginController {
|
|||
return ResultHolder.success(sessionUser);
|
||||
}
|
||||
response.setStatus(HttpStatus.UNAUTHORIZED.value());
|
||||
return ResultHolder.error(MsHttpResultCode.UNAUTHORIZED.getCode(), rsaKey.getPublicKey());
|
||||
return ResultHolder.error(MsHttpResultCode.UNAUTHORIZED.getCode(), null);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get-key")
|
||||
@Operation(summary = "获取公钥")
|
||||
public ResultHolder getKey(HttpServletResponse response) throws Exception {
|
||||
RsaKey rsaKey = RsaUtil.getRsaKey();
|
||||
return ResultHolder.success(rsaKey.getPublicKey());
|
||||
}
|
||||
|
||||
@PostMapping(value = "/login")
|
||||
|
|
|
@ -986,6 +986,12 @@ public class UserControllerTests extends BaseTest {
|
|||
this.testUserRegisterError();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(14)
|
||||
public void testGetKey() throws Exception {
|
||||
this.requestGetWithOk("/get-key");
|
||||
}
|
||||
|
||||
//本测试类中会用到很多次用户数据。所以测试删除的方法放于最后
|
||||
@Test
|
||||
@Order(99)
|
||||
|
|
Loading…
Reference in New Issue