This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a commit to branch sync
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git

commit cb738d2a50f0f868a27a153b7fd53d030735f3be
Author: benjobs <[email protected]>
AuthorDate: Fri May 31 19:35:12 2024 +0800

    [Improve] CommonService rename to ServiceHelper
---
 .../console/base/config/OpenapiConfig.java         | 14 ++--
 .../console/core/annotation/AppUpdated.java        |  4 +-
 .../console/core/aspect/StreamParkAspect.java      |  6 +-
 .../console/core/controller/AlertController.java   | 14 ----
 .../CommonServiceImpl.java => ServiceHelper.java}  | 79 +++++++++++++++-------
 .../impl/ApplicationActionServiceImpl.java         | 12 ++--
 .../impl/ApplicationManageServiceImpl.java         |  8 +--
 .../impl/SparkApplicationActionServiceImpl.java    | 13 ++--
 .../impl/SparkApplicationManageServiceImpl.java    |  8 +--
 .../core/service/impl/AppBuildPipeServiceImpl.java | 10 +--
 .../core/service/impl/FlinkClusterServiceImpl.java |  6 +-
 .../core/service/impl/ResourceServiceImpl.java     |  6 +-
 .../core/service/impl/SavePointServiceImpl.java    |  3 +-
 .../service/impl/SparkAppBuildPipeServiceImpl.java | 10 +--
 .../core/service/impl/VariableServiceImpl.java     |  6 +-
 .../console/system/authentication/JWTFilter.java   |  1 +
 .../console/system/authentication/JWTToken.java    | 11 ++-
 .../console/system/authentication/JWTUtil.java     |  1 -
 .../console/system/authentication/ShiroConfig.java | 70 +++++++++----------
 .../console/system/authentication/ShiroRealm.java  |  1 +
 .../system/controller/AccessTokenController.java   | 71 ++-----------------
 .../system/controller/MemberController.java        | 14 ++--
 .../console/system/controller/MenuController.java  | 11 +--
 .../system/controller/PassportController.java      | 63 ++++++++++++++---
 .../console/system/controller/RoleController.java  |  9 ---
 .../console/system/controller/TeamController.java  |  8 ---
 .../console/system/controller/UserController.java  | 32 ++++-----
 .../console/system/service/UserService.java        |  2 +
 .../service/impl/AccessTokenServiceImpl.java       |  2 +-
 .../system/service/impl/TeamServiceImpl.java       |  6 +-
 .../system/service/impl/UserServiceImpl.java       | 65 ++++++++++--------
 31 files changed, 273 insertions(+), 293 deletions(-)

diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/OpenapiConfig.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/OpenapiConfig.java
index 445495e2a..3cfd02e3c 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/OpenapiConfig.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/OpenapiConfig.java
@@ -42,11 +42,16 @@ import java.util.Collections;
 public class OpenapiConfig implements WebMvcConfigurer {
 
   private static final String OPEN_API_INFO_OVERVIEW = "Apache StreamPark Api 
Docs";
+  private static final String OPEN_API_INFO_DESCRIPTION =
+      "Apache StreamPark Open API for third-party system integration";
   private static final String OPEN_API_INFO_VERSION = "2.2.0-SNAPSHOT";
   private static final String OPEN_API_INFO_LICENSE_NAME = "Apache-2.0 
license";
   private static final String OPEN_API_INFO_CONTACT_NAME = "Apache StreamPark";
   private static final String OPEN_API_INFO_CONTACT_URL = 
"https://streampark.apache.org";;
   private static final String OPEN_API_INFO_CONTACT_EMAIL = 
"[email protected]";
+  private static final String OPEN_API_GROUP = "Open API";
+
+  private final String[] paths = new String[] {"/flink/app/start", 
"/flink/app/cancel"};
 
   @Bean
   public OpenAPI apiV1Info() {
@@ -54,7 +59,7 @@ public class OpenapiConfig implements WebMvcConfigurer {
         .info(
             new Info()
                 .title(OPEN_API_INFO_OVERVIEW)
-                .description(OPEN_API_INFO_OVERVIEW)
+                .description(OPEN_API_INFO_DESCRIPTION)
                 .contact(
                     new Contact()
                         .name(OPEN_API_INFO_CONTACT_NAME)
@@ -77,11 +82,6 @@ public class OpenapiConfig implements WebMvcConfigurer {
 
   @Bean
   public GroupedOpenApi publicApiV1() {
-    return 
GroupedOpenApi.builder().group("v1").pathsToExclude("/v2/**").build();
-  }
-
-  @Bean
-  public GroupedOpenApi publicApiV2() {
-    return GroupedOpenApi.builder().group("v2").pathsToMatch("/v2/**").build();
+    return 
GroupedOpenApi.builder().group(OPEN_API_GROUP).pathsToMatch(paths).build();
   }
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/annotation/AppUpdated.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/annotation/AppUpdated.java
index e76ee5cfd..ce416c09d 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/annotation/AppUpdated.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/annotation/AppUpdated.java
@@ -17,7 +17,7 @@
 
 package org.apache.streampark.console.core.annotation;
 
-import org.apache.streampark.console.core.aspect.ConsoleAspect;
+import org.apache.streampark.console.core.aspect.StreamParkAspect;
 import org.apache.streampark.console.core.watcher.FlinkAppHttpWatcher;
 
 import org.aspectj.lang.ProceedingJoinPoint;
@@ -31,7 +31,7 @@ import java.lang.annotation.Target;
  * In the controller({@link org.apache.streampark.console.core.controller}), 
If some method causes
  * application state update, need to add this annotation, This annotation 
marks which methods will
  * cause the application to be updated, Will work together with {@link
- * ConsoleAspect#appUpdated(ProceedingJoinPoint)}, The final purpose will be 
refresh {@link
+ * StreamParkAspect#appUpdated(ProceedingJoinPoint)}, The final purpose will 
be refresh {@link
  * FlinkAppHttpWatcher#WATCHING_APPS}, Make the state of the job consistent 
with the database
  */
 @Target(ElementType.METHOD)
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/StreamParkAspect.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/StreamParkAspect.java
index 084a702ab..c747590a7 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/StreamParkAspect.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/StreamParkAspect.java
@@ -23,7 +23,7 @@ import org.apache.streampark.console.core.annotation.OpenAPI;
 import org.apache.streampark.console.core.annotation.PermissionScope;
 import org.apache.streampark.console.core.entity.Application;
 import org.apache.streampark.console.core.enums.UserTypeEnum;
-import org.apache.streampark.console.core.service.CommonService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import 
org.apache.streampark.console.core.service.application.ApplicationManageService;
 import org.apache.streampark.console.core.watcher.FlinkAppHttpWatcher;
 import org.apache.streampark.console.system.entity.AccessToken;
@@ -54,7 +54,7 @@ import org.springframework.stereotype.Component;
 public class StreamParkAspect {
 
   @Autowired private FlinkAppHttpWatcher flinkAppHttpWatcher;
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
   @Autowired private MemberService memberService;
   @Autowired private ApplicationManageService applicationManageService;
 
@@ -101,7 +101,7 @@ public class StreamParkAspect {
     PermissionScope permissionScope =
         methodSignature.getMethod().getAnnotation(PermissionScope.class);
 
-    User currentUser = commonService.getCurrentUser();
+    User currentUser = serviceHelper.getLoginUser();
     ApiAlertException.throwIfNull(currentUser, "Permission denied, please 
login first.");
 
     boolean isAdmin = currentUser.getUserType() == UserTypeEnum.ADMIN;
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
index 234e5259f..5b115fb7b 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
@@ -28,10 +28,6 @@ import 
org.apache.streampark.console.core.service.alert.AlertConfigService;
 import org.apache.streampark.console.core.service.alert.AlertService;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.Parameters;
-import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.annotation.Validated;
@@ -48,7 +44,6 @@ import java.util.Date;
 import java.util.List;
 import java.util.TimeZone;
 
-@Tag(name = "ALERT_TAG")
 @Slf4j
 @Validated
 @RequiredArgsConstructor
@@ -60,35 +55,30 @@ public class AlertController {
 
   private final AlertService alertService;
 
-  @Operation(summary = "Create alert config")
   @PostMapping(value = "/add")
   public RestResponse createAlertConfig(@RequestBody AlertConfigParams params) 
{
     boolean save = alertConfigService.save(AlertConfig.of(params));
     return RestResponse.success(save);
   }
 
-  @Operation(summary = "Check alert config exist")
   @PostMapping(value = "/exists")
   public RestResponse verifyAlertConfig(@RequestBody AlertConfigParams params) 
{
     boolean exist = alertConfigService.exist(AlertConfig.of(params));
     return RestResponse.success(exist);
   }
 
-  @Operation(summary = "Update alert config")
   @PostMapping(value = "/update")
   public RestResponse updateAlertConfig(@RequestBody AlertConfigParams params) 
{
     boolean update = alertConfigService.updateById(AlertConfig.of(params));
     return RestResponse.success(update);
   }
 
-  @Operation(summary = "Get alert config")
   @PostMapping("/get")
   public RestResponse getAlertConfig(@RequestBody AlertConfigParams params) {
     AlertConfig alertConfig = alertConfigService.getById(params.getId());
     return RestResponse.success(AlertConfigParams.of(alertConfig));
   }
 
-  @Operation(summary = "List alert configs (Pagination)")
   @PostMapping(value = "/list")
   public RestResponse alertConfigsPaginationList(
       @RequestBody AlertConfigParams params, RestRequest request) {
@@ -96,15 +86,12 @@ public class AlertController {
     return RestResponse.success(page);
   }
 
-  @Operation(summary = "List alert configs")
   @PostMapping(value = "/listWithOutPage")
   public RestResponse alertConfigsList() {
     List<AlertConfig> page = alertConfigService.list();
     return RestResponse.success(page);
   }
 
-  @Operation(summary = "Delete alert config")
-  @Parameters({@Parameter(name = "id", required = true, description = "config 
id")})
   @DeleteMapping("/delete")
   public RestResponse deleteAlertConfig(
       @RequestParam("id") @NotNull(message = "config id must be not null") 
Long id) {
@@ -112,7 +99,6 @@ public class AlertController {
     return RestResponse.success(result);
   }
 
-  @Operation(summary = "Send alert config")
   @PostMapping("/send")
   public RestResponse sendAlert(Long id) throws AlertException {
     AlertTemplate alertTemplate = new AlertTemplate();
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/CommonServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/ServiceHelper.java
similarity index 63%
rename from 
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/CommonServiceImpl.java
rename to 
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/ServiceHelper.java
index b4e6e50cf..f30ae1797 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/CommonServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/ServiceHelper.java
@@ -15,62 +15,75 @@
  * limitations under the License.
  */
 
-package org.apache.streampark.console.core.service.impl;
+package org.apache.streampark.console.core.service;
 
 import org.apache.streampark.console.base.exception.ApiAlertException;
+import org.apache.streampark.console.base.exception.ApiDetailException;
 import org.apache.streampark.console.base.util.WebUtils;
 import org.apache.streampark.console.core.entity.FlinkEnv;
 import org.apache.streampark.console.core.entity.SparkEnv;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.system.authentication.JWTUtil;
 import org.apache.streampark.console.system.entity.User;
 import org.apache.streampark.console.system.service.UserService;
+import org.apache.streampark.flink.kubernetes.ingress.IngressController;
 
 import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.AuthenticationException;
 
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import io.fabric8.kubernetes.client.KubernetesClientException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
-import java.util.Optional;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @Service
-public class CommonServiceImpl implements CommonService {
+public class ServiceHelper {
 
-  private String sqlClientJar = null;
-
-  private String sparkSqlClientJar = null;
+  @Autowired private SettingService settingService;
 
   @Autowired private UserService userService;
 
-  @Override
-  public User getCurrentUser() {
+  private String flinkSqlClientJar = null;
+
+  private String sparkSqlClientJar = null;
+
+  public User getLoginUser() {
     String token = (String) SecurityUtils.getSubject().getPrincipal();
     Long userId = JWTUtil.getUserId(token);
+    if (userId == null) {
+      throw new AuthenticationException("Unauthorized");
+    }
     return userService.getById(userId);
   }
 
-  @Override
   public Long getUserId() {
-    return 
Optional.ofNullable(getCurrentUser()).map(User::getUserId).orElse(null);
+    User user = getLoginUser();
+    if (user != null) {
+      return user.getUserId();
+    }
+    return null;
   }
 
-  @Override
-  public String getSqlClientJar(FlinkEnv flinkEnv) {
-    if (sqlClientJar == null) {
+  public String getFlinkSqlClientJar(FlinkEnv flinkEnv) {
+    if (flinkSqlClientJar == null) {
       File localClient = WebUtils.getAppClientDir();
       ApiAlertException.throwIfFalse(
           localClient.exists(), "[StreamPark] " + localClient + " no exists. 
please check.");
+
+      String regex =
+          String.format("streampark-flink-sqlclient_%s-.*\\.jar", 
flinkEnv.getScalaVersion());
+
       List<String> jars =
           Arrays.stream(Objects.requireNonNull(localClient.list()))
-              .filter(
-                  x ->
-                      x.matches(
-                          "streampark-flink-sqlclient_" + 
flinkEnv.getScalaVersion() + "-.*\\.jar"))
+              .filter(x -> x.matches(regex))
               .collect(Collectors.toList());
 
       ApiAlertException.throwIfTrue(
@@ -80,14 +93,12 @@ public class CommonServiceImpl implements CommonService {
       ApiAlertException.throwIfTrue(
           jars.size() > 1,
           "[StreamPark] found multiple streampark-flink-sqlclient jar in " + 
localClient);
-
-      sqlClientJar = jars.get(0);
+      flinkSqlClientJar = jars.get(0);
     }
-    return sqlClientJar;
+    return flinkSqlClientJar;
   }
 
-  @Override
-  public String getSqlClientJar(SparkEnv sparkEnv) {
+  public String getSparkSqlClientJar(SparkEnv sparkEnv) {
     if (sparkSqlClientJar == null) {
       File localClient = WebUtils.getAppClientDir();
       ApiAlertException.throwIfFalse(
@@ -112,4 +123,26 @@ public class CommonServiceImpl implements CommonService {
     }
     return sparkSqlClientJar;
   }
+
+  public String rollViewLog(String path, int offset, int limit) {
+    try {
+      File file = new File(path);
+      if (file.exists() && file.isFile()) {
+        try (Stream<String> stream = Files.lines(Paths.get(path))) {
+          return 
stream.skip(offset).limit(limit).collect(Collectors.joining("\r\n"));
+        }
+      }
+      return null;
+    } catch (Exception e) {
+      throw new ApiDetailException("roll view log error: " + e);
+    }
+  }
+
+  public void configureIngress(String clusterId, String namespace)
+      throws KubernetesClientException {
+    String domainName = settingService.getIngressModeDefault();
+    if (StringUtils.isNotBlank(domainName)) {
+      IngressController.configureIngress(domainName, clusterId, namespace);
+    }
+  }
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationActionServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationActionServiceImpl.java
index 60047f481..be0d4a271 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationActionServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationActionServiceImpl.java
@@ -54,12 +54,12 @@ import 
org.apache.streampark.console.core.service.AppBuildPipeService;
 import org.apache.streampark.console.core.service.ApplicationBackUpService;
 import org.apache.streampark.console.core.service.ApplicationConfigService;
 import org.apache.streampark.console.core.service.ApplicationLogService;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.core.service.FlinkClusterService;
 import org.apache.streampark.console.core.service.FlinkEnvService;
 import org.apache.streampark.console.core.service.FlinkSqlService;
 import org.apache.streampark.console.core.service.ResourceService;
 import org.apache.streampark.console.core.service.SavePointService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.core.service.SettingService;
 import org.apache.streampark.console.core.service.VariableService;
 import 
org.apache.streampark.console.core.service.application.ApplicationActionService;
@@ -151,7 +151,7 @@ public class ApplicationActionServiceImpl extends 
ServiceImpl<ApplicationMapper,
 
   @Autowired private SettingService settingService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
   @Autowired private FlinkK8sWatcher k8SFlinkTrackMonitor;
 
@@ -241,7 +241,7 @@ public class ApplicationActionServiceImpl extends 
ServiceImpl<ApplicationMapper,
     applicationLog.setJobManagerUrl(application.getJobManagerUrl());
     applicationLog.setOptionTime(new Date());
     applicationLog.setYarnAppId(application.getClusterId());
-    applicationLog.setUserId(commonService.getUserId());
+    applicationLog.setUserId(serviceHelper.getUserId());
 
     if (appParam.getSavePointed()) {
       FlinkAppHttpWatcher.addSavepoint(application.getId());
@@ -253,7 +253,7 @@ public class ApplicationActionServiceImpl extends 
ServiceImpl<ApplicationMapper,
     application.setOptionTime(new Date());
     this.baseMapper.updateById(application);
 
-    Long userId = commonService.getUserId();
+    Long userId = serviceHelper.getUserId();
     if (!application.getUserId().equals(userId)) {
       FlinkAppHttpWatcher.addCanceledApp(application.getId(), userId);
     }
@@ -498,7 +498,7 @@ public class ApplicationActionServiceImpl extends 
ServiceImpl<ApplicationMapper,
     applicationLog.setOptionName(OperationEnum.START.getValue());
     applicationLog.setAppId(application.getId());
     applicationLog.setOptionTime(new Date());
-    applicationLog.setUserId(commonService.getUserId());
+    applicationLog.setUserId(serviceHelper.getUserId());
     return applicationLog;
   }
 
@@ -637,7 +637,7 @@ public class ApplicationActionServiceImpl extends 
ServiceImpl<ApplicationMapper,
         FlinkSql flinkSql = flinkSqlService.getEffective(application.getId(), 
false);
         AssertUtils.notNull(flinkSql);
         // 1) dist_userJar
-        String sqlDistJar = commonService.getSqlClientJar(flinkEnv);
+        String sqlDistJar = serviceHelper.getFlinkSqlClientJar(flinkEnv);
         // 2) appConfig
         appConf =
             applicationConfig == null
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationManageServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationManageServiceImpl.java
index 0fce782c3..4f64849df 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationManageServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationManageServiceImpl.java
@@ -45,13 +45,13 @@ import 
org.apache.streampark.console.core.service.AppBuildPipeService;
 import org.apache.streampark.console.core.service.ApplicationBackUpService;
 import org.apache.streampark.console.core.service.ApplicationConfigService;
 import org.apache.streampark.console.core.service.ApplicationLogService;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.core.service.EffectiveService;
 import org.apache.streampark.console.core.service.FlinkClusterService;
 import org.apache.streampark.console.core.service.FlinkSqlService;
 import org.apache.streampark.console.core.service.ProjectService;
 import org.apache.streampark.console.core.service.ResourceService;
 import org.apache.streampark.console.core.service.SavePointService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.core.service.SettingService;
 import org.apache.streampark.console.core.service.YarnQueueService;
 import 
org.apache.streampark.console.core.service.application.ApplicationManageService;
@@ -121,7 +121,7 @@ public class ApplicationManageServiceImpl extends 
ServiceImpl<ApplicationMapper,
 
   @Autowired private SettingService settingService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
   @Autowired private FlinkK8sWatcher k8SFlinkTrackMonitor;
 
@@ -321,7 +321,7 @@ public class ApplicationManageServiceImpl extends 
ServiceImpl<ApplicationMapper,
   public boolean create(Application appParam) {
     ApiAlertException.throwIfNull(
         appParam.getTeamId(), "The teamId can't be null. Create application 
failed.");
-    appParam.setUserId(commonService.getUserId());
+    appParam.setUserId(serviceHelper.getUserId());
     appParam.setState(FlinkAppStateEnum.ADDED.getValue());
     appParam.setRelease(ReleaseStateEnum.NEED_RELEASE.get());
     appParam.setOptionState(OptionStateEnum.NONE.getValue());
@@ -431,7 +431,7 @@ public class ApplicationManageServiceImpl extends 
ServiceImpl<ApplicationMapper,
     newApp.setResourceFrom(oldApp.getResourceFrom());
     newApp.setProjectId(oldApp.getProjectId());
     newApp.setModule(oldApp.getModule());
-    newApp.setUserId(commonService.getUserId());
+    newApp.setUserId(serviceHelper.getUserId());
     newApp.setState(FlinkAppStateEnum.ADDED.getValue());
     newApp.setRelease(ReleaseStateEnum.NEED_RELEASE.get());
     newApp.setOptionState(OptionStateEnum.NONE.getValue());
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/SparkApplicationActionServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/SparkApplicationActionServiceImpl.java
index b65375104..62f64c23e 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/SparkApplicationActionServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/SparkApplicationActionServiceImpl.java
@@ -52,10 +52,10 @@ import 
org.apache.streampark.console.core.mapper.SparkApplicationMapper;
 import org.apache.streampark.console.core.service.AppBuildPipeService;
 import org.apache.streampark.console.core.service.ApplicationConfigService;
 import org.apache.streampark.console.core.service.ApplicationLogService;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.core.service.FlinkClusterService;
 import org.apache.streampark.console.core.service.FlinkSqlService;
 import org.apache.streampark.console.core.service.ResourceService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.core.service.SparkEnvService;
 import org.apache.streampark.console.core.service.VariableService;
 import 
org.apache.streampark.console.core.service.application.SparkApplicationActionService;
@@ -124,7 +124,7 @@ public class SparkApplicationActionServiceImpl
 
   @Autowired private FlinkSqlService flinkSqlService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
   @Autowired private AppBuildPipeService appBuildPipeService;
 
@@ -202,7 +202,7 @@ public class SparkApplicationActionServiceImpl
     applicationLog.setJobManagerUrl(application.getJobManagerUrl());
     applicationLog.setOptionTime(new Date());
     applicationLog.setYarnAppId(application.getClusterId());
-    applicationLog.setUserId(commonService.getUserId());
+    applicationLog.setUserId(serviceHelper.getUserId());
 
     if (appParam.getSavePointed()) {
       FlinkAppHttpWatcher.addSavepoint(application.getId());
@@ -214,7 +214,7 @@ public class SparkApplicationActionServiceImpl
     application.setOptionTime(new Date());
     this.baseMapper.updateById(application);
 
-    Long userId = commonService.getUserId();
+    Long userId = serviceHelper.getUserId();
     if (!application.getUserId().equals(userId)) {
       FlinkAppHttpWatcher.addCanceledApp(application.getId(), userId);
     }
@@ -344,7 +344,7 @@ public class SparkApplicationActionServiceImpl
     applicationLog.setOptionName(OperationEnum.START.getValue());
     applicationLog.setAppId(application.getId());
     applicationLog.setOptionTime(new Date());
-    applicationLog.setUserId(commonService.getUserId());
+    applicationLog.setUserId(serviceHelper.getUserId());
 
     // set the latest to Effective, (it will only become the current effective 
at this time)
     //    applicationManageService.toEffective(application);
@@ -501,7 +501,8 @@ public class SparkApplicationActionServiceImpl
         FlinkSql flinkSql = flinkSqlService.getEffective(application.getId(), 
false);
         AssertUtils.notNull(flinkSql);
         // 1) dist_userJar
-        String sqlDistJar = commonService.getSqlClientJar(sparkEnv);
+        // todo
+        String sqlDistJar = serviceHelper.getFlinkSqlClientJar(null);
         // 2) appConfig
         appConf =
             applicationConfig == null
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/SparkApplicationManageServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/SparkApplicationManageServiceImpl.java
index c7142aa87..985efb328 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/SparkApplicationManageServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/SparkApplicationManageServiceImpl.java
@@ -41,11 +41,11 @@ import 
org.apache.streampark.console.core.service.AppBuildPipeService;
 import org.apache.streampark.console.core.service.ApplicationBackUpService;
 import org.apache.streampark.console.core.service.ApplicationConfigService;
 import org.apache.streampark.console.core.service.ApplicationLogService;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.core.service.EffectiveService;
 import org.apache.streampark.console.core.service.FlinkSqlService;
 import org.apache.streampark.console.core.service.ProjectService;
 import org.apache.streampark.console.core.service.ResourceService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.core.service.SettingService;
 import org.apache.streampark.console.core.service.YarnQueueService;
 import 
org.apache.streampark.console.core.service.application.SparkApplicationManageService;
@@ -105,7 +105,7 @@ public class SparkApplicationManageServiceImpl
 
   @Autowired private SettingService settingService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
   @Autowired private AppBuildPipeService appBuildPipeService;
 
@@ -264,7 +264,7 @@ public class SparkApplicationManageServiceImpl
   public boolean create(SparkApplication appParam) {
     ApiAlertException.throwIfNull(
         appParam.getTeamId(), "The teamId can't be null. Create application 
failed.");
-    appParam.setUserId(commonService.getUserId());
+    appParam.setUserId(serviceHelper.getUserId());
     appParam.setState(FlinkAppStateEnum.ADDED.getValue());
     appParam.setRelease(ReleaseStateEnum.NEED_RELEASE.get());
     appParam.setOptionState(OptionStateEnum.NONE.getValue());
@@ -353,7 +353,7 @@ public class SparkApplicationManageServiceImpl
     newApp.setResourceFrom(oldApp.getResourceFrom());
     newApp.setProjectId(oldApp.getProjectId());
     newApp.setModule(oldApp.getModule());
-    newApp.setUserId(commonService.getUserId());
+    newApp.setUserId(serviceHelper.getUserId());
     newApp.setState(FlinkAppStateEnum.ADDED.getValue());
     newApp.setRelease(ReleaseStateEnum.NEED_RELEASE.get());
     newApp.setOptionState(OptionStateEnum.NONE.getValue());
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
index 9d4bbe310..cf4d9adf0 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
@@ -50,11 +50,11 @@ import 
org.apache.streampark.console.core.service.AppBuildPipeService;
 import org.apache.streampark.console.core.service.ApplicationBackUpService;
 import org.apache.streampark.console.core.service.ApplicationConfigService;
 import org.apache.streampark.console.core.service.ApplicationLogService;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.core.service.FlinkEnvService;
 import org.apache.streampark.console.core.service.FlinkSqlService;
 import org.apache.streampark.console.core.service.MessageService;
 import org.apache.streampark.console.core.service.ResourceService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.core.service.SettingService;
 import 
org.apache.streampark.console.core.service.application.ApplicationActionService;
 import 
org.apache.streampark.console.core.service.application.ApplicationInfoService;
@@ -129,7 +129,7 @@ public class AppBuildPipeServiceImpl
 
   @Autowired private ApplicationBackUpService backUpService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
   @Autowired private SettingService settingService;
 
@@ -335,7 +335,7 @@ public class AppBuildPipeServiceImpl
             } else {
               Message message =
                   new Message(
-                      commonService.getUserId(),
+                      serviceHelper.getUserId(),
                       app.getId(),
                       app.getJobName().concat(" release failed"),
                       
ExceptionUtils.stringifyException(snapshot.error().exception()),
@@ -399,7 +399,7 @@ public class AppBuildPipeServiceImpl
     applicationLog.setOptionName(RELEASE.getValue());
     applicationLog.setAppId(app.getId());
     applicationLog.setOptionTime(new Date());
-    applicationLog.setUserId(commonService.getUserId());
+    applicationLog.setUserId(serviceHelper.getUserId());
     return applicationLog;
   }
 
@@ -580,7 +580,7 @@ public class AppBuildPipeServiceImpl
       case PYFLINK:
         return String.format("%s/%s", app.getAppHome(), app.getJar());
       case FLINK_SQL:
-        String sqlDistJar = commonService.getSqlClientJar(flinkEnv);
+        String sqlDistJar = serviceHelper.getFlinkSqlClientJar(flinkEnv);
         if (app.getFlinkExecutionMode() == 
FlinkExecutionMode.YARN_APPLICATION) {
           String clientPath = Workspace.remote().APP_CLIENT();
           return String.format("%s/%s", clientPath, sqlDistJar);
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlinkClusterServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlinkClusterServiceImpl.java
index 5f73ea2fd..73ee6370b 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlinkClusterServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlinkClusterServiceImpl.java
@@ -26,9 +26,9 @@ import 
org.apache.streampark.console.base.exception.ApiDetailException;
 import org.apache.streampark.console.core.bean.ResponseResult;
 import org.apache.streampark.console.core.entity.FlinkCluster;
 import org.apache.streampark.console.core.mapper.FlinkClusterMapper;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.core.service.FlinkClusterService;
 import org.apache.streampark.console.core.service.FlinkEnvService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.core.service.YarnQueueService;
 import 
org.apache.streampark.console.core.service.application.ApplicationInfoService;
 import org.apache.streampark.console.core.watcher.FlinkClusterWatcher;
@@ -82,7 +82,7 @@ public class FlinkClusterServiceImpl extends 
ServiceImpl<FlinkClusterMapper, Fli
 
   @Autowired private FlinkEnvService flinkEnvService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
   @Autowired private ApplicationInfoService applicationInfoService;
 
@@ -142,7 +142,7 @@ public class FlinkClusterServiceImpl extends 
ServiceImpl<FlinkClusterMapper, Fli
 
   @Override
   public Boolean create(FlinkCluster flinkCluster) {
-    flinkCluster.setUserId(commonService.getUserId());
+    flinkCluster.setUserId(serviceHelper.getUserId());
     return internalCreate(flinkCluster);
   }
 
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java
index f62bcf997..c8a23df7b 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java
@@ -37,9 +37,9 @@ import org.apache.streampark.console.core.entity.FlinkSql;
 import org.apache.streampark.console.core.entity.Resource;
 import org.apache.streampark.console.core.enums.ResourceTypeEnum;
 import org.apache.streampark.console.core.mapper.ResourceMapper;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.core.service.FlinkSqlService;
 import org.apache.streampark.console.core.service.ResourceService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import 
org.apache.streampark.console.core.service.application.ApplicationManageService;
 import org.apache.streampark.flink.packer.maven.Artifact;
 import org.apache.streampark.flink.packer.maven.MavenTool;
@@ -96,7 +96,7 @@ public class ResourceServiceImpl extends 
ServiceImpl<ResourceMapper, Resource>
 
   @Autowired private ApplicationManageService applicationManageService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
   @Autowired private FlinkSqlService flinkSqlService;
 
@@ -150,7 +150,7 @@ public class ResourceServiceImpl extends 
ServiceImpl<ResourceMapper, Resource>
       transferTeamResource(resource.getTeamId(), upFile);
     }
 
-    resource.setCreatorId(commonService.getUserId());
+    resource.setCreatorId(serviceHelper.getUserId());
     this.save(resource);
   }
 
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SavePointServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SavePointServiceImpl.java
index b70dfbfa1..13283c550 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SavePointServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SavePointServiceImpl.java
@@ -40,6 +40,7 @@ import 
org.apache.streampark.console.core.service.ApplicationLogService;
 import org.apache.streampark.console.core.service.FlinkClusterService;
 import org.apache.streampark.console.core.service.FlinkEnvService;
 import org.apache.streampark.console.core.service.SavePointService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import 
org.apache.streampark.console.core.service.application.ApplicationManageService;
 import org.apache.streampark.console.core.watcher.FlinkAppHttpWatcher;
 import org.apache.streampark.flink.client.FlinkClient;
@@ -101,7 +102,7 @@ public class SavePointServiceImpl extends 
ServiceImpl<SavePointMapper, SavePoint
 
   @Autowired private FlinkAppHttpWatcher flinkAppHttpWatcher;
 
-  @Autowired private CommonServiceImpl commonService;
+  @Autowired private ServiceHelper commonService;
 
   @Qualifier("triggerSavepointExecutor")
   @Autowired
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SparkAppBuildPipeServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SparkAppBuildPipeServiceImpl.java
index ff0a529a8..ebaaeadd0 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SparkAppBuildPipeServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SparkAppBuildPipeServiceImpl.java
@@ -47,10 +47,10 @@ import 
org.apache.streampark.console.core.mapper.ApplicationBuildPipelineMapper;
 import org.apache.streampark.console.core.service.ApplicationBackUpService;
 import org.apache.streampark.console.core.service.ApplicationConfigService;
 import org.apache.streampark.console.core.service.ApplicationLogService;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.core.service.FlinkSqlService;
 import org.apache.streampark.console.core.service.MessageService;
 import org.apache.streampark.console.core.service.ResourceService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.core.service.SettingService;
 import org.apache.streampark.console.core.service.SparkAppBuildPipeService;
 import org.apache.streampark.console.core.service.SparkEnvService;
@@ -109,7 +109,7 @@ public class SparkAppBuildPipeServiceImpl
 
   @Autowired private ApplicationBackUpService backUpService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
   @Autowired private SettingService settingService;
 
@@ -148,7 +148,7 @@ public class SparkAppBuildPipeServiceImpl
     applicationLog.setOptionName(RELEASE.getValue());
     applicationLog.setAppId(app.getId());
     applicationLog.setOptionTime(new Date());
-    applicationLog.setUserId(commonService.getUserId());
+    applicationLog.setUserId(serviceHelper.getUserId());
 
     // check if you need to go through the build process (if the jar and pom 
have changed,
     // you need to go through the build process, if other common parameters 
are modified,
@@ -298,7 +298,7 @@ public class SparkAppBuildPipeServiceImpl
             } else {
               Message message =
                   new Message(
-                      commonService.getUserId(),
+                      serviceHelper.getUserId(),
                       app.getId(),
                       app.getJobName().concat(" release failed"),
                       
ExceptionUtils.stringifyException(snapshot.error().exception()),
@@ -410,7 +410,7 @@ public class SparkAppBuildPipeServiceImpl
       case PYFLINK:
         return String.format("%s/%s", app.getAppHome(), app.getJar());
       case FLINK_SQL:
-        String sqlDistJar = commonService.getSqlClientJar(sparkEnv);
+        String sqlDistJar = serviceHelper.getSparkSqlClientJar(sparkEnv);
         if (app.getSparkExecutionMode() == SparkExecutionMode.YARN_CLUSTER) {
           String clientPath = Workspace.remote().APP_CLIENT();
           return String.format("%s/%s", clientPath, sqlDistJar);
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/VariableServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/VariableServiceImpl.java
index 928f79fa5..a5c3662b7 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/VariableServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/VariableServiceImpl.java
@@ -26,8 +26,8 @@ import org.apache.streampark.console.core.entity.FlinkSql;
 import org.apache.streampark.console.core.entity.Variable;
 import org.apache.streampark.console.core.enums.ReleaseStateEnum;
 import org.apache.streampark.console.core.mapper.VariableMapper;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.core.service.FlinkSqlService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.core.service.VariableService;
 import 
org.apache.streampark.console.core.service.application.ApplicationManageService;
 
@@ -69,7 +69,7 @@ public class VariableServiceImpl extends 
ServiceImpl<VariableMapper, Variable>
 
   @Autowired private FlinkSqlService flinkSqlService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
   @Override
   public void createVariable(Variable variable) {
@@ -78,7 +78,7 @@ public class VariableServiceImpl extends 
ServiceImpl<VariableMapper, Variable>
         this.findByVariableCode(variable.getTeamId(), 
variable.getVariableCode()) != null,
         "Sorry, the variable code already exists.");
 
-    variable.setCreatorId(commonService.getUserId());
+    variable.setCreatorId(serviceHelper.getUserId());
     this.save(variable);
   }
 
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTFilter.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTFilter.java
index 796678e19..6e6fad929 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTFilter.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTFilter.java
@@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletResponse;
 
 @Slf4j
 public class JWTFilter extends BasicHttpAuthenticationFilter {
+
   private static final String TOKEN = "Authorization";
 
   @Override
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTToken.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTToken.java
index 7ea0505ff..4e00e70ce 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTToken.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTToken.java
@@ -19,10 +19,12 @@ package org.apache.streampark.console.system.authentication;
 
 import org.apache.shiro.authc.AuthenticationToken;
 
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
 
 /** JSON Web Token */
-@Data
+@Getter
+@Setter
 public class JWTToken implements AuthenticationToken {
 
   private static final long serialVersionUID = 1L;
@@ -31,16 +33,13 @@ public class JWTToken implements AuthenticationToken {
 
   private String expireAt;
 
-  private int signType;
-
   public JWTToken(String token) {
     this.token = token;
   }
 
-  public JWTToken(String token, String expireAt, int signType) {
+  public JWTToken(String token, String expireAt) {
     this.token = token;
     this.expireAt = expireAt;
-    this.signType = signType;
   }
 
   @Override
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTUtil.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTUtil.java
index 4af7fe24b..8b033d512 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTUtil.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/JWTUtil.java
@@ -28,7 +28,6 @@ import lombok.extern.slf4j.Slf4j;
 import java.util.Date;
 import java.util.regex.Pattern;
 
-/** Verification and parsing Token */
 @Slf4j
 public class JWTUtil {
 
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
index 0f490f748..3384723ae 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
@@ -32,52 +32,48 @@ import java.util.LinkedHashMap;
 @Configuration
 public class ShiroConfig {
 
-  private static final String ANON = "anon";
-
-  private static final String JWT = "jwt";
-
   @Bean
   public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager 
securityManager) {
     ShiroFilterFactoryBean shiroFilterFactoryBean = new 
ShiroFilterFactoryBean();
     shiroFilterFactoryBean.setSecurityManager(securityManager);
 
     LinkedHashMap<String, Filter> filters = new LinkedHashMap<>();
-    filters.put(JWT, new JWTFilter());
+    filters.put("jwt", new JWTFilter());
     shiroFilterFactoryBean.setFilters(filters);
 
     LinkedHashMap<String, String> filterChainDefinitionMap = new 
LinkedHashMap<>();
-    filterChainDefinitionMap.put("/actuator/**", ANON);
-
-    filterChainDefinitionMap.put("/doc.html", ANON);
-    filterChainDefinitionMap.put("/swagger-ui.html", ANON);
-    filterChainDefinitionMap.put("/swagger-ui/**", ANON);
-    filterChainDefinitionMap.put("/swagger-resources/**", ANON);
-    filterChainDefinitionMap.put("/v3/api-docs/**", ANON);
-    filterChainDefinitionMap.put("/webjars/**", ANON);
-
-    filterChainDefinitionMap.put("/passport/**", ANON);
-    filterChainDefinitionMap.put("/systemName", ANON);
-    filterChainDefinitionMap.put("/member/teams", ANON);
-    filterChainDefinitionMap.put("/user/check/**", ANON);
-    filterChainDefinitionMap.put("/user/initTeam", ANON);
-    filterChainDefinitionMap.put("/websocket/**", ANON);
-    filterChainDefinitionMap.put("/metrics/**", ANON);
-
-    filterChainDefinitionMap.put("/index.html", ANON);
-    filterChainDefinitionMap.put("/assets/**", ANON);
-    filterChainDefinitionMap.put("/resource/**/**", ANON);
-    filterChainDefinitionMap.put("/css/**", ANON);
-    filterChainDefinitionMap.put("/fonts/**", ANON);
-    filterChainDefinitionMap.put("/img/**", ANON);
-    filterChainDefinitionMap.put("/js/**", ANON);
-    filterChainDefinitionMap.put("/loading/**", ANON);
-    filterChainDefinitionMap.put("/*.js", ANON);
-    filterChainDefinitionMap.put("/*.png", ANON);
-    filterChainDefinitionMap.put("/*.jpg", ANON);
-    filterChainDefinitionMap.put("/*.less", ANON);
-    filterChainDefinitionMap.put("/*.ico", ANON);
-    filterChainDefinitionMap.put("/", ANON);
-    filterChainDefinitionMap.put("/**", JWT);
+    filterChainDefinitionMap.put("/actuator/**", "anon");
+
+    filterChainDefinitionMap.put("/doc.html", "anon");
+    filterChainDefinitionMap.put("/swagger-ui.html", "anon");
+    filterChainDefinitionMap.put("/swagger-ui/**", "anon");
+    filterChainDefinitionMap.put("/swagger-resources/**", "anon");
+    filterChainDefinitionMap.put("/v3/api-docs/**", "anon");
+    filterChainDefinitionMap.put("/webjars/**", "anon");
+
+    filterChainDefinitionMap.put("/passport/**", "anon");
+    filterChainDefinitionMap.put("/systemName", "anon");
+    filterChainDefinitionMap.put("/member/teams", "anon");
+    filterChainDefinitionMap.put("/user/check/**", "anon");
+    filterChainDefinitionMap.put("/user/initTeam", "anon");
+    filterChainDefinitionMap.put("/websocket/**", "anon");
+    filterChainDefinitionMap.put("/metrics/**", "anon");
+
+    filterChainDefinitionMap.put("/index.html", "anon");
+    filterChainDefinitionMap.put("/assets/**", "anon");
+    filterChainDefinitionMap.put("/resource/**/**", "anon");
+    filterChainDefinitionMap.put("/css/**", "anon");
+    filterChainDefinitionMap.put("/fonts/**", "anon");
+    filterChainDefinitionMap.put("/img/**", "anon");
+    filterChainDefinitionMap.put("/js/**", "anon");
+    filterChainDefinitionMap.put("/loading/**", "anon");
+    filterChainDefinitionMap.put("/*.js", "anon");
+    filterChainDefinitionMap.put("/*.png", "anon");
+    filterChainDefinitionMap.put("/*.jpg", "anon");
+    filterChainDefinitionMap.put("/*.less", "anon");
+    filterChainDefinitionMap.put("/*.ico", "anon");
+    filterChainDefinitionMap.put("/", "anon");
+    filterChainDefinitionMap.put("/**", "jwt");
 
     
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
 
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java
index 8e729e879..d17ac15a0 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java
@@ -88,6 +88,7 @@ public class ShiroRealm extends AuthorizingRealm {
     }
     // Query user information by username
     User user = userService.getByUsername(username);
+
     if (user == null || !JWTUtil.verify(credential, username, user.getSalt())) 
{
       throw new AuthenticationException("the authorization token verification 
failed.");
     }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
index d7a2ff93f..ea60d0df7 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
@@ -22,19 +22,13 @@ import 
org.apache.streampark.console.base.domain.RestRequest;
 import org.apache.streampark.console.base.domain.RestResponse;
 import org.apache.streampark.console.base.exception.InternalException;
 import org.apache.streampark.console.core.enums.AccessTokenStateEnum;
-import org.apache.streampark.console.core.service.CommonService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.system.entity.AccessToken;
 import org.apache.streampark.console.system.service.AccessTokenService;
 
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.Parameters;
-import io.swagger.v3.oas.annotations.enums.ParameterIn;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -45,35 +39,14 @@ import 
org.springframework.web.bind.annotation.RestController;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 
-@Tag(name = "ACCESS_TOKEN_TAG")
 @RestController
 @RequestMapping("token")
 public class AccessTokenController {
 
   @Autowired private AccessTokenService accessTokenService;
 
-  @Autowired private CommonService commonService;
-
-  /** generate token string */
-  @Operation(summary = "Create token")
-  @Parameters({
-    @Parameter(
-        name = "userId",
-        description = "user id",
-        required = true,
-        example = "100000",
-        schema = @Schema(implementation = Long.class)),
-    @Parameter(
-        name = "expireTime",
-        description = "token expire time, yyyy-MM-dd HH:mm:ss",
-        required = true,
-        example = "9999-01-01 00:00:00",
-        schema = @Schema(implementation = String.class)),
-    @Parameter(
-        name = "description",
-        description = "token description",
-        schema = @Schema(implementation = String.class))
-  })
+  @Autowired private ServiceHelper serviceHelper;
+
   @PostMapping(value = "create")
   @RequiresPermissions("token:add")
   public RestResponse createToken(
@@ -83,10 +56,9 @@ public class AccessTokenController {
     return accessTokenService.create(userId, description);
   }
 
-  @Operation(summary = "Verify current user token")
   @PostMapping(value = "check")
   public RestResponse verifyToken() {
-    Long userId = commonService.getUserId();
+    Long userId = serviceHelper.getUserId();
     RestResponse restResponse = RestResponse.success();
     if (userId != null) {
       AccessToken accessToken = accessTokenService.getByUserId(userId);
@@ -103,49 +75,19 @@ public class AccessTokenController {
     return restResponse;
   }
 
-  /** query token list */
-  @Operation(summary = "List tokens")
-  @Parameters({
-    @Parameter(
-        name = "userId",
-        in = ParameterIn.QUERY,
-        description = "user id",
-        schema = @Schema(implementation = Long.class))
-  })
   @PostMapping(value = "list")
   @RequiresPermissions("token:view")
-  public RestResponse tokensList(
-      RestRequest restRequest, @Parameter(hidden = true) AccessToken 
accessToken) {
+  public RestResponse tokensList(RestRequest restRequest, AccessToken 
accessToken) {
     IPage<AccessToken> accessTokens = accessTokenService.getPage(accessToken, 
restRequest);
     return RestResponse.success(accessTokens);
   }
 
-  /** update token status */
-  @Operation(summary = "Toggle token")
-  @Parameters({
-    @Parameter(
-        name = "tokenId",
-        description = "token id",
-        required = true,
-        example = "1",
-        schema = @Schema(implementation = Long.class))
-  })
   @PostMapping("toggle")
   @RequiresPermissions("token:add")
   public RestResponse toggleToken(@NotNull(message = "{required}") Long 
tokenId) {
     return accessTokenService.toggleToken(tokenId);
   }
 
-  /** delete token by id */
-  @Operation(summary = "Delete token")
-  @Parameters({
-    @Parameter(
-        name = "tokenId",
-        description = "token id",
-        required = true,
-        example = "1",
-        schema = @Schema(implementation = Long.class))
-  })
   @DeleteMapping(value = "delete")
   @RequiresPermissions("token:delete")
   public RestResponse deleteToken(@NotBlank(message = "{required}") Long 
tokenId) {
@@ -157,7 +99,6 @@ public class AccessTokenController {
    * copy cURL, hardcode now, there is no need for configuration here, because 
there are several
    * fixed interfaces
    */
-  @Operation(summary = "Generate api with token")
   @PostMapping(value = "curl")
   public RestResponse copyRestApiCurl(
       @NotBlank(message = "{required}") String appId,
@@ -169,7 +110,7 @@ public class AccessTokenController {
     curlBuilder
         .addHeader("Content-Type", "application/x-www-form-urlencoded; 
charset=UTF-8")
         .addHeader(
-            "Authorization", 
accessTokenService.getByUserId(commonService.getUserId()).getToken());
+            "Authorization", 
accessTokenService.getByUserId(serviceHelper.getUserId()).getToken());
 
     if ("/flink/app/start".equalsIgnoreCase(path)) {
       resultCURL =
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java
index 13a6a4050..a1f1a694e 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java
@@ -19,6 +19,7 @@ package org.apache.streampark.console.system.controller;
 
 import org.apache.streampark.console.base.domain.RestRequest;
 import org.apache.streampark.console.base.domain.RestResponse;
+import org.apache.streampark.console.core.annotation.PermissionScope;
 import org.apache.streampark.console.system.entity.Member;
 import org.apache.streampark.console.system.entity.Team;
 import org.apache.streampark.console.system.entity.User;
@@ -27,8 +28,6 @@ import 
org.apache.streampark.console.system.service.MemberService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -43,7 +42,6 @@ import javax.validation.constraints.NotBlank;
 
 import java.util.List;
 
-@Tag(name = "MEMBER_TAG")
 @Slf4j
 @Validated
 @RestController
@@ -52,52 +50,48 @@ public class MemberController {
 
   @Autowired private MemberService memberService;
 
-  @Operation(summary = "List members")
   @PostMapping("list")
   public RestResponse memberList(RestRequest restRequest, Member member) {
     IPage<Member> userList = memberService.getPage(member, restRequest);
     return RestResponse.success(userList);
   }
 
-  @Operation(summary = "List candidate users")
   @PostMapping("candidateUsers")
   public RestResponse candidateUsers(Long teamId) {
     List<User> userList = memberService.listUsersNotInTeam(teamId);
     return RestResponse.success(userList);
   }
 
-  @Operation(summary = "List teams")
   @PostMapping("teams")
   public RestResponse listTeams(Long userId) {
     List<Team> teamList = memberService.listTeamsByUserId(userId);
     return RestResponse.success(teamList);
   }
 
-  @Operation(summary = "Check the username")
   @PostMapping("check/user")
   public RestResponse check(@NotBlank(message = "{required}") Long teamId, 
String userName) {
     Member result = this.memberService.getByTeamIdUserName(teamId, userName);
     return RestResponse.success(result == null);
   }
 
-  @Operation(summary = "Create member")
   @PostMapping("post")
+  @PermissionScope(team = "#member.teamId")
   @RequiresPermissions("member:add")
   public RestResponse create(@Valid Member member) {
     this.memberService.createMember(member);
     return RestResponse.success();
   }
 
-  @Operation(summary = "Delete member")
   @DeleteMapping("delete")
+  @PermissionScope(team = "#member.teamId")
   @RequiresPermissions("member:delete")
   public RestResponse delete(Member member) {
     this.memberService.remove(member.getId());
     return RestResponse.success();
   }
 
-  @Operation(summary = "Update member")
   @PutMapping("update")
+  @PermissionScope(team = "#member.teamId")
   @RequiresPermissions("member:update")
   public RestResponse update(Member member) {
     this.memberService.updateMember(member);
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java
index 328fa0688..52c0b60cb 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java
@@ -19,14 +19,12 @@ package org.apache.streampark.console.system.controller;
 
 import org.apache.streampark.console.base.domain.RestResponse;
 import org.apache.streampark.console.base.domain.router.VueRouter;
-import org.apache.streampark.console.core.service.CommonService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.system.entity.Menu;
 import org.apache.streampark.console.system.service.MenuService;
 
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -37,7 +35,6 @@ import org.springframework.web.bind.annotation.RestController;
 import java.util.List;
 import java.util.Map;
 
-@Tag(name = "MENU_TAG")
 @Slf4j
 @Validated
 @RestController
@@ -46,17 +43,15 @@ public class MenuController {
 
   @Autowired private MenuService menuService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
-  @Operation(summary = "List menu-routes")
   @PostMapping("router")
   public RestResponse getUserRouters(Long teamId) {
     // TODO The teamId is required, get routers should be called after choose 
teamId.
-    List<VueRouter<Menu>> routers = 
this.menuService.listRouters(commonService.getUserId(), teamId);
+    List<VueRouter<Menu>> routers = 
this.menuService.listRouters(serviceHelper.getUserId(), teamId);
     return RestResponse.success(routers);
   }
 
-  @Operation(summary = "List menus")
   @PostMapping("list")
   @RequiresPermissions("menu:view")
   public RestResponse menuList(Menu menu) {
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
index 8cd1d2f2e..93a67976c 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
@@ -17,17 +17,22 @@
 
 package org.apache.streampark.console.system.controller;
 
+import org.apache.streampark.common.util.DateUtils;
+import org.apache.streampark.console.base.domain.ResponseCode;
 import org.apache.streampark.console.base.domain.RestResponse;
+import org.apache.streampark.console.base.util.WebUtils;
+import org.apache.streampark.console.core.enums.AuthenticationType;
 import org.apache.streampark.console.core.enums.LoginTypeEnum;
+import org.apache.streampark.console.system.authentication.JWTToken;
+import org.apache.streampark.console.system.authentication.JWTUtil;
 import org.apache.streampark.console.system.entity.User;
 import org.apache.streampark.console.system.security.Authenticator;
 import org.apache.streampark.console.system.service.UserService;
 
+import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -36,12 +41,15 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotBlank;
 
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
-@Tag(name = "PASSPORT_TAG")
 @Slf4j
 @Validated
 @RestController
@@ -58,7 +66,6 @@ public class PassportController {
   @Value("${ldap.enable:#{false}}")
   private Boolean ldapEnable;
 
-  @Operation(summary = "SigninType")
   @PostMapping("signtype")
   public RestResponse type() {
     List<String> types = new ArrayList<>();
@@ -72,25 +79,61 @@ public class PassportController {
     return RestResponse.success(types);
   }
 
-  @Operation(summary = "Signin")
   @PostMapping("signin")
   public RestResponse signin(
+      HttpServletRequest request,
+      HttpServletResponse response,
       @NotBlank(message = "{required}") String username,
       @NotBlank(message = "{required}") String password,
       @NotBlank(message = "{required}") String loginType)
       throws Exception {
 
-    if (StringUtils.isBlank(username)) {
-      return RestResponse.success().put(RestResponse.CODE_KEY, 0);
+    if (StringUtils.isEmpty(username)) {
+      return RestResponse.success().put("code", 0);
     }
+
     User user = authenticator.authenticate(username, password, loginType);
-    return userService.getLoginUserInfo(user);
+
+    if (user == null) {
+      return RestResponse.success().put("code", 0);
+    }
+
+    if (User.STATUS_LOCK.equals(user.getStatus())) {
+      return RestResponse.success().put("code", 1);
+    }
+
+    // set team
+    userService.fillInTeam(user);
+
+    // no team.
+    if (user.getLastTeamId() == null) {
+      return RestResponse.success().data(user.getUserId()).put("code", 
ResponseCode.CODE_FORBIDDEN);
+    }
+
+    this.userService.updateLoginTime(username);
+    String sign = JWTUtil.sign(user.getUserId(), username, user.getSalt(), 
AuthenticationType.SIGN);
+
+    LocalDateTime expireTime = 
LocalDateTime.now().plusSeconds(JWTUtil.getTTLOfSecond());
+    String ttl = DateUtils.formatFullTime(expireTime);
+
+    // shiro login
+    JWTToken loginToken = new JWTToken(sign, ttl);
+    SecurityUtils.getSubject().login(loginToken);
+
+    // generate UserInfo
+    String token = WebUtils.encryptToken(sign);
+    JWTToken jwtToken = new JWTToken(token, ttl);
+    String userId = RandomStringUtils.randomAlphanumeric(20);
+    user.setId(userId);
+    Map<String, Object> userInfo =
+        userService.generateFrontendUserInfo(user, user.getLastTeamId(), 
jwtToken);
+
+    return new RestResponse().data(userInfo);
   }
 
-  @Operation(summary = "Signout")
   @PostMapping("signout")
   public RestResponse signout() {
-    SecurityUtils.getSecurityManager().logout(SecurityUtils.getSubject());
+    SecurityUtils.getSubject().logout();
     return new RestResponse();
   }
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/RoleController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/RoleController.java
index afa84ff0d..f94f650a4 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/RoleController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/RoleController.java
@@ -27,8 +27,6 @@ import 
org.apache.streampark.console.system.service.RoleService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -44,7 +42,6 @@ import javax.validation.constraints.NotBlank;
 import java.util.List;
 import java.util.stream.Collectors;
 
-@Tag(name = "ROLE_TAG")
 @Slf4j
 @Validated
 @RestController
@@ -54,7 +51,6 @@ public class RoleController {
   @Autowired private RoleService roleService;
   @Autowired private RoleMenuService roleMenuService;
 
-  @Operation(summary = "List roles")
   @PostMapping("list")
   @RequiresPermissions("role:view")
   public RestResponse roleList(RestRequest restRequest, Role role) {
@@ -62,14 +58,12 @@ public class RoleController {
     return RestResponse.success(roleList);
   }
 
-  @Operation(summary = "Check the role name")
   @PostMapping("check/name")
   public RestResponse checkRoleName(@NotBlank(message = "{required}") String 
roleName) {
     Role result = this.roleService.getByName(roleName);
     return RestResponse.success(result == null);
   }
 
-  @Operation(summary = "List role menus")
   @PostMapping("menu")
   public RestResponse getRoleMenus(@NotBlank(message = "{required}") String 
roleId) {
     List<RoleMenu> roleMenuList = this.roleMenuService.listByRoleId(roleId);
@@ -80,7 +74,6 @@ public class RoleController {
     return RestResponse.success(menuIdList);
   }
 
-  @Operation(summary = "Create role")
   @PostMapping("post")
   @RequiresPermissions("role:add")
   public RestResponse addRole(@Valid Role role) {
@@ -88,7 +81,6 @@ public class RoleController {
     return RestResponse.success();
   }
 
-  @Operation(summary = "Delete role")
   @DeleteMapping("delete")
   @RequiresPermissions("role:delete")
   public RestResponse deleteRole(Long roleId) {
@@ -96,7 +88,6 @@ public class RoleController {
     return RestResponse.success();
   }
 
-  @Operation(summary = "Update role")
   @PutMapping("update")
   @RequiresPermissions("role:update")
   public RestResponse updateRole(Role role) throws Exception {
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/TeamController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/TeamController.java
index 431e2d40f..698175ddd 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/TeamController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/TeamController.java
@@ -25,8 +25,6 @@ import 
org.apache.streampark.console.system.service.TeamService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -39,7 +37,6 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.validation.Valid;
 import javax.validation.constraints.NotBlank;
 
-@Tag(name = "TEAM_TAG")
 @Slf4j
 @Validated
 @RestController
@@ -48,21 +45,18 @@ public class TeamController {
 
   @Autowired private TeamService teamService;
 
-  @Operation(summary = "List teams")
   @PostMapping("list")
   public RestResponse teamList(RestRequest restRequest, Team team) {
     IPage<Team> teamList = teamService.getPage(team, restRequest);
     return RestResponse.success(teamList);
   }
 
-  @Operation(summary = "Check the team name")
   @PostMapping("check/name")
   public RestResponse checkTeamName(@NotBlank(message = "{required}") String 
teamName) {
     Team result = this.teamService.getByName(teamName);
     return RestResponse.success(result == null);
   }
 
-  @Operation(summary = "Create team")
   @PostMapping("post")
   @RequiresPermissions("team:add")
   public RestResponse addTeam(@Valid Team team) {
@@ -70,7 +64,6 @@ public class TeamController {
     return RestResponse.success();
   }
 
-  @Operation(summary = "Delete team")
   @DeleteMapping("delete")
   @RequiresPermissions("team:delete")
   public RestResponse deleteTeam(Team team) {
@@ -78,7 +71,6 @@ public class TeamController {
     return RestResponse.success();
   }
 
-  @Operation(summary = "Update team")
   @PutMapping("update")
   @RequiresPermissions("team:update")
   public RestResponse updateTeam(Team team) {
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
index cf0c08373..be2afe478 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
@@ -21,8 +21,9 @@ import org.apache.streampark.console.base.domain.ResponseCode;
 import org.apache.streampark.console.base.domain.RestRequest;
 import org.apache.streampark.console.base.domain.RestResponse;
 import org.apache.streampark.console.base.exception.ApiAlertException;
+import org.apache.streampark.console.core.annotation.PermissionScope;
 import org.apache.streampark.console.core.enums.LoginTypeEnum;
-import org.apache.streampark.console.core.service.CommonService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.system.entity.Team;
 import org.apache.streampark.console.system.entity.User;
 import org.apache.streampark.console.system.service.TeamService;
@@ -32,11 +33,10 @@ import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -48,7 +48,6 @@ import javax.validation.constraints.NotBlank;
 import java.util.List;
 import java.util.Map;
 
-@Tag(name = "USER_TAG")
 @Slf4j
 @Validated
 @RestController
@@ -59,9 +58,8 @@ public class UserController {
 
   @Autowired private TeamService teamService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
-  @Operation(summary = "List users")
   @PostMapping("list")
   @RequiresPermissions(
       value = {"user:view", "app:view"},
@@ -71,7 +69,6 @@ public class UserController {
     return RestResponse.success(userList);
   }
 
-  @Operation(summary = "Create user")
   @PostMapping("post")
   @RequiresPermissions("user:add")
   public RestResponse addUser(@Valid User user) throws Exception {
@@ -80,14 +77,13 @@ public class UserController {
     return RestResponse.success();
   }
 
-  @Operation(summary = "Update user")
   @PutMapping("update")
+  @PermissionScope(user = "#user.id")
   @RequiresPermissions("user:update")
   public RestResponse updateUser(@Valid User user) throws Exception {
     return this.userService.updateUser(user);
   }
 
-  @Operation(summary = "Transfer User's Resource")
   @PutMapping("transferResource")
   @RequiresPermissions("user:update")
   public RestResponse transferResource(Long userId, Long targetUserId) {
@@ -95,28 +91,33 @@ public class UserController {
     return RestResponse.success();
   }
 
-  @Operation(summary = "List without token users")
+  @DeleteMapping("delete")
+  @PermissionScope(user = "#userId")
+  @RequiresPermissions("user:delete")
+  public RestResponse deleteUser(Long userId) throws Exception {
+    this.userService.deleteUser(userId);
+    return RestResponse.success();
+  }
+
   @PostMapping("getNoTokenUser")
   public RestResponse getNoTokenUser() {
     List<User> userList = this.userService.listNoTokenUser();
     return RestResponse.success(userList);
   }
 
-  @Operation(summary = "Check the username")
   @PostMapping("check/name")
   public RestResponse checkUserName(@NotBlank(message = "{required}") String 
username) {
     boolean result = this.userService.getByUsername(username) == null;
     return RestResponse.success(result);
   }
 
-  @Operation(summary = "Update password")
   @PutMapping("password")
+  @PermissionScope(user = "#user.id")
   public RestResponse updatePassword(User user) throws Exception {
     userService.updatePassword(user);
     return RestResponse.success();
   }
 
-  @Operation(summary = "Reset password")
   @PutMapping("password/reset")
   @RequiresPermissions("user:reset")
   public RestResponse resetPassword(@NotBlank(message = "{required}") String 
username)
@@ -125,7 +126,6 @@ public class UserController {
     return RestResponse.success(newPass);
   }
 
-  @Operation(summary = "Init the user teams")
   @PostMapping("initTeam")
   public RestResponse initTeam(Long teamId, Long userId) {
     Team team = teamService.getById(teamId);
@@ -136,14 +136,13 @@ public class UserController {
     return RestResponse.success();
   }
 
-  @Operation(summary = "Set the current user teams")
   @PostMapping("setTeam")
   public RestResponse setTeam(Long teamId) {
     Team team = teamService.getById(teamId);
     if (team == null) {
       return RestResponse.fail(ResponseCode.CODE_FAIL_ALERT, "TeamId is 
invalid, set team failed.");
     }
-    User user = commonService.getCurrentUser();
+    User user = serviceHelper.getLoginUser();
     ApiAlertException.throwIfNull(user, "Current login user is null, set team 
failed.");
     // 1) set the latest team
     userService.setLastTeam(teamId, user.getUserId());
@@ -155,7 +154,6 @@ public class UserController {
     return new RestResponse().data(infoMap);
   }
 
-  @Operation(summary = "List the team users")
   @PostMapping("appOwners")
   public RestResponse appOwners(Long teamId) {
     List<User> userList = userService.listByTeamId(teamId);
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
index 745393f08..8f06eb7ae 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
@@ -166,4 +166,6 @@ public interface UserService extends IService<User> {
    * @return RestResponse
    */
   RestResponse getLoginUserInfo(User user);
+
+  void deleteUser(Long userId);
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
index cc3abf23d..ce022aeeb 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
@@ -61,7 +61,7 @@ public class AccessTokenServiceImpl extends 
ServiceImpl<AccessTokenMapper, Acces
         WebUtils.encryptToken(
             JWTUtil.sign(
                 user.getUserId(), user.getUsername(), user.getSalt(), 
AuthenticationType.OPENAPI));
-    JWTToken jwtToken = new JWTToken(token, AccessToken.DEFAULT_EXPIRE_TIME, 
1);
+    JWTToken jwtToken = new JWTToken(token, AccessToken.DEFAULT_EXPIRE_TIME);
 
     AccessToken accessToken = new AccessToken();
     accessToken.setToken(jwtToken.getToken());
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java
index ac7142380..648ad9ebc 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java
@@ -21,8 +21,8 @@ import org.apache.streampark.console.base.domain.RestRequest;
 import org.apache.streampark.console.base.exception.ApiAlertException;
 import org.apache.streampark.console.base.mybatis.pager.MybatisPager;
 import org.apache.streampark.console.core.enums.UserTypeEnum;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.core.service.ProjectService;
+import org.apache.streampark.console.core.service.ServiceHelper;
 import org.apache.streampark.console.core.service.VariableService;
 import 
org.apache.streampark.console.core.service.application.ApplicationInfoService;
 import org.apache.streampark.console.system.entity.Team;
@@ -61,7 +61,7 @@ public class TeamServiceImpl extends ServiceImpl<TeamMapper, 
Team> implements Te
 
   @Autowired private VariableService variableService;
 
-  @Autowired private CommonService commonService;
+  @Autowired private ServiceHelper serviceHelper;
 
   @Override
   public IPage<Team> getPage(Team team, RestRequest request) {
@@ -93,7 +93,7 @@ public class TeamServiceImpl extends ServiceImpl<TeamMapper, 
Team> implements Te
 
   @Override
   public void removeById(Long teamId) {
-    log.info("{} Proceed delete team[Id={}]", 
commonService.getCurrentUser().getUsername(), teamId);
+    log.info("{} Proceed delete team[Id={}]", 
serviceHelper.getLoginUser().getUsername(), teamId);
     Team team = this.getById(teamId);
 
     ApiAlertException.throwIfNull(team, "The team[Id=%s] doesn't exist.", 
teamId);
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
index d3eb0f443..432387f3f 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
@@ -240,34 +240,6 @@ public class UserServiceImpl extends 
ServiceImpl<UserMapper, User> implements Us
     return baseMapper.selectUsersByAppOwner(teamId);
   }
 
-  /**
-   * generate user info, contains: 1.token, 2.vue router, 3.role, 
4.permission, 5.personalized
-   * config info of frontend
-   *
-   * @param user user
-   * @return UserInfo
-   */
-  @Override
-  public Map<String, Object> generateFrontendUserInfo(User user, Long teamId, 
JWTToken token) {
-    Map<String, Object> userInfo = new HashMap<>(8);
-
-    // 1) token & expire
-    if (token != null) {
-      userInfo.put("token", token.getToken());
-      userInfo.put("expire", token.getExpireAt());
-    }
-
-    // 2) user
-    user.dataMasking();
-    userInfo.put("user", user);
-
-    // 3) permissions
-    Set<String> permissions = this.listPermissions(user.getUserId(), teamId);
-    userInfo.put("permissions", permissions);
-
-    return userInfo;
-  }
-
   @Override
   public void transferResource(Long userId, Long targetUserId) {
     applicationManageService.changeOwnership(userId, targetUserId);
@@ -300,10 +272,45 @@ public class UserServiceImpl extends 
ServiceImpl<UserMapper, User> implements Us
                 user.getUserId(), user.getUsername(), user.getSalt(), 
AuthenticationType.SIGN));
     LocalDateTime expireTime = 
LocalDateTime.now().plusSeconds(shiroProperties.getJwtTimeOut());
     String expireTimeStr = DateUtils.formatFullTime(expireTime);
-    JWTToken jwtToken = new JWTToken(token, expireTimeStr, 1);
+    JWTToken jwtToken = new JWTToken(token, expireTimeStr);
     String userId = RandomStringUtils.randomAlphanumeric(20);
     user.setId(userId);
     Map<String, Object> userInfo = generateFrontendUserInfo(user, 
user.getLastTeamId(), jwtToken);
     return RestResponse.success(userInfo);
   }
+
+  @Override
+  @Transactional(rollbackFor = Exception.class)
+  public void deleteUser(Long userId) {
+    removeById(userId);
+    this.memberService.removeByUserId(userId);
+  }
+
+  /**
+   * generate user info, contains: 1.token, 2.vue router, 3.role, 
4.permission, 5.personalized
+   * config info of frontend
+   *
+   * @param user user
+   * @return UserInfo
+   */
+  @Override
+  public Map<String, Object> generateFrontendUserInfo(User user, Long teamId, 
JWTToken token) {
+    Map<String, Object> userInfo = new HashMap<>(8);
+
+    // 1) token & expire
+    if (token != null) {
+      userInfo.put("token", token.getToken());
+      userInfo.put("expire", token.getExpireAt());
+    }
+
+    // 2) user
+    user.dataMasking();
+    userInfo.put("user", user);
+
+    // 3) permissions
+    Set<String> permissions = this.listPermissions(user.getUserId(), teamId);
+    userInfo.put("permissions", permissions);
+
+    return userInfo;
+  }
 }


Reply via email to