From 3fa265de01d044e810cbdc0c2a1548e9ac90f6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E6=9D=A5=E6=8A=80=E6=9C=AF?= <1490493387@qq.com> Date: Mon, 30 Aug 2021 01:15:27 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95EL?= =?UTF-8?q?FK=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/youlai/admin/controller/MenuController.java | 3 +++ .../java/com/youlai/admin/controller/UserController.java | 5 +++++ .../java/com/youlai/auth/controller/OAuthController.java | 5 ++++- .../com/youlai/gateway/security/SecurityGlobalFilter.java | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/MenuController.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/MenuController.java index 22d6ed64f..4f22e5b98 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/MenuController.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/MenuController.java @@ -12,6 +12,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.cache.annotation.CacheEvict; import org.springframework.web.bind.annotation.*; @@ -28,6 +29,7 @@ import java.util.List; @RestController @RequestMapping("/api/v1/menus") @RequiredArgsConstructor +@Slf4j public class MenuController { private final ISysMenuService menuService; @@ -52,6 +54,7 @@ public class MenuController { @ApiOperation(value = "菜单路由(Route)层级列表") @GetMapping("/route") public Result getMenuRouteList() { + log.info("加载菜单路由"); List menuList = menuService.listRoute(); return Result.success(menuList); } diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/UserController.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/UserController.java index 61bc8ce47..3ee4b1b2b 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/UserController.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/controller/UserController.java @@ -1,6 +1,7 @@ package com.youlai.admin.controller; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -130,6 +131,8 @@ public class UserController { @ApiOperation(value = "获取当前登陆的用户信息") @GetMapping("/me") public Result getCurrentUser() { + + UserVO userVO = new UserVO(); // 用户基本信息 @@ -145,6 +148,8 @@ public class UserController { List perms = iSysPermissionService.listBtnPermByRoles(roles); userVO.setPerms(perms); + log.info("获取当前登陆的用户信息:{}", JSONUtil.toJsonStr(userVO)); + return Result.success(userVO); } } diff --git a/youlai-auth/src/main/java/com/youlai/auth/controller/OAuthController.java b/youlai-auth/src/main/java/com/youlai/auth/controller/OAuthController.java index c4a9ccff0..a4aebec6f 100644 --- a/youlai-auth/src/main/java/com/youlai/auth/controller/OAuthController.java +++ b/youlai-auth/src/main/java/com/youlai/auth/controller/OAuthController.java @@ -1,6 +1,7 @@ package com.youlai.auth.controller; import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; import com.nimbusds.jose.jwk.JWKSet; import com.nimbusds.jose.jwk.RSAKey; import com.youlai.auth.common.enums.OAuthClientEnum; @@ -21,6 +22,7 @@ import org.springframework.security.oauth2.provider.endpoint.TokenEndpoint; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; + import java.security.KeyPair; import java.security.Principal; import java.security.interfaces.RSAPublicKey; @@ -62,6 +64,7 @@ public class OAuthController { * 方式二:放在请求头(Request Headers)中的Authorization字段,且经过加密,例如 Basic Y2xpZW50OnNlY3JldA== 明文等于 client:secret */ String clientId = JwtUtils.getOAuthClientId(); + log.info("OAuth认证授权 客户端ID:{},请求参数:{}", clientId, JSONUtil.toJsonStr(parameters)); OAuthClientEnum client = OAuthClientEnum.getByClientId(clientId); switch (client) { case TEST: // knife4j接口测试文档使用 client_id/client_secret : client/123456 @@ -72,7 +75,7 @@ public class OAuthController { } @ApiOperation(value = "微信授权登录") - @ApiImplicitParam(name = "code", value = "小程序授权code",paramType = "path") + @ApiImplicitParam(name = "code", value = "小程序授权code", paramType = "path") @PostMapping("/token/{code}") public Result wechatLogin(@PathVariable String code, @RequestBody UserInfo userInfo) { OAuthToken token = wechatAuthService.login(code, userInfo); diff --git a/youlai-gateway/src/main/java/com/youlai/gateway/security/SecurityGlobalFilter.java b/youlai-gateway/src/main/java/com/youlai/gateway/security/SecurityGlobalFilter.java index 442fdcc16..b41f2f0b3 100644 --- a/youlai-gateway/src/main/java/com/youlai/gateway/security/SecurityGlobalFilter.java +++ b/youlai-gateway/src/main/java/com/youlai/gateway/security/SecurityGlobalFilter.java @@ -52,6 +52,7 @@ public class SecurityGlobalFilter implements GlobalFilter, Ordered { if (env.equals("prod") && (HttpMethod.DELETE.toString().equals(request.getMethodValue()) // 删除方法 || HttpMethod.PUT.toString().equals(request.getMethodValue())) // 修改方法 + || HttpMethod.POST.toString().equals(request.getMethodValue()) // 新增方法,新增不存在的路由导致系统无法访问 ) { return ResponseUtils.writeErrorInfo(response, ResultCode.FORBIDDEN_OPERATION); }