From 69c49818fa31554f4a9d8e123ca1f0a154965726 Mon Sep 17 00:00:00 2001 From: lbw Date: Mon, 19 Dec 2022 18:54:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:bug:=20Fixing=20a=20bug.=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=B1=9E=E6=80=A7=E9=94=99=E8=AF=AF=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=AF=B9=E5=A4=96=E6=9A=B4=E9=9C=B2=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/2pigxx.sql | 4 ++-- .../src/main/resources/application.yml | 2 +- .../security/component/PermitAllUrlProperties.java | 10 +++++----- .../security/component/PigBearerTokenExtractor.java | 2 +- .../component/PigResourceServerConfiguration.java | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/db/2pigxx.sql b/db/2pigxx.sql index 544307319..2d91bf4ac 100644 --- a/db/2pigxx.sql +++ b/db/2pigxx.sql @@ -893,7 +893,7 @@ CREATE TABLE `sys_tenant` ( -- Records of sys_tenant -- ---------------------------- BEGIN; -INSERT INTO `sys_tenant` VALUES (1, '北京分公司', '1', '', '2019-05-15 00:00:00', '2029-05-15 00:00:00', '0', '0', '', 'admin', '2019-05-15 15:44:57', '2022-12-09 15:27:50', 1601104338798153729); +INSERT INTO `sys_tenant` VALUES (1, '北京分公司', '1', '', '2019-05-15 00:00:00', '2029-05-15 00:00:00', '0', '0', '', 'admin', '2019-05-15 15:44:57', '2022-12-09 15:27:50', 1); COMMIT; -- ---------------------------- @@ -916,7 +916,7 @@ CREATE TABLE `sys_tenant_menu` ( -- ---------------------------- -- Records of sys_tenant_menu -- ---------------------------- -INSERT INTO `sys_tenant_menu` VALUES (1601104338798153729, '1231', '1000,1100,1101,1102,1103,1104,1200,1201,1202,1203,1300,1301,1302,1303,1304,1305,1400,1401,1402,1403,1404,1500,1501,1502,1503,1600,1601,1602,1603,1604,1605,1601095373834067969,1601095530717814785,1601095569972305921,1601095611131011073', '0', '0', 'admin', ' ', '2022-12-09 14:39:56', '2022-12-09 06:39:56'); +INSERT INTO `sys_tenant_menu` VALUES (1, '默认租户套餐', '1000,1100,1101,1102,1103,1104,1200,1201,1202,1203,1300,1301,1302,1303,1304,1305,1400,1401,1402,1403,1404,1500,1501,1502,1503,1600,1601,1602,1603,1604,1605,1601095373834067969,1601095530717814785,1601095569972305921,1601095611131011073', '0', '0', 'admin', ' ', '2022-12-09 14:39:56', '2022-12-09 06:39:56'); -- ---------------------------- -- Table structure for sys_user diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/application.yml b/pigx-app-server/pigx-app-server-biz/src/main/resources/application.yml index 66d7e45c0..f7abeb654 100644 --- a/pigx-app-server/pigx-app-server-biz/src/main/resources/application.yml +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/application.yml @@ -1,5 +1,5 @@ server: - port: 6060 + port: 7060 spring: application: diff --git a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PermitAllUrlProperties.java b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PermitAllUrlProperties.java index 76a9d8503..32b44a7be 100755 --- a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PermitAllUrlProperties.java +++ b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PermitAllUrlProperties.java @@ -39,7 +39,7 @@ import java.util.regex.Pattern; * 资源服务器对外直接暴露URL,如果设置contex-path 要特殊处理 */ @Slf4j -@ConfigurationProperties(prefix = "security.oauth2.ignore") +@ConfigurationProperties(prefix = "security.oauth2.client") public class PermitAllUrlProperties implements InitializingBean { private static final Pattern PATTERN = Pattern.compile("\\{(.*?)\\}"); @@ -48,11 +48,11 @@ public class PermitAllUrlProperties implements InitializingBean { @Getter @Setter - private List urls = new ArrayList<>(); + private List ignoreUrls = new ArrayList<>(); @Override public void afterPropertiesSet() { - urls.addAll(Arrays.asList(DEFAULT_IGNORE_URLS)); + ignoreUrls.addAll(Arrays.asList(DEFAULT_IGNORE_URLS)); RequestMappingHandlerMapping mapping = SpringContextHolder.getBean("requestMappingHandlerMapping"); Map map = mapping.getHandlerMethods(); @@ -62,12 +62,12 @@ public class PermitAllUrlProperties implements InitializingBean { // 获取方法上边的注解 替代path variable 为 * Inner method = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Inner.class); Optional.ofNullable(method).ifPresent(inner -> Objects.requireNonNull(info.getPathPatternsCondition()) - .getPatternValues().forEach(url -> urls.add(ReUtil.replaceAll(url, PATTERN, "*")))); + .getPatternValues().forEach(url -> ignoreUrls.add(ReUtil.replaceAll(url, PATTERN, "*")))); // 获取类上边的注解, 替代path variable 为 * Inner controller = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), Inner.class); Optional.ofNullable(controller).ifPresent(inner -> Objects.requireNonNull(info.getPathPatternsCondition()) - .getPatternValues().forEach(url -> urls.add(ReUtil.replaceAll(url, PATTERN, "*")))); + .getPatternValues().forEach(url -> ignoreUrls.add(ReUtil.replaceAll(url, PATTERN, "*")))); }); } diff --git a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigBearerTokenExtractor.java b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigBearerTokenExtractor.java index aa4ea85a0..248f4029a 100644 --- a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigBearerTokenExtractor.java +++ b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigBearerTokenExtractor.java @@ -55,7 +55,7 @@ public class PigBearerTokenExtractor implements BearerTokenResolver { @Override public String resolve(HttpServletRequest request) { - boolean match = urlProperties.getUrls().stream() + boolean match = urlProperties.getIgnoreUrls().stream() .anyMatch(url -> pathMatcher.match(url, request.getRequestURI())); if (match) { diff --git a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigResourceServerConfiguration.java b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigResourceServerConfiguration.java index 0f3d21a0d..f7964d344 100644 --- a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigResourceServerConfiguration.java +++ b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigResourceServerConfiguration.java @@ -51,7 +51,7 @@ public class PigResourceServerConfiguration { SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http.authorizeHttpRequests(authorizeRequests -> authorizeRequests - .antMatchers(ArrayUtil.toArray(permitAllUrl.getUrls(), String.class)).permitAll().anyRequest() + .antMatchers(ArrayUtil.toArray(permitAllUrl.getIgnoreUrls(), String.class)).permitAll().anyRequest() .authenticated()) .oauth2ResourceServer( oauth2 -> oauth2.opaqueToken(token -> token.introspector(customOpaqueTokenIntrospector)) From 032c1b54d3187d63be8bd058f7547ef32d8c066a Mon Sep 17 00:00:00 2001 From: lbw Date: Tue, 27 Dec 2022 11:20:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:wrench:=20=E4=BF=AE=E6=94=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E3=80=82=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E9=85=8D=E7=BD=AE=E5=92=8C=E6=B3=A8=E9=87=8A=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/1schema.sql | 1 + db/2pigxx.sql | 1 + pigx-register/pom.xml | 11 ----------- pigx-register/src/main/resources/application.yml | 1 - 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/db/1schema.sql b/db/1schema.sql index 0f220428e..590a48413 100644 --- a/db/1schema.sql +++ b/db/1schema.sql @@ -25,4 +25,5 @@ create database `pigxx_report` default character set utf8mb4 collate utf8mb4_gen -- pigx bi 报表相关的数据库 create database `pigxx_bi` default character set utf8mb4 collate utf8mb4_general_ci; +-- pigx app 模块相关的数据库 create database `pigxx_app` default character set utf8mb4 collate utf8mb4_general_ci; diff --git a/db/2pigxx.sql b/db/2pigxx.sql index f7b005467..90f9c18ca 100644 --- a/db/2pigxx.sql +++ b/db/2pigxx.sql @@ -259,6 +259,7 @@ INSERT INTO `sys_dict_item` VALUES (64, 2, 'DINGTALK', '钉钉', 'social_type', INSERT INTO `sys_dict_item` VALUES (65, 2, 'WEIXIN_CP', '企业微信', 'social_type', '企业微信', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 1); INSERT INTO `sys_dict_item` VALUES (66, 18, '2', 'APP', 'style_type', 'uview风格', 1, ' ', ' ', '2020-02-07 03:53:12', '2020-02-07 03:53:12', '', '0', 1); INSERT INTO `sys_dict_item` VALUES (67, 17, 'mobile', 'app', 'grant_types', 'App登录', 5, 'admin', ' ', '2022-12-09 09:54:49', NULL, NULL, '0', 1); +INSERT INTO `sys_dict_item` VALUES (68, 2, 'MINI', '小程序登录', 'social_type', '小程序登录', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 1); COMMIT; -- ---------------------------- diff --git a/pigx-register/pom.xml b/pigx-register/pom.xml index e2e1297b8..cd961bd6a 100755 --- a/pigx-register/pom.xml +++ b/pigx-register/pom.xml @@ -73,17 +73,6 @@ cn.hutool hutool-system - - - - - - - - - - - diff --git a/pigx-register/src/main/resources/application.yml b/pigx-register/src/main/resources/application.yml index dd6377746..4ea15de2f 100644 --- a/pigx-register/src/main/resources/application.yml +++ b/pigx-register/src/main/resources/application.yml @@ -22,7 +22,6 @@ nacos: spring: datasource: platform: mysql #这个过期属性不能修改,nacos 代码对此有硬编码 -# platform: postgresql #这个过期属性不能修改,nacos 代码对此有硬编码 security: enabled: true boot: # 接入 spring boot admin