diff --git a/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java b/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java
index d6b7c60896..b076281cf3 100644
--- a/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java
+++ b/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java
@@ -107,6 +107,7 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/plugin/lark/callBack*", ANON);
filterChainDefinitionMap.put("/plugin/lark/bind*", ANON);
filterChainDefinitionMap.put("/plugin/lark/getQrParam", ANON);
+ filterChainDefinitionMap.put("/plugin/lark/appId", ANON);
filterChainDefinitionMap.put("/plugin/larksuite/callBack*", ANON);
filterChainDefinitionMap.put("/plugin/larksuite/bind*", ANON);
filterChainDefinitionMap.put("/plugin/larksuite/getQrParam", ANON);
diff --git a/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java b/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java
index b07c8211fc..9233abde28 100644
--- a/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java
+++ b/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java
@@ -6,6 +6,7 @@ import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.util.JWTUtils;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.exception.DEException;
+import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.DeLogUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
@@ -15,8 +16,10 @@ import io.dataease.plugins.common.base.domain.SysUserAssist;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
+import io.dataease.plugins.xpack.lark.dto.entity.LarkAppUserEntity;
import io.dataease.plugins.xpack.lark.dto.entity.LarkQrResult;
import io.dataease.plugins.xpack.lark.dto.entity.LarkUserInfo;
+import io.dataease.plugins.xpack.lark.dto.response.LarkAppUserResult;
import io.dataease.plugins.xpack.lark.dto.response.LarkInfo;
import io.dataease.plugins.xpack.lark.service.LarkXpackService;
import io.dataease.service.sys.SysUserService;
@@ -48,6 +51,13 @@ public class XLarkServer {
@Resource
private SysUserService sysUserService;
+ @ResponseBody
+ @GetMapping("/appId")
+ public String getAppId() {
+ LarkXpackService larkXpackService = SpringContextUtil.getBean(LarkXpackService.class);
+ return larkXpackService.appId();
+ }
+
@ResponseBody
@GetMapping("/info")
public LarkInfo getLarkInfo() {
@@ -81,8 +91,12 @@ public class XLarkServer {
return larkXpackService.getQrParam();
}
- @GetMapping("/callBack")
- public ModelAndView callBack(@RequestParam("code") String code, @RequestParam("state") String state) {
+ @GetMapping("/callBackWithoutLogin")
+ public ModelAndView callBackWithoutLogin(@RequestParam("code") String code) {
+ return privateCallBack(code, null, true);
+ }
+
+ private ModelAndView privateCallBack(String code, String state, Boolean withoutLogin) {
ModelAndView modelAndView = new ModelAndView("redirect:/");
HttpServletResponse response = ServletUtils.response();
LarkXpackService larkXpackService = null;
@@ -96,7 +110,14 @@ public class XLarkServer {
if (!isOpen) {
DEException.throwException("未开启飞书");
}
- LarkUserInfo larkUserInfo = larkXpackService.userInfo(code, state, false);
+ LarkUserInfo larkUserInfo = null;
+ if (withoutLogin) {
+ LarkAppUserResult larkAppUserResult = larkXpackService.userInfoWithoutLogin(code);
+ LarkAppUserEntity userResultData = larkAppUserResult.getData();
+ larkUserInfo = BeanUtils.copyBean(new LarkUserInfo(), userResultData);
+ } else {
+ larkUserInfo = larkXpackService.userInfo(code, state, false);
+ }
String username = larkUserInfo.getUser_id();
SysUserEntity sysUserEntity = authUserService.getUserByLarkId(username);
if (null == sysUserEntity) {
@@ -140,6 +161,11 @@ public class XLarkServer {
return modelAndView;
}
+ @GetMapping("/callBack")
+ public ModelAndView callBack(@RequestParam("code") String code, @RequestParam("state") String state) {
+ return privateCallBack(code, state, false);
+ }
+
private void bindError(HttpServletResponse response, String url, String errorMsg) {
Cookie cookie_error = new Cookie("LarkError", errorMsg);
cookie_error.setPath("/");
diff --git a/frontend/src/api/user.js b/frontend/src/api/user.js
index ac4b3154b0..57e03c64c3 100644
--- a/frontend/src/api/user.js
+++ b/frontend/src/api/user.js
@@ -130,6 +130,13 @@ export function larkStatus() {
})
}
+export function larkAppId() {
+ return request({
+ url: '/plugin/lark/appId',
+ method: 'get'
+ })
+}
+
export function larksuiteStatus() {
return request({
url: '/api/auth/isOpenLarksuite',
diff --git a/frontend/src/views/DeAutoLogin.vue b/frontend/src/views/DeAutoLogin.vue
index 9dce10e49a..1f7495e24d 100644
--- a/frontend/src/views/DeAutoLogin.vue
+++ b/frontend/src/views/DeAutoLogin.vue
@@ -4,45 +4,98 @@
class="de-auto-login"
>