From 874287a4c02d0a980d8b97c4a691b4f37ec5e812 Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期二, 03 十二月 2024 08:47:04 +0800
Subject: [PATCH] 1、security模块ExpressionUrlAuthorizationConfigurer改为AuthorizeHttpRequestsConfigurer 2、全局registry.antMatchers改为registry.requestMatchers 3、增加积木报表

---
 iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/auth/AuthController.java |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/auth/AuthController.java b/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/auth/AuthController.java
index ef22778..7c3a9ef 100644
--- a/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/auth/AuthController.java
+++ b/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/auth/AuthController.java
@@ -1,12 +1,14 @@
 package com.iailab.module.system.controller.admin.auth;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.util.StrUtil;
 import com.iailab.framework.common.enums.CommonStatusEnum;
 import com.iailab.framework.common.enums.UserTypeEnum;
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.framework.common.util.object.BeanUtils;
 import com.iailab.framework.security.config.SecurityProperties;
+import com.iailab.framework.security.core.LoginUser;
 import com.iailab.framework.security.core.util.SecurityFrameworkUtils;
 import com.iailab.module.system.controller.admin.app.vo.AppMenuRespVO;
 import com.iailab.module.system.controller.admin.app.vo.AppRespVO;
@@ -32,6 +34,7 @@
 import io.swagger.v3.oas.annotations.Parameters;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.security.core.Authentication;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -44,7 +47,7 @@
 
 import static com.iailab.framework.common.pojo.CommonResult.success;
 import static com.iailab.framework.common.util.collection.CollectionUtils.convertSet;
-import static com.iailab.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
+import static com.iailab.framework.security.core.util.SecurityFrameworkUtils.*;
 import static com.iailab.framework.tenant.core.context.TenantContextHolder.getTenantId;
 
 
@@ -99,6 +102,19 @@
         return success(authService.refreshToken(refreshToken));
     }
 
+    @PostMapping("/client-refresh-token")
+    @PermitAll
+    @Operation(summary = "刷新令牌")
+    @Parameter(name = "refreshToken", description = "刷新令牌", required = true)
+    public Map<String, Object> refreshToken(@RequestParam("refreshToken") String refreshToken, @RequestParam("clientId") String clientId) {
+        AuthLoginRespVO authLoginRespVO = authService.refreshToken(refreshToken, clientId);
+        Map<String, Object> map = new HashMap<>();
+        map.put("access_token", authLoginRespVO.getAccessToken());
+        map.put("refresh_token", authLoginRespVO.getRefreshToken());
+        map.put("expires_time", LocalDateTimeUtil.toEpochMilli(authLoginRespVO.getExpiresTime()) / 1000L);
+        return map;
+    }
+
     @GetMapping("/get-permission-info")
     @Operation(summary = "获取登录用户的权限信息")
     public CommonResult<AuthPermissionInfoRespVO> getPermissionInfo() {
@@ -120,6 +136,7 @@
         Set<Long> menuIds = permissionService.getRoleMenuListByRoleId(convertSet(roles, RoleDO::getId));
         List<MenuDO> menuList = menuService.getMenuList(menuIds);
         menuList = menuService.filterDisableMenus(menuList);
+        menuList = menuService.filterMenus(menuList, "system");
 
         // 2. 拼接结果返回
         return success(AuthConvert.INSTANCE.convert(user, roles, menuList));
@@ -178,6 +195,7 @@
         List<MenuDO> menuList = menuService.getMenuList(menuIds);
         menuList = menuService.filterDisableMenus(menuList);
         MenuDO menuDO = menuService.getMenuByAppId(id);
+        AppDO info = appService.getInfo(id);
         List<MenuDO> children = new LinkedList<>();
         // 遍历每一层
         Collection<Long> parentIds = Collections.singleton(menuDO.getId());
@@ -203,6 +221,7 @@
                 parentMenu.setVisible(true);
                 parentMenu.setAlwaysShow(false);
                 parentMenu.setParentId(menuDO.getId());
+                parentMenu.setPath("/");
                 menu.setParentId(parentMenu.getId());
                 tempChildren.add(parentMenu);
                 tempChildren.add(menu);
@@ -210,7 +229,7 @@
                 tempChildren.add(menu);
             }
         });
-        menuVOS = AuthConvert.INSTANCE.buildMenuTree(tempChildren, menuDO.getId(), menuDO.getPath());
+        menuVOS = AuthConvert.INSTANCE.buildMenuTree(tempChildren, menuDO.getId(), menuDO.getPath(), info.getType());
         // 2. 拼接结果返回
         return success(menuVOS);
     }

--
Gitblit v1.9.3