diff --git a/db/6pigxx_config.sql b/db/6pigxx_config.sql index 77d138006..a789e45d6 100644 --- a/db/6pigxx_config.sql +++ b/db/6pigxx_config.sql @@ -33,10 +33,10 @@ CREATE TABLE `config_info` ( -- ---------------------------- BEGIN; INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_create`, `gmt_modified`, `src_user`, `src_ip`, `app_name`, `tenant_id`, `c_desc`, `c_use`, `effect`, `type`, `c_schema`, `encrypted_data_key`) VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', '# 配置文件加密根密码\njasypt:\n encryptor:\n password: pigx\n algorithm: PBEWithMD5AndDES\n iv-generator-classname: org.jasypt.iv.NoIvGenerator\n\n\nspring:\n redis:\n host: pigx-redis\n servlet:\n multipart:\n max-file-size: 100MB\n max-request-size: 100MB\n cloud:\n sentinel:\n eager: true\n transport:\n dashboard: pigx-sentinel:5020\n openfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n connection-timeout: 20000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# 端点对外暴露\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\' \n endpoint:\n restart:\n enabled: true\n health:\n show-details: ALWAYS\n\n#开启灰度\ngray:\n rule:\n enabled: true\n\n# mybatis-plus 配置\nmybatis-plus:\n tenant-enable: ture\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n capitalMode: true\n banner: false\n db-config:\n id-type: auto\n select-strategy: not_empty\n insert-strategy: not_empty\n update-strategy: not_null\n type-handlers-package: com.pig4cloud.pigx.common.data.handler\n configuration:\n jdbc-type-for-null: \'null\'\n call-setters-on-nulls: true\n shrink-whitespaces-in-sql: true\nmybatis-plus-join:\n banner: false #关闭连表查询组件banner', '93aac2c7c8b710561d18211674533426', '2022-12-16 10:44:25', '2024-02-27 11:57:02', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); -INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_create`, `gmt_modified`, `src_user`, `src_ip`, `app_name`, `tenant_id`, `c_desc`, `c_use`, `effect`, `type`, `c_schema`, `encrypted_data_key`) VALUES (2, 'pigx-auth-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n freemarker:\n allow-request-override: false\n allow-session-override: false\n cache: true\n charset: UTF-8\n check-template-location: true\n content-type: text/html\n enabled: true\n expose-request-attributes: false\n expose-session-attributes: false\n expose-spring-macro-helpers: true\n prefer-file-system-access: true\n suffix: .ftl\n template-loader-path: classpath:/templates/', '74f53b71c7799aa754da75662378b93c', '2022-12-16 10:44:25', '2022-12-16 10:44:25', NULL, '0:0:0:0:0:0:0:1', '', '', NULL, NULL, NULL, 'yaml', NULL, ''); +INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_create`, `gmt_modified`, `src_user`, `src_ip`, `app_name`, `tenant_id`, `c_desc`, `c_use`, `effect`, `type`, `c_schema`, `encrypted_data_key`) VALUES (2, 'pigx-auth-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n freemarker:\n allow-request-override: false\n allow-session-override: false\n cache: true\n charset: UTF-8\n check-template-location: true\n content-type: text/html\n enabled: true\n expose-request-attributes: false\n expose-session-attributes: false\n expose-spring-macro-helpers: true\n prefer-file-system-access: true\n suffix: .ftl\n template-loader-path: classpath:/templates/\n\n# 前端登录验证码\nsecurity:\n encodeKey: \'pigxpigxpigxpigx\'\n# 验证码相关配置参考: http://t.cn/A647jEdu\naj:\n captcha:\n cache-type: redis\n water-mark: pig4cloud', 'bb6bd9b9e21afdec3d6c88636387df96', '2022-12-16 10:44:25', '2024-04-20 22:47:21', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_create`, `gmt_modified`, `src_user`, `src_ip`, `app_name`, `tenant_id`, `c_desc`, `c_use`, `effect`, `type`, `c_schema`, `encrypted_data_key`) VALUES (3, 'pigx-codegen-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_codegen}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n', 'ed6de06e34e2634c28a24e8a1db99b06', '2022-12-16 10:44:25', '2024-02-22 15:08:09', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_create`, `gmt_modified`, `src_user`, `src_ip`, `app_name`, `tenant_id`, `c_desc`, `c_use`, `effect`, `type`, `c_schema`, `encrypted_data_key`) VALUES (4, 'pigx-daemon-elastic-job-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true', '09996f46e0b80d7b2aa320ef4cb31c82', '2022-12-16 10:44:25', '2023-04-07 14:14:50', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); -INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_create`, `gmt_modified`, `src_user`, `src_ip`, `app_name`, `tenant_id`, `c_desc`, `c_use`, `effect`, `type`, `c_schema`, `encrypted_data_key`) VALUES (5, 'pigx-gateway-dev.yml', 'DEFAULT_GROUP', 'gateway:\n encode-key: \'pigxpigxpigxpigx\'\n\n# 验证码相关配置参考: http://t.cn/A647jEdu\naj:\n captcha:\n cache-type: redis\n water-mark: pig4cloud\n\n# 固定路由转发配置 无修改\nspring:\n cloud:\n gateway:\n routes:\n - id: openapi\n uri: lb://pigx-gateway\n predicates:\n - Path=/v3/api-docs/**\n filters:\n - RewritePath=/v3/api-docs/(?.*), /$\\{path}/$\\{path}/v3/api-docs\n\n# gateway 刷新端点\nmanagement:\n endpoint:\n gateway:\n enabled: true\n', 'd138f5bafa91ab76dca8c4c1a01c1de2', '2022-12-16 10:44:25', '2023-07-28 16:49:29', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); +INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_create`, `gmt_modified`, `src_user`, `src_ip`, `app_name`, `tenant_id`, `c_desc`, `c_use`, `effect`, `type`, `c_schema`, `encrypted_data_key`) VALUES (5, 'pigx-gateway-dev.yml', 'DEFAULT_GROUP', '# 固定路由转发配置 无修改\nspring:\n cloud:\n gateway:\n routes:\n - id: openapi\n uri: lb://pigx-gateway\n predicates:\n - Path=/v3/api-docs/**\n filters:\n - RewritePath=/v3/api-docs/(?.*), /$\\{path}/$\\{path}/v3/api-docs\n\n# gateway 刷新端点\nmanagement:\n endpoint:\n gateway:\n enabled: true\n', 'd9454d877ff3d8bd3fd0d5be99810195', '2022-12-16 10:44:25', '2024-04-20 22:47:02', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_create`, `gmt_modified`, `src_user`, `src_ip`, `app_name`, `tenant_id`, `c_desc`, `c_use`, `effect`, `type`, `c_schema`, `encrypted_data_key`) VALUES (6, 'pigx-monitor-dev.yml', 'DEFAULT_GROUP', 'spring:\n # 安全配置\n security:\n user:\n name: ENC(rZHA4LW5hHmhLAAzJoFNag==) # pigx\n password: ENC(bjeyh+Aeii3kHXkoo00ZUw==) # pigx\n autoconfigure:\n exclude: com.pig4cloud.pigx.common.core.config.JacksonConfiguration\n boot:\n admin:\n ui:\n title: \'pigx 服务状态监控\'\n brand: \'pigx 服务状态监控\'\n external-views:\n - label: \"SQL监控\"\n url: /druid/sql.html\n order: 2000\n iframe: true\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n endpoint:\n health:\n show-details: ALWAYS #显示详细信息\n\n\n# druid 监控的服务\nmonitor:\n applications:\n - pigx-upms-biz\n', '2bb39e4dee3f90d4186d1e42aa666d2a', '2022-12-16 10:44:25', '2023-04-07 14:12:09', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_create`, `gmt_modified`, `src_user`, `src_ip`, `app_name`, `tenant_id`, `c_desc`, `c_use`, `effect`, `type`, `c_schema`, `encrypted_data_key`) VALUES (7, 'pigx-upms-biz-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n ignore-urls:\n - /druid/**\n\n# 数据源\nspring:\n autoconfigure:\n exclude: org.springframework.cloud.gateway.config.GatewayAutoConfiguration,org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n stat-view-servlet:\n enabled: true\n allow: \"\"\n url-pattern: /druid/*\n #login-username: admin\n #login-password: admin\n filter:\n stat:\n enabled: true\n log-slow-sql: true\n slow-sql-millis: 10000\n merge-sql: false\n wall:\n config:\n multi-statement-allow: true\n\n# 本地文件系统\nfile:\n local:\n enable: true\n basePath: /Users/lengleng/Downloads/files', '28f2305c1cfb413dcc45a3d432ef7098', '2022-12-16 10:44:25', '2024-02-22 15:08:36', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_create`, `gmt_modified`, `src_user`, `src_ip`, `app_name`, `tenant_id`, `c_desc`, `c_use`, `effect`, `type`, `c_schema`, `encrypted_data_key`) VALUES (8, 'pigx-daemon-quartz-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/', '79619124a30cdb6e8bc1046aaa18d91c', '2022-12-16 10:44:25', '2024-04-19 21:49:00', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); diff --git a/pigx-app-server/pigx-app-server-api/pom.xml b/pigx-app-server/pigx-app-server-api/pom.xml index b3aa80463..3b926a0dd 100644 --- a/pigx-app-server/pigx-app-server-api/pom.xml +++ b/pigx-app-server/pigx-app-server-api/pom.xml @@ -7,7 +7,7 @@ com.pig4cloud pigx-app-server - 5.4.0 + 5.5.0-SNAPSHOT pigx-app-server-api diff --git a/pigx-app-server/pigx-app-server-biz/pom.xml b/pigx-app-server/pigx-app-server-biz/pom.xml index 47d01e6dc..0b27ba2d2 100644 --- a/pigx-app-server/pigx-app-server-biz/pom.xml +++ b/pigx-app-server/pigx-app-server-biz/pom.xml @@ -7,7 +7,7 @@ com.pig4cloud pigx-app-server - 5.4.0 + 5.5.0-SNAPSHOT pigx-app-server-biz @@ -62,7 +62,7 @@ com.pig4cloud pigx-app-server-api - 5.4.0 + 5.5.0-SNAPSHOT @@ -90,16 +90,25 @@ pigx-common-swagger - - - - org.springframework.boot - spring-boot-maven-plugin - - - io.fabric8 - docker-maven-plugin - - - + + + + cloud + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + false + + + + + + diff --git a/pigx-app-server/pom.xml b/pigx-app-server/pom.xml index aace13919..b9d8f42d1 100644 --- a/pigx-app-server/pom.xml +++ b/pigx-app-server/pom.xml @@ -7,7 +7,7 @@ com.pig4cloud pigx - 5.4.0 + 5.5.0-SNAPSHOT pigx-app-server diff --git a/pigx-auth/pom.xml b/pigx-auth/pom.xml index bf126ed52..60866f04f 100644 --- a/pigx-auth/pom.xml +++ b/pigx-auth/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - 5.4.0 + 5.5.0-SNAPSHOT pigx-auth @@ -78,6 +78,23 @@ org.springframework.boot spring-boot-starter-freemarker + + + cn.hutool + hutool-crypto + + + + io.springboot.plugin + captcha-core + ${captcha.image.version} + + + + com.github.anji-plus + captcha-spring-boot-starter + ${captcha.version} + org.springframework.boot @@ -90,27 +107,24 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - io.fabric8 - docker-maven-plugin - - false - - - - - + + + cloud + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + false + + + + + + diff --git a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/config/AuthorizationServerConfiguration.java b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/config/AuthorizationServerConfiguration.java index 451484200..81b885c58 100644 --- a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/config/AuthorizationServerConfiguration.java +++ b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/config/AuthorizationServerConfiguration.java @@ -20,6 +20,8 @@ import com.pig4cloud.pigx.auth.support.CustomeOAuth2AccessTokenGenerator; import com.pig4cloud.pigx.auth.support.core.CustomeOAuth2TokenCustomizer; import com.pig4cloud.pigx.auth.support.core.FormIdentityLoginConfigurer; import com.pig4cloud.pigx.auth.support.core.PigxDaoAuthenticationProvider; +import com.pig4cloud.pigx.auth.support.filter.PasswordDecoderFilter; +import com.pig4cloud.pigx.auth.support.filter.ValidateCodeFilter; import com.pig4cloud.pigx.auth.support.handler.PigxAuthenticationFailureEventHandler; import com.pig4cloud.pigx.auth.support.handler.PigxAuthenticationSuccessEventHandler; import com.pig4cloud.pigx.auth.support.password.OAuth2ResourceOwnerPasswordAuthenticationConverter; @@ -30,6 +32,7 @@ import com.pig4cloud.pigx.common.core.constant.SecurityConstants; import com.pig4cloud.pigx.common.security.handler.FormAuthenticationFailureHandler; import com.pig4cloud.pigx.common.security.handler.SsoLogoutSuccessHandler; import lombok.RequiredArgsConstructor; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; @@ -47,6 +50,7 @@ import org.springframework.security.web.DefaultSecurityFilterChain; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.AuthenticationConverter; import org.springframework.security.web.authentication.AuthenticationFailureHandler; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; import java.util.Arrays; @@ -63,12 +67,22 @@ public class AuthorizationServerConfiguration { private final OAuth2AuthorizationService authorizationService; + private final PasswordDecoderFilter passwordDecoderFilter; + + private final ValidateCodeFilter validateCodeFilter; + @Bean @Order(Ordered.HIGHEST_PRECEDENCE) + @ConditionalOnProperty(value = "security.micro", matchIfMissing = true) public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http, PigxAuthenticationSuccessEventHandler successEventHandler, PigxAuthenticationFailureEventHandler failureEventHandler) throws Exception { - OAuth2AuthorizationServerConfigurer authorizationServerConfigurer = new OAuth2AuthorizationServerConfigurer(); + // 增加验证码过滤器 + http.addFilterBefore(validateCodeFilter, UsernamePasswordAuthenticationFilter.class); + // 增加密码解密过滤器 + http.addFilterBefore(passwordDecoderFilter, UsernamePasswordAuthenticationFilter.class); + + OAuth2AuthorizationServerConfigurer authorizationServerConfigurer = new OAuth2AuthorizationServerConfigurer(); http.apply(authorizationServerConfigurer.tokenEndpoint((tokenEndpoint) -> {// 个性化认证授权端点 tokenEndpoint.accessTokenRequestConverter(accessTokenRequestConverter()) // 注入自定义的授权认证Converter @@ -81,7 +95,7 @@ public class AuthorizationServerConfiguration { DefaultSecurityFilterChain securityFilterChain = http.authorizeHttpRequests(authorizeRequests -> { // 自定义接口、端点暴露 - authorizeRequests.antMatchers("/token/**", "/actuator/**", "/css/**", "/error").permitAll(); + authorizeRequests.antMatchers("/token/**","/code/**", "/actuator/**", "/css/**", "/error").permitAll(); authorizeRequests.anyRequest().authenticated(); }).apply(authorizationServerConfigurer.authorizationService(authorizationService)// redis存储token的实现 .authorizationServerSettings( @@ -121,7 +135,8 @@ public class AuthorizationServerConfiguration { * request -> xToken 注入请求转换器 * @return DelegatingAuthenticationConverter */ - private AuthenticationConverter accessTokenRequestConverter() { + @Bean + public AuthenticationConverter accessTokenRequestConverter() { return new DelegatingAuthenticationConverter(Arrays.asList( new OAuth2ResourceOwnerPasswordAuthenticationConverter(), new OAuth2ResourceOwnerSmsAuthenticationConverter(), new OAuth2RefreshTokenAuthenticationConverter(), diff --git a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/config/CaptchaCacheServiceProvider.java b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/CaptchaCacheServiceProvider.java similarity index 95% rename from pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/config/CaptchaCacheServiceProvider.java rename to pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/CaptchaCacheServiceProvider.java index 1b582905a..371b78c93 100644 --- a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/config/CaptchaCacheServiceProvider.java +++ b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/CaptchaCacheServiceProvider.java @@ -1,4 +1,4 @@ -package com.pig4cloud.pigx.gateway.config; +package com.pig4cloud.pigx.auth.endpoint; import com.anji.captcha.service.CaptchaCacheService; import org.springframework.beans.factory.annotation.Autowired; diff --git a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/ImageCodeEndpoint.java b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/ImageCodeEndpoint.java new file mode 100644 index 000000000..63a4aac5e --- /dev/null +++ b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/ImageCodeEndpoint.java @@ -0,0 +1,84 @@ +package com.pig4cloud.pigx.auth.endpoint; + +import com.anji.captcha.model.vo.CaptchaVO; +import com.anji.captcha.service.CaptchaService; +import com.pig4cloud.pigx.common.core.constant.CacheConstants; +import com.pig4cloud.pigx.common.core.constant.CommonConstants; +import com.pig4cloud.pigx.common.core.constant.SecurityConstants; +import com.pig4cloud.pigx.common.core.util.R; +import com.pig4cloud.pigx.common.core.util.SpringContextHolder; +import io.springboot.captcha.ArithmeticCaptcha; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.concurrent.TimeUnit; + +/** + * 验证码相关的接口 + * + * @author lengleng + * @date 2022/6/27 + */ +@RestController +@RequestMapping("/code") +@RequiredArgsConstructor +public class ImageCodeEndpoint { + + private static final Integer DEFAULT_IMAGE_WIDTH = 100; + + private static final Integer DEFAULT_IMAGE_HEIGHT = 40; + + private final StringRedisTemplate redisTemplate; + + /** + * 创建图形验证码 + */ + @SneakyThrows + @GetMapping("/image") + public void image(String randomStr, HttpServletResponse response) { + ArithmeticCaptcha captcha = new ArithmeticCaptcha(DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT); + + String result = captcha.text(); + redisTemplate.opsForValue() + .set(CacheConstants.DEFAULT_CODE_KEY + randomStr, result, SecurityConstants.CODE_TIME, TimeUnit.SECONDS); + // 转换流信息写出 + captcha.out(response.getOutputStream()); + } + + /** + * 行为 + * 创建滑块图形验证码 + */ + @SneakyThrows + @GetMapping("/create") + public R behavior() { + CaptchaVO vo = new CaptchaVO(); + vo.setCaptchaType(CommonConstants.IMAGE_CODE_TYPE); + CaptchaService captchaService = SpringContextHolder.getBean(CaptchaService.class); + return R.ok(captchaService.get(vo)); + } + + /** + * 行为 + * 创建滑块图形验证码 + */ + @SneakyThrows + @PostMapping("/check") + public R check(HttpServletRequest request) { + CaptchaVO vo = new CaptchaVO(); + vo.setPointJson(request.getParameter("pointJson")); + vo.setToken(request.getParameter("token")); + vo.setCaptchaType(CommonConstants.IMAGE_CODE_TYPE); + + CaptchaService captchaService = SpringContextHolder.getBean(CaptchaService.class); + return R.ok(captchaService.check(vo)); + } + +} diff --git a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/filter/AuthSecurityConfigProperties.java b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/filter/AuthSecurityConfigProperties.java new file mode 100644 index 000000000..4c4b547c4 --- /dev/null +++ b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/filter/AuthSecurityConfigProperties.java @@ -0,0 +1,30 @@ +package com.pig4cloud.pigx.auth.support.filter; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.stereotype.Component; + +/** + * @author lengleng + * @date 2020/10/4 + *

+ * 网关配置文件 + */ +@Data +@Component +@RefreshScope +@ConfigurationProperties("security") +public class AuthSecurityConfigProperties { + + /** + * 是否是微服务架构 + */ + private boolean isMicro; + + /** + * 网关解密登录前端密码 秘钥 + */ + private String encodeKey; + +} diff --git a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/filter/PasswordDecoderFilter.java b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/filter/PasswordDecoderFilter.java new file mode 100755 index 000000000..5c72f2627 --- /dev/null +++ b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/filter/PasswordDecoderFilter.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.pig4cloud.pigx.auth.support.filter; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.Mode; +import cn.hutool.crypto.Padding; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.symmetric.AES; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.pig4cloud.pigx.common.core.constant.CacheConstants; +import com.pig4cloud.pigx.common.core.constant.CommonConstants; +import com.pig4cloud.pigx.common.core.constant.SecurityConstants; +import com.pig4cloud.pigx.common.core.constant.enums.EncFlagTypeEnum; +import com.pig4cloud.pigx.common.core.util.RepeatBodyRequestWrapper; +import com.pig4cloud.pigx.common.core.util.WebUtils; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.util.Map; + +/** + * @author lengleng + * @date 2019 /2/1 密码解密工具类 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class PasswordDecoderFilter extends OncePerRequestFilter { + + private final AuthSecurityConfigProperties authSecurityConfigProperties; + + private final StringRedisTemplate redisTemplate; + + private static final String PASSWORD = "password"; + + private static final String KEY_ALGORITHM = "AES"; + + static { + // 关闭hutool 强制关闭Bouncy Castle库的依赖 + SecureUtil.disableBouncyCastle(); + } + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { + // 不是登录请求,直接向下执行 + if (!StrUtil.containsAnyIgnoreCase(request.getRequestURI(), SecurityConstants.OAUTH_TOKEN_URL)) { + chain.doFilter(request, response); + return; + } + + // 2. 刷新token类型,直接向下执行 + String grantType = request.getParameter("grant_type"); + if (StrUtil.equals(SecurityConstants.REFRESH_TOKEN, grantType)) { + chain.doFilter(request, response); + return; + } + + // 3. 判断客户端是否需要解密,明文传输直接向下执行 + if (!isEncClient(request)) { + chain.doFilter(request, response); + return; } + + // 将请求流转换为可多次读取的请求流 + RepeatBodyRequestWrapper requestWrapper = new RepeatBodyRequestWrapper(request); + Map parameterMap = requestWrapper.getParameterMap(); + + // 构建前端对应解密AES 因子 + AES aes = new AES(Mode.CFB, Padding.NoPadding, + new SecretKeySpec(authSecurityConfigProperties.getEncodeKey().getBytes(), KEY_ALGORITHM), + new IvParameterSpec(authSecurityConfigProperties.getEncodeKey().getBytes())); + + parameterMap.forEach((k, v) -> { + String[] values = parameterMap.get(k); + if (!PASSWORD.equals(k) || ArrayUtil.isEmpty(values)) { + return; + } + + // 解密密码 + String decryptPassword = aes.decryptStr(values[0]); + parameterMap.put(k, new String[]{decryptPassword}); + }); + chain.doFilter(requestWrapper, response); + } + + /** + * 根据请求的clientId 查询客户端配置是否是加密传输 + * + * @param request 请求上下文 + * @return true 加密传输 、 false 原文传输 + */ + private boolean isEncClient(HttpServletRequest request) { + String header = request.getHeader(HttpHeaders.AUTHORIZATION); + String clientId = WebUtils.extractClientId(header).orElse(null); + // 获取租户拼接区分租户的key + String tenantId = request.getHeader(CommonConstants.TENANT_ID); + String key = String.format("%s:%s:%s", StrUtil.isBlank(tenantId) ? CommonConstants.TENANT_ID_1 : tenantId, + CacheConstants.CLIENT_FLAG, clientId); + + String val = redisTemplate.opsForValue().get(key); + + // 当配置不存在时,默认需要解密 + if (val == null) { + return true; + } + + JSONObject information = JSONUtil.parseObj(val); + return !StrUtil.equals(EncFlagTypeEnum.NO.getType(), information.getStr(CommonConstants.ENC_FLAG)); + } + +} diff --git a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/filter/ValidateCodeFilter.java b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/filter/ValidateCodeFilter.java new file mode 100644 index 000000000..176d70d78 --- /dev/null +++ b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/filter/ValidateCodeFilter.java @@ -0,0 +1,179 @@ +package com.pig4cloud.pigx.auth.support.filter; + +/** + * 登录前处理器 + * + * @author lengleng + * @date 2024/4/3 + */ + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.anji.captcha.model.vo.CaptchaVO; +import com.anji.captcha.service.CaptchaService; +import com.pig4cloud.pigx.common.core.constant.CacheConstants; +import com.pig4cloud.pigx.common.core.constant.CommonConstants; +import com.pig4cloud.pigx.common.core.constant.SecurityConstants; +import com.pig4cloud.pigx.common.core.constant.enums.CaptchaFlagTypeEnum; +import com.pig4cloud.pigx.common.core.exception.ValidateCodeException; +import com.pig4cloud.pigx.common.core.util.SpringContextHolder; +import com.pig4cloud.pigx.common.core.util.WebUtils; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.http.HttpHeaders; +import org.springframework.security.oauth2.core.OAuth2AuthenticationException; +import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +import java.io.IOException; + +/** + * @author lbw + * @date 2024-01-06 + *

+ * 登录前置处理器: 前端密码传输密文解密,验证码处理 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class ValidateCodeFilter extends OncePerRequestFilter { + + + private final StringRedisTemplate redisTemplate; + + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) + throws ServletException, IOException { + + String requestUrl = request.getServletPath(); + + // 不是登录URL 请求直接跳过 + if (!SecurityConstants.OAUTH_TOKEN_URL.equals(requestUrl)) { + filterChain.doFilter(request, response); + return; + } + + // 如果登录URL 但是刷新token的请求,直接向下执行 + String grantType = request.getParameter(OAuth2ParameterNames.GRANT_TYPE); + if (StrUtil.containsAny(grantType, SecurityConstants.REFRESH_TOKEN)) { + filterChain.doFilter(request, response); + return; + } + + // mobile模式, 如果请求不包含mobile 参数直接 + String mobile = request.getParameter(SecurityConstants.GRANT_MOBILE); + if (StrUtil.equals(SecurityConstants.GRANT_MOBILE, grantType) && StrUtil.isBlank(mobile)) { + throw new OAuth2AuthenticationException(SecurityConstants.GRANT_MOBILE); + } + + // mobile模式, 社交登录模式不校验验证码直接跳过 + if (StrUtil.equals(SecurityConstants.GRANT_MOBILE, grantType) && !StrUtil.contains(mobile, "SMS")) { + filterChain.doFilter(request, response); + return; + } + + // 判断客户端是否跳过检验 + if (!isCheckCaptchaClient(request)) { + filterChain.doFilter(request, response); + return; + } + + // 校验验证码 1. 客户端开启验证码 2. 短信模式 + try { + checkCode(); + filterChain.doFilter(request, response); + } catch (ValidateCodeException validateCodeException) { + throw new OAuth2AuthenticationException(validateCodeException.getMessage()); + } + } + + /** + * 校验验证码 + */ + private void checkCode() throws ValidateCodeException { + HttpServletRequest request = WebUtils.getRequest(); + String code = request.getParameter("code"); + + if (StrUtil.isBlank(code)) { + throw new ValidateCodeException("验证码不能为空"); + } + + String randomStr = request.getParameter("randomStr"); + + // https://gitee.com/log4j/pig/issues/IWA0D + String mobile = request.getParameter("mobile"); + if (StrUtil.isNotBlank(mobile)) { + randomStr = mobile; + } + + // 若是滑块登录 + if (CommonConstants.IMAGE_CODE_TYPE.equalsIgnoreCase(randomStr)) { + CaptchaService captchaService = SpringContextHolder.getBean(CaptchaService.class); + CaptchaVO vo = new CaptchaVO(); + vo.setCaptchaVerification(code); + vo.setCaptchaType(CommonConstants.IMAGE_CODE_TYPE); + if (!captchaService.verification(vo).isSuccess()) { + throw new ValidateCodeException("验证码不能为空"); + } + return; + } + + + String key = CacheConstants.DEFAULT_CODE_KEY + randomStr; + if (Boolean.FALSE.equals(redisTemplate.hasKey(key))) { + throw new ValidateCodeException("验证码不合法"); + } + + Object codeObj = redisTemplate.opsForValue().get(key); + + if (codeObj == null) { + throw new ValidateCodeException("验证码不合法"); + } + + String saveCode = codeObj.toString(); + if (StrUtil.isBlank(saveCode)) { + redisTemplate.delete(key); + throw new ValidateCodeException("验证码不合法"); + } + + if (!StrUtil.equals(saveCode, code)) { + redisTemplate.delete(key); + throw new ValidateCodeException("验证码不合法"); + } + + redisTemplate.delete(key); + } + + /** + * 是否需要校验客户端,根据client 查询客户端配置 + * + * @param request 请求 + * @return true 需要校验, false 不需要校验 + */ + private boolean isCheckCaptchaClient(HttpServletRequest request) { + String header = request.getHeader(HttpHeaders.AUTHORIZATION); + String clientId = WebUtils.extractClientId(header).orElse(null); + // 获取租户拼接区分租户的key + String tenantId = request.getHeader(CommonConstants.TENANT_ID); + String key = String.format("%s:%s:%s", StrUtil.isBlank(tenantId) ? CommonConstants.TENANT_ID_1 : tenantId, + CacheConstants.CLIENT_FLAG, clientId); + + String val = redisTemplate.opsForValue().get(key); + + // 当配置不存在时,不用校验 + if (val == null) { + return false; + } + + JSONObject information = JSONUtil.parseObj(val); + return !StrUtil.equals(CaptchaFlagTypeEnum.OFF.getType(), information.getStr(CommonConstants.CAPTCHA_FLAG)); + } +} diff --git a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/handler/PigxAuthenticationFailureEventHandler.java b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/handler/PigxAuthenticationFailureEventHandler.java index d824766ea..9e4be2e83 100644 --- a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/handler/PigxAuthenticationFailureEventHandler.java +++ b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/handler/PigxAuthenticationFailureEventHandler.java @@ -163,12 +163,6 @@ public class PigxAuthenticationFailureEventHandler implements AuthenticationFail errorMessage = exception.getLocalizedMessage(); } - // 手机号登录 - String grantType = request.getParameter(OAuth2ParameterNames.GRANT_TYPE); - if (SecurityConstants.APP.equals(grantType)) { - errorMessage = MsgUtils.getSecurityMessage("AbstractUserDetailsAuthenticationProvider.smsBadCredentials"); - } - this.errorHttpResponseConverter.write(R.failed(errorMessage), MediaType.APPLICATION_JSON, httpResponse); } diff --git a/pigx-auth/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService b/pigx-auth/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService new file mode 100644 index 000000000..39e4ea0c5 --- /dev/null +++ b/pigx-auth/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService @@ -0,0 +1 @@ +com.pig4cloud.pigx.auth.endpoint.CaptchaCacheServiceProvider diff --git a/pigx-boot/pom.xml b/pigx-boot/pom.xml new file mode 100755 index 000000000..7a4fd2b01 --- /dev/null +++ b/pigx-boot/pom.xml @@ -0,0 +1,115 @@ + + + + + 4.0.0 + + com.pig4cloud + pigx + 5.5.0-SNAPSHOT + + + pigx-boot + jar + + pigx 单体版本启动 + + + + + com.pig4cloud + pigx-auth + 5.5.0-SNAPSHOT + + + + com.pig4cloud + pigx-upms-biz + 5.5.0-SNAPSHOT + + + + com.pig4cloud + pigx-codegen + 5.5.0-SNAPSHOT + + + com.pig4cloud + pigx-daemon-quartz + 5.5.0-SNAPSHOT + + + com.pig4cloud + pigx-daemon-elastic-job + 5.5.0-SNAPSHOT + + + com.pig4cloud + pigx-mp-platform + 5.5.0-SNAPSHOT + + + com.pig4cloud + pigx-pay-platform + 5.5.0-SNAPSHOT + + + com.pig4cloud + pigx-app-server-biz + 5.5.0-SNAPSHOT + + + + com.pig4cloud + pigx-common-security + + + + org.springdoc + springdoc-openapi-ui + + + io.springboot + knife4j-boot-openapi3-ui + ${knife4j.version} + + + + com.pig4cloud + pigx-common-swagger + + + + org.springframework.boot + spring-boot-starter-undertow + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + + + diff --git a/pigx-boot/src/main/java/com/pig4cloud/pigx/PigxBootApplication.java b/pigx-boot/src/main/java/com/pig4cloud/pigx/PigxBootApplication.java new file mode 100755 index 000000000..28d098fdc --- /dev/null +++ b/pigx-boot/src/main/java/com/pig4cloud/pigx/PigxBootApplication.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.pig4cloud.pigx; + +import com.pig4cloud.pigx.common.security.annotation.EnablePigxResourceServer; +import com.pig4cloud.pigx.common.swagger.annotation.EnableOpenApi; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author lengleng 单体版本启动器,只需要运行此模块则整个系统启动 + */ +@EnableOpenApi(value = "admin", isMicro = false) +@EnablePigxResourceServer +@SpringBootApplication +public class PigxBootApplication { + + public static void main(String[] args) { + SpringApplication.run(PigxBootApplication.class, args); + } + +} diff --git a/pigx-boot/src/main/java/com/pig4cloud/pigx/bootstrap/PigxBootSecurityServerConfiguration.java b/pigx-boot/src/main/java/com/pig4cloud/pigx/bootstrap/PigxBootSecurityServerConfiguration.java new file mode 100644 index 000000000..4d49b283f --- /dev/null +++ b/pigx-boot/src/main/java/com/pig4cloud/pigx/bootstrap/PigxBootSecurityServerConfiguration.java @@ -0,0 +1,154 @@ +/* + * + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + * + */ + +package com.pig4cloud.pigx.bootstrap; + +import com.pig4cloud.pigx.auth.support.core.PigxDaoAuthenticationProvider; +import com.pig4cloud.pigx.auth.support.filter.PasswordDecoderFilter; +import com.pig4cloud.pigx.auth.support.filter.ValidateCodeFilter; +import com.pig4cloud.pigx.auth.support.handler.PigxAuthenticationFailureEventHandler; +import com.pig4cloud.pigx.auth.support.handler.PigxAuthenticationSuccessEventHandler; +import com.pig4cloud.pigx.auth.support.password.OAuth2ResourceOwnerPasswordAuthenticationProvider; +import com.pig4cloud.pigx.auth.support.sms.OAuth2ResourceOwnerSmsAuthenticationProvider; +import com.pig4cloud.pigx.common.core.constant.SecurityConstants; +import com.pig4cloud.pigx.common.security.component.PermitAllUrlProperties; +import com.pig4cloud.pigx.common.security.component.PigxBearerTokenExtractor; +import com.pig4cloud.pigx.common.security.component.ResourceAuthExceptionEntryPoint; +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.Customizer; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer; +import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService; +import org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2AuthorizationServerConfigurer; +import org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings; +import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenGenerator; +import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector; +import org.springframework.security.web.DefaultSecurityFilterChain; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.AuthenticationConverter; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; + +import java.util.stream.Collectors; + +/** + * @author lengleng 认证授权服务器配置 + */ +@Configuration +@RequiredArgsConstructor +public class PigxBootSecurityServerConfiguration { + + private final ResourceAuthExceptionEntryPoint resourceAuthExceptionEntryPoint; + + private final OpaqueTokenIntrospector customOpaqueTokenIntrospector; + + private final AuthenticationConverter accessTokenRequestConverter; + + private final OAuth2AuthorizationService authorizationService; + + private final PigxBearerTokenExtractor pigBearerTokenExtractor; + + private final PasswordDecoderFilter passwordDecoderFilter; + + private final OAuth2TokenGenerator oAuth2TokenGenerator; + + private final ValidateCodeFilter validateCodeFilter; + + private final PermitAllUrlProperties permitAllUrl; + + @Bean + @Order(Ordered.HIGHEST_PRECEDENCE) + + public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http, + PigxAuthenticationSuccessEventHandler successEventHandler, + PigxAuthenticationFailureEventHandler failureEventHandler) throws Exception { + OAuth2AuthorizationServerConfigurer authorizationServerConfigurer = new OAuth2AuthorizationServerConfigurer(); + + http.addFilterAfter(passwordDecoderFilter, UsernamePasswordAuthenticationFilter.class); + http.addFilterAfter(validateCodeFilter, UsernamePasswordAuthenticationFilter.class); + http.apply(authorizationServerConfigurer.tokenEndpoint((tokenEndpoint) -> {// 个性化认证授权端点 + tokenEndpoint.accessTokenRequestConverter(accessTokenRequestConverter) // 注入自定义的授权认证Converter + .accessTokenResponseHandler(successEventHandler) // 登录成功处理器 + .errorResponseHandler(failureEventHandler);// 登录失败处理器 + }).clientAuthentication(oAuth2ClientAuthenticationConfigurer -> // 个性化客户端认证 + oAuth2ClientAuthenticationConfigurer.errorResponseHandler(failureEventHandler))// 处理客户端认证异常 + .authorizationEndpoint(authorizationEndpoint -> authorizationEndpoint// 授权码端点个性化confirm页面 + .consentPage(SecurityConstants.CUSTOM_CONSENT_PAGE_URI))) + .authorizationService(authorizationService) + .authorizationServerSettings( + AuthorizationServerSettings.builder().issuer(SecurityConstants.PIGX_LICENSE).build()); + + AntPathRequestMatcher[] requestMatchers = permitAllUrl.getIgnoreUrls() + .stream() + .map(AntPathRequestMatcher::new) + .collect(Collectors.toList()) + .toArray(new AntPathRequestMatcher[]{}); + + http.authorizeHttpRequests(authorizeRequests -> authorizeRequests.requestMatchers(requestMatchers) + .permitAll() + .anyRequest() + .authenticated()) + .oauth2ResourceServer( + oauth2 -> oauth2.opaqueToken(token -> token.introspector(customOpaqueTokenIntrospector)) + .authenticationEntryPoint(resourceAuthExceptionEntryPoint) + .bearerTokenResolver(pigBearerTokenExtractor)) + .exceptionHandling(configurer -> configurer.authenticationEntryPoint(resourceAuthExceptionEntryPoint)) + .headers(headers -> headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable)) + .csrf(AbstractHttpConfigurer::disable); + + DefaultSecurityFilterChain securityFilterChain = http.build(); + + // 注入自定义授权模式实现 + addCustomOAuth2GrantAuthenticationProvider(http); + return securityFilterChain; + } + + /** + * 注入授权模式实现提供方 + *

+ * 1. 密码模式
+ * 2. 短信登录
+ */ + @SuppressWarnings("unchecked") + private void addCustomOAuth2GrantAuthenticationProvider(HttpSecurity http) { + AuthenticationManager authenticationManager = http.getSharedObject(AuthenticationManager.class); + OAuth2AuthorizationService authorizationService = http.getSharedObject(OAuth2AuthorizationService.class); + + OAuth2ResourceOwnerPasswordAuthenticationProvider resourceOwnerPasswordAuthenticationProvider = new OAuth2ResourceOwnerPasswordAuthenticationProvider( + authenticationManager, authorizationService, oAuth2TokenGenerator); + + OAuth2ResourceOwnerSmsAuthenticationProvider resourceOwnerSmsAuthenticationProvider = new OAuth2ResourceOwnerSmsAuthenticationProvider( + authenticationManager, authorizationService, oAuth2TokenGenerator); + + // 处理 UsernamePasswordAuthenticationToken + http.authenticationProvider(new PigxDaoAuthenticationProvider()); + // 处理 OAuth2ResourceOwnerPasswordAuthenticationToken + http.authenticationProvider(resourceOwnerPasswordAuthenticationProvider); + // 处理 OAuth2ResourceOwnerSmsAuthenticationToken + http.authenticationProvider(resourceOwnerSmsAuthenticationProvider); + } + +} + diff --git a/pigx-boot/src/main/resources/application-dev.yml b/pigx-boot/src/main/resources/application-dev.yml new file mode 100644 index 000000000..cb210b9a1 --- /dev/null +++ b/pigx-boot/src/main/resources/application-dev.yml @@ -0,0 +1,40 @@ +spring: + cache: + type: redis + redis: + host: pigx-redis + # 数据库相关配置 + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + driver-class-name: com.mysql.cj.jdbc.Driver + username: root + password: root + url: jdbc:mysql://pigx-mysql:3306/pigxx_boot?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true + + +# 文件上传配置 +file: + local: + enable: true + base-path: /Users/lengleng/Downloads/img + +# 验证码配置 +aj: + captcha: + water-mark: pig4cloud + cache-type: redis +security: + # 登录报文加密根密钥 ,必须是16位 + encodeKey: pigxpigxpigxpigx + +# 配置文件加密根密码 +jasypt: + encryptor: + password: pigx + algorithm: PBEWithMD5AndDES + iv-generator-classname: org.jasypt.iv.NoIvGenerator + +# swagger 配置 +swagger: + token-url: ${swagger.gateway}/admin/oauth2/token diff --git a/pigx-boot/src/main/resources/application.yml b/pigx-boot/src/main/resources/application.yml new file mode 100644 index 000000000..89026b98c --- /dev/null +++ b/pigx-boot/src/main/resources/application.yml @@ -0,0 +1,61 @@ +server: + port: 9999 # 项目端口 + servlet: + context-path: /admin # 项目访问路径 + +spring: + application: + name: @project.artifactId@ # 服务名称,取 pom.xml 中的 artifactId + # 上传文件大小限制 + servlet: + multipart: + max-file-size: 100MB # 单个文件最大 + max-request-size: 100MB # 接收的最大请求大小 + cloud: + nacos: # 单机版本关闭nacos 服务发现和配置管理的能力 + config: + enabled: false + discovery: + enabled: false + gateway: + enabled: false + main: + allow-bean-definition-overriding: true # 允许覆盖bean定义 + profiles: + active: dev # 激活dev,对应 application-dev.yml + + +## spring security 对外暴露接口设置(不鉴权直接可访问) +security: + micro: false + oauth2: + client: + ignore-urls: + - /webjars/** + - /v3/api-docs/** + - /doc.html + - /swagger-ui.html + - /swagger-ui/** + - /swagger-resources + - /token/check_token + - /error + - /druid/** + - /actuator/** + - /code/** + +#--------------如下配置尽量不要变动------------- +# mybatis-plus 配置 +mybatis-plus: + mapper-locations: classpath*:/mapper/*Mapper.xml # mapper文件位置 + global-config: + banner: false # 是否打印 mybatis-plus banner + db-config: + id-type: auto # 主键类型 + where-strategy: not_empty # where 条件策略 + insert-strategy: not_empty # 插入策略 + update-strategy: not_null # 更新策略 + type-handlers-package: com.pig4cloud.pigx.common.data.handler # 类型处理器包 + configuration: + jdbc-type-for-null: 'null' # 是否设置字段为null + call-setters-on-nulls: true # 是否调用set方法时传入null值 + shrink-whitespaces-in-sql: true # 去掉sql中多余的空格 diff --git a/pigx-boot/src/main/resources/logback-spring.xml b/pigx-boot/src/main/resources/logback-spring.xml new file mode 100644 index 000000000..05e8af861 --- /dev/null +++ b/pigx-boot/src/main/resources/logback-spring.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + + + + + + ${log.path}/debug.log + + ${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz + 50MB + 30 + + + ${CONSOLE_LOG_PATTERN} + + + + + + ${log.path}/error.log + + ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz + 50MB + 30 + + + ${CONSOLE_LOG_PATTERN} + + + ERROR + + + + + + + + + + + + + + + + + + + diff --git a/pigx-common/pigx-common-audit/pom.xml b/pigx-common/pigx-common-audit/pom.xml index 51e316040..ce91f14a7 100644 --- a/pigx-common/pigx-common-audit/pom.xml +++ b/pigx-common/pigx-common-audit/pom.xml @@ -5,7 +5,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-audit diff --git a/pigx-common/pigx-common-bom/pom.xml b/pigx-common/pigx-common-bom/pom.xml index 6a824fba9..cb3e2a1fc 100644 --- a/pigx-common/pigx-common-bom/pom.xml +++ b/pigx-common/pigx-common-bom/pom.xml @@ -17,18 +17,18 @@ pigx 公共版本控制 - 5.4.0 - 3.5.5 + 5.5.0-SNAPSHOT + 3.5.6 1.4.10 4.3.0 1.2.20 - 5.8.26 + 5.8.27 8.0.33 21.3.0.0 8.4.1.jre8 8.1.2.192 6.2.0 - 3.0.3 + 3.0.5 1.6.15 2.2.14 4.4.0 @@ -302,6 +302,11 @@ swagger-annotations ${swagger.core.version} + + org.springdoc + springdoc-openapi-ui + ${springdoc.version} + org.springdoc springdoc-openapi-webflux-ui @@ -442,16 +447,4 @@ - - - - - rdc-releases - https://packages.aliyun.com/maven/repository/2161442-release-DcBZC1/ - - - rdc-snapshots - https://packages.aliyun.com/maven/repository/2161442-snapshot-FzKqZK/ - - diff --git a/pigx-common/pigx-common-core/pom.xml b/pigx-common/pigx-common-core/pom.xml index 68dcb0d4e..5e0dd852a 100644 --- a/pigx-common/pigx-common-core/pom.xml +++ b/pigx-common/pigx-common-core/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-core diff --git a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/util/RepeatBodyRequestWrapper.java b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/util/RepeatBodyRequestWrapper.java new file mode 100644 index 000000000..69b3b37e1 --- /dev/null +++ b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/util/RepeatBodyRequestWrapper.java @@ -0,0 +1,103 @@ +/* + * Copyright 2023-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.pig4cloud.pigx.common.core.util; + +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StreamUtils; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Map; + +/** + * Request包装类:允许 body 重复读取 + * + * @author Hccake + */ +@Slf4j +public class RepeatBodyRequestWrapper extends HttpServletRequestWrapper { + + private final byte[] bodyByteArray; + + private final Map parameterMap; + + public RepeatBodyRequestWrapper(HttpServletRequest request) { + super(request); + this.bodyByteArray = getByteBody(request); + this.parameterMap = super.getParameterMap(); + } + + @Override + public BufferedReader getReader() { + return ObjectUtils.isEmpty(this.bodyByteArray) ? null + : new BufferedReader(new InputStreamReader(getInputStream())); + } + + @Override + public ServletInputStream getInputStream() { + final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(this.bodyByteArray); + return new ServletInputStream() { + @Override + public boolean isFinished() { + return false; + } + + @Override + public boolean isReady() { + return false; + } + + @Override + public void setReadListener(ReadListener readListener) { + // doNoting + } + + @Override + public int read() { + return byteArrayInputStream.read(); + } + }; + } + + private static byte[] getByteBody(HttpServletRequest request) { + byte[] body = new byte[0]; + try { + body = StreamUtils.copyToByteArray(request.getInputStream()); + } + catch (IOException e) { + log.error("解析流中数据异常", e); + } + return body; + } + + /** + * 重写 getParameterMap() 方法 解决 undertow 中流被读取后,会进行标记,从而导致无法正确获取 body 中的表单数据的问题 + * @return Map parameterMap + */ + @Override + public Map getParameterMap() { + return this.parameterMap; + } + +} diff --git a/pigx-common/pigx-common-data/pom.xml b/pigx-common/pigx-common-data/pom.xml index fbd3c3b87..922aa4caf 100644 --- a/pigx-common/pigx-common-data/pom.xml +++ b/pigx-common/pigx-common-data/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-data diff --git a/pigx-common/pigx-common-datasource/pom.xml b/pigx-common/pigx-common-datasource/pom.xml index 2b5a1fb9d..eb8ebbe14 100644 --- a/pigx-common/pigx-common-datasource/pom.xml +++ b/pigx-common/pigx-common-datasource/pom.xml @@ -5,7 +5,7 @@ pigx-common com.pig4cloud - 5.4.0 + 5.5.0-SNAPSHOT 4.0.0 diff --git a/pigx-common/pigx-common-encrypt-api/pom.xml b/pigx-common/pigx-common-encrypt-api/pom.xml index 63650c8c2..c17e4902d 100644 --- a/pigx-common/pigx-common-encrypt-api/pom.xml +++ b/pigx-common/pigx-common-encrypt-api/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-encrypt-api diff --git a/pigx-common/pigx-common-excel/pom.xml b/pigx-common/pigx-common-excel/pom.xml index 6354d7982..2526d082e 100644 --- a/pigx-common/pigx-common-excel/pom.xml +++ b/pigx-common/pigx-common-excel/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-excel @@ -33,8 +33,9 @@ pigx excel 操作 - 1.21 - 3.1.1 + 1.26.1 + 3.3.4 + 5.2.5 @@ -61,16 +62,43 @@ org.apache.commons commons-compress + + org.apache.poi + poi + + + org.apache.poi + poi-ooxml + + + org.apache.poi + poi-ooxml-schemas + + + org.apache.poi + poi + ${poi.version} + + + org.apache.poi + poi-ooxml + ${poi.version} + + + org.apache.poi + poi-ooxml-lite + ${poi.version} + org.apache.commons commons-compress ${commons-compress} - jakarta.servlet - jakarta.servlet-api + javax.servlet + javax.servlet-api diff --git a/pigx-common/pigx-common-feign/pom.xml b/pigx-common/pigx-common-feign/pom.xml index 43f6ef2dd..ed2b404a8 100755 --- a/pigx-common/pigx-common-feign/pom.xml +++ b/pigx-common/pigx-common-feign/pom.xml @@ -5,7 +5,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT 4.0.0 diff --git a/pigx-common/pigx-common-feign/src/main/java/org/springframework/cloud/openfeign/PigxFeignClientsRegistrar.java b/pigx-common/pigx-common-feign/src/main/java/org/springframework/cloud/openfeign/PigxFeignClientsRegistrar.java index c247dd7c3..4139f3807 100644 --- a/pigx-common/pigx-common-feign/src/main/java/org/springframework/cloud/openfeign/PigxFeignClientsRegistrar.java +++ b/pigx-common/pigx-common-feign/src/main/java/org/springframework/cloud/openfeign/PigxFeignClientsRegistrar.java @@ -17,7 +17,6 @@ package org.springframework.cloud.openfeign; -import com.pig4cloud.pigx.common.feign.PigxFeignAutoConfiguration; import lombok.Getter; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.config.BeanDefinitionHolder; @@ -34,7 +33,6 @@ import org.springframework.core.env.Environment; import org.springframework.core.io.support.SpringFactoriesLoader; import org.springframework.core.type.AnnotationMetadata; import org.springframework.lang.Nullable; -import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; import java.util.ArrayList; @@ -47,8 +45,7 @@ import java.util.Map; *

* feign 自动配置功能 from mica */ -public class PigxFeignClientsRegistrar - implements ImportBeanDefinitionRegistrar, BeanClassLoaderAware, EnvironmentAware { +public class PigxFeignClientsRegistrar implements ImportBeanDefinitionRegistrar, BeanClassLoaderAware, EnvironmentAware { private final static String BASE_URL = "http://127.0.0.1:${server.port}${server.servlet.context-path}"; @@ -69,11 +66,12 @@ public class PigxFeignClientsRegistrar } private void registerFeignClients(BeanDefinitionRegistry registry) { - List feignClients = new ArrayList<>(); + + List feignClients = new ArrayList<>( + SpringFactoriesLoader.loadFactoryNames(getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader())); // 支持 springboot 2.7 + 最新版本的配置方式 ImportCandidates.load(FeignClient.class, getBeanClassLoader()).forEach(feignClients::add); - // 如果 spring.factories 里为空 if (feignClients.isEmpty()) { return; @@ -86,16 +84,20 @@ public class PigxFeignClientsRegistrar if (attributes == null) { continue; } + + // 如果是单体项目自动注入 & url 为空 + Boolean isMicro = environment.getProperty("spring.cloud.nacos.discovery.enabled", Boolean.class, true); // 如果已经存在该 bean,支持原生的 Feign - if (registry.containsBeanDefinition(className)) { + if (registry.containsBeanDefinition(className) && isMicro) { continue; } + registerClientConfiguration(registry, getClientName(attributes), attributes.get("configuration")); validate(attributes); BeanDefinitionBuilder definition = BeanDefinitionBuilder .genericBeanDefinition(FeignClientFactoryBean.class); - definition.addPropertyValue("url", getUrl(attributes)); + definition.addPropertyValue("url", getUrl(registry, attributes)); definition.addPropertyValue("path", getPath(attributes)); String name = getName(attributes); definition.addPropertyValue("name", name); @@ -149,7 +151,7 @@ public class PigxFeignClientsRegistrar * @return the factory class */ private Class getSpringFactoriesLoaderFactoryClass() { - return PigxFeignAutoConfiguration.class; + return PigxFeignClientsRegistrar.class; } private void validate(Map attributes) { @@ -188,15 +190,17 @@ public class PigxFeignClientsRegistrar return value; } - private String getUrl(Map attributes) { + private String getUrl(BeanDefinitionRegistry registry, Map attributes) { + // 如果是单体项目自动注入 & url 为空 - String url = (String) attributes.get("url"); - boolean present = ClassUtils.isPresent("com.alibaba.cloud.nacos.discovery.NacosDiscoveryClient", - this.getClass().getClassLoader()); - if (!StringUtils.hasText(url) && !present) { - url = resolve(BASE_URL); + Boolean isMicro = environment.getProperty("spring.cloud.nacos.discovery.enabled", Boolean.class, true); + + if (isMicro) { + return null; } + String url = resolve(BASE_URL); + return FeignClientsRegistrar.getUrl(url); } diff --git a/pigx-common/pigx-common-gateway/pom.xml b/pigx-common/pigx-common-gateway/pom.xml index 53f9a2b35..40aece01e 100644 --- a/pigx-common/pigx-common-gateway/pom.xml +++ b/pigx-common/pigx-common-gateway/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-gateway diff --git a/pigx-common/pigx-common-gray/pom.xml b/pigx-common/pigx-common-gray/pom.xml index e7c94a1d1..fb3584e40 100644 --- a/pigx-common/pigx-common-gray/pom.xml +++ b/pigx-common/pigx-common-gray/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-gray diff --git a/pigx-common/pigx-common-idempotent/pom.xml b/pigx-common/pigx-common-idempotent/pom.xml index cde3868a1..a1f344b24 100644 --- a/pigx-common/pigx-common-idempotent/pom.xml +++ b/pigx-common/pigx-common-idempotent/pom.xml @@ -5,7 +5,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-idempotent diff --git a/pigx-common/pigx-common-job/pom.xml b/pigx-common/pigx-common-job/pom.xml index 6abb82133..507103520 100644 --- a/pigx-common/pigx-common-job/pom.xml +++ b/pigx-common/pigx-common-job/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-job diff --git a/pigx-common/pigx-common-log/pom.xml b/pigx-common/pigx-common-log/pom.xml index 4dbbd4bc2..12c648c42 100644 --- a/pigx-common/pigx-common-log/pom.xml +++ b/pigx-common/pigx-common-log/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-log diff --git a/pigx-common/pigx-common-oss/pom.xml b/pigx-common/pigx-common-oss/pom.xml index beab85ca0..93d0dd83e 100755 --- a/pigx-common/pigx-common-oss/pom.xml +++ b/pigx-common/pigx-common-oss/pom.xml @@ -6,7 +6,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-oss diff --git a/pigx-common/pigx-common-seata/pom.xml b/pigx-common/pigx-common-seata/pom.xml index a105ae50f..ab29c8f91 100644 --- a/pigx-common/pigx-common-seata/pom.xml +++ b/pigx-common/pigx-common-seata/pom.xml @@ -23,7 +23,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-seata diff --git a/pigx-common/pigx-common-security/pom.xml b/pigx-common/pigx-common-security/pom.xml index 4269599c9..bf6114bcf 100644 --- a/pigx-common/pigx-common-security/pom.xml +++ b/pigx-common/pigx-common-security/pom.xml @@ -23,7 +23,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-security diff --git a/pigx-common/pigx-common-sentinel/pom.xml b/pigx-common/pigx-common-sentinel/pom.xml index f8d91d088..4560bbbc5 100755 --- a/pigx-common/pigx-common-sentinel/pom.xml +++ b/pigx-common/pigx-common-sentinel/pom.xml @@ -5,7 +5,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT 4.0.0 diff --git a/pigx-common/pigx-common-sequence/pom.xml b/pigx-common/pigx-common-sequence/pom.xml index 2fcc06085..cde8f273d 100755 --- a/pigx-common/pigx-common-sequence/pom.xml +++ b/pigx-common/pigx-common-sequence/pom.xml @@ -6,7 +6,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-sequence diff --git a/pigx-common/pigx-common-swagger/pom.xml b/pigx-common/pigx-common-swagger/pom.xml index 60ae73d2e..d011ba3b2 100644 --- a/pigx-common/pigx-common-swagger/pom.xml +++ b/pigx-common/pigx-common-swagger/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-swagger diff --git a/pigx-common/pigx-common-swagger/src/main/java/com/pig4cloud/pigx/common/swagger/config/OpenAPIMetadataConfiguration.java b/pigx-common/pigx-common-swagger/src/main/java/com/pig4cloud/pigx/common/swagger/config/OpenAPIMetadataConfiguration.java index a73e2815b..ce2d488cd 100644 --- a/pigx-common/pigx-common-swagger/src/main/java/com/pig4cloud/pigx/common/swagger/config/OpenAPIMetadataConfiguration.java +++ b/pigx-common/pigx-common-swagger/src/main/java/com/pig4cloud/pigx/common/swagger/config/OpenAPIMetadataConfiguration.java @@ -20,6 +20,12 @@ public class OpenAPIMetadataConfiguration implements InitializingBean, Applicati @Override public void afterPropertiesSet() throws Exception { + String[] beanNamesForType = applicationContext.getBeanNamesForType(ServiceInstance.class); + + if (beanNamesForType.length == 0) { + return; + } + ServiceInstance serviceInstance = applicationContext.getBean(ServiceInstance.class); serviceInstance.getMetadata().put("spring-doc", path); } diff --git a/pigx-common/pigx-common-websocket/pom.xml b/pigx-common/pigx-common-websocket/pom.xml index 0e07d9dd9..55f490646 100755 --- a/pigx-common/pigx-common-websocket/pom.xml +++ b/pigx-common/pigx-common-websocket/pom.xml @@ -6,7 +6,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-websocket diff --git a/pigx-common/pigx-common-xss/pom.xml b/pigx-common/pigx-common-xss/pom.xml index 1ebea9fa1..bddf6ea92 100755 --- a/pigx-common/pigx-common-xss/pom.xml +++ b/pigx-common/pigx-common-xss/pom.xml @@ -6,7 +6,7 @@ com.pig4cloud pigx-common - 5.4.0 + 5.5.0-SNAPSHOT pigx-common-xss diff --git a/pigx-common/pom.xml b/pigx-common/pom.xml index e9901b28c..d2d0ac5da 100644 --- a/pigx-common/pom.xml +++ b/pigx-common/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - 5.4.0 + 5.5.0-SNAPSHOT pigx-common diff --git a/pigx-flow/pigx-flow-engine/pigx-flow-engine-api/pom.xml b/pigx-flow/pigx-flow-engine/pigx-flow-engine-api/pom.xml index 178193d0c..7d19acc2d 100644 --- a/pigx-flow/pigx-flow-engine/pigx-flow-engine-api/pom.xml +++ b/pigx-flow/pigx-flow-engine/pigx-flow-engine-api/pom.xml @@ -7,7 +7,7 @@ com.pig4cloud pigx-flow-engine - 5.4.0 + 5.5.0-SNAPSHOT pigx-flow-engine-api diff --git a/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/pom.xml b/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/pom.xml index 255fba23d..31531459c 100644 --- a/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/pom.xml +++ b/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/pom.xml @@ -7,7 +7,7 @@ com.pig4cloud pigx-flow-engine - 5.4.0 + 5.5.0-SNAPSHOT pigx-flow-engine-biz @@ -123,16 +123,24 @@ DmJdbcDriver18 - - - - org.springframework.boot - spring-boot-maven-plugin - - - io.fabric8 - docker-maven-plugin - - - + + + cloud + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + false + + + + + + diff --git a/pigx-flow/pigx-flow-engine/pom.xml b/pigx-flow/pigx-flow-engine/pom.xml index 119d5f448..dc604228a 100644 --- a/pigx-flow/pigx-flow-engine/pom.xml +++ b/pigx-flow/pigx-flow-engine/pom.xml @@ -7,7 +7,7 @@ com.pig4cloud pigx-flow - 5.4.0 + 5.5.0-SNAPSHOT pigx-flow-engine diff --git a/pigx-flow/pigx-flow-task/pigx-flow-task-api/pom.xml b/pigx-flow/pigx-flow-task/pigx-flow-task-api/pom.xml index 0da1e832f..e898b787c 100644 --- a/pigx-flow/pigx-flow-task/pigx-flow-task-api/pom.xml +++ b/pigx-flow/pigx-flow-task/pigx-flow-task-api/pom.xml @@ -7,7 +7,7 @@ com.pig4cloud pigx-flow-task - 5.4.0 + 5.5.0-SNAPSHOT pigx-flow-task-api diff --git a/pigx-flow/pigx-flow-task/pigx-flow-task-biz/pom.xml b/pigx-flow/pigx-flow-task/pigx-flow-task-biz/pom.xml index 3aefb5c8f..567449364 100644 --- a/pigx-flow/pigx-flow-task/pigx-flow-task-biz/pom.xml +++ b/pigx-flow/pigx-flow-task/pigx-flow-task-biz/pom.xml @@ -7,7 +7,7 @@ com.pig4cloud pigx-flow-task - 5.4.0 + 5.5.0-SNAPSHOT pigx-flow-task-biz @@ -103,16 +103,24 @@ DmJdbcDriver18 - - - - org.springframework.boot - spring-boot-maven-plugin - - - io.fabric8 - docker-maven-plugin - - - + + + cloud + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + false + + + + + + diff --git a/pigx-flow/pigx-flow-task/pom.xml b/pigx-flow/pigx-flow-task/pom.xml index 752e53925..c5c713cb4 100644 --- a/pigx-flow/pigx-flow-task/pom.xml +++ b/pigx-flow/pigx-flow-task/pom.xml @@ -7,7 +7,7 @@ com.pig4cloud pigx-flow - 5.4.0 + 5.5.0-SNAPSHOT pigx-flow-task diff --git a/pigx-flow/pom.xml b/pigx-flow/pom.xml index 13d972642..652ab4330 100644 --- a/pigx-flow/pom.xml +++ b/pigx-flow/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - 5.4.0 + 5.5.0-SNAPSHOT pigx-flow diff --git a/pigx-gateway/pom.xml b/pigx-gateway/pom.xml index e49d3ef73..059d943b6 100644 --- a/pigx-gateway/pom.xml +++ b/pigx-gateway/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - 5.4.0 + 5.5.0-SNAPSHOT pigx-gateway @@ -66,18 +66,6 @@ com.alibaba.cloud spring-cloud-starter-alibaba-nacos-config - - - com.github.anji-plus - captcha-spring-boot-starter - ${captcha.version} - - - - io.springboot.plugin - captcha-core - ${captcha.image.version} - org.springframework.boot diff --git a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/config/GatewayConfigProperties.java b/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/config/GatewayConfigProperties.java deleted file mode 100644 index 23a4e8b13..000000000 --- a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/config/GatewayConfigProperties.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.pig4cloud.pigx.gateway.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.cloud.context.config.annotation.RefreshScope; -import org.springframework.stereotype.Component; - -/** - * @author lengleng - * @date 2020/10/2 - *

- * 网关通用配置文件 - */ -@Data -@Component -@RefreshScope -@ConfigurationProperties("gateway") -public class GatewayConfigProperties { - - /** - * 网关解密登录前端密码 秘钥 {@link com.pig4cloud.pigx.gateway.filter.PasswordDecoderFilter} - */ - public String encodeKey; - -} diff --git a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/config/RouterFunctionConfiguration.java b/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/config/RouterFunctionConfiguration.java deleted file mode 100644 index b72592e18..000000000 --- a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/config/RouterFunctionConfiguration.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.gateway.config; - -import com.pig4cloud.pigx.gateway.handler.ImageCodeCheckHandler; -import com.pig4cloud.pigx.gateway.handler.ImageCodeCreateHandler; -import com.pig4cloud.pigx.gateway.handler.ImageCodeMathHandler; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.MediaType; -import org.springframework.web.reactive.function.server.RequestPredicates; -import org.springframework.web.reactive.function.server.RouterFunction; -import org.springframework.web.reactive.function.server.RouterFunctions; - -/** - * @author lengleng - * @date 2018/7/5 路由配置信息 - */ -@Slf4j -@Configuration -@AllArgsConstructor -public class RouterFunctionConfiguration { - - private final ImageCodeCheckHandler imageCodeCheckHandler; - - private final ImageCodeCreateHandler imageCodeCreateHandler; - - private final ImageCodeMathHandler imageCodeMathHandler; - - @Bean - public RouterFunction routerFunction() { - return RouterFunctions - .route(RequestPredicates.path("/code/create").and(RequestPredicates.accept(MediaType.TEXT_PLAIN)), - imageCodeCreateHandler) - .andRoute(RequestPredicates.path("/code/image").and(RequestPredicates.accept(MediaType.TEXT_PLAIN)), - imageCodeMathHandler) - .andRoute(RequestPredicates.POST("/code/check").and(RequestPredicates.accept(MediaType.ALL)), - imageCodeCheckHandler); - - } - -} diff --git a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/filter/PasswordDecoderFilter.java b/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/filter/PasswordDecoderFilter.java deleted file mode 100644 index 43695920f..000000000 --- a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/filter/PasswordDecoderFilter.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.gateway.filter; - -import cn.hutool.core.util.CharsetUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.crypto.Mode; -import cn.hutool.crypto.Padding; -import cn.hutool.crypto.SecureUtil; -import cn.hutool.crypto.symmetric.AES; -import cn.hutool.http.HttpUtil; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.pig4cloud.pigx.common.core.constant.CacheConstants; -import com.pig4cloud.pigx.common.core.constant.CommonConstants; -import com.pig4cloud.pigx.common.core.constant.SecurityConstants; -import com.pig4cloud.pigx.common.core.constant.enums.EncFlagTypeEnum; -import com.pig4cloud.pigx.common.core.util.WebUtils; -import com.pig4cloud.pigx.gateway.config.GatewayConfigProperties; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.cloud.gateway.filter.GatewayFilter; -import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; -import org.springframework.cloud.gateway.filter.factory.rewrite.CachedBodyOutputMessage; -import org.springframework.cloud.gateway.support.BodyInserterContext; -import org.springframework.core.io.buffer.DataBuffer; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.codec.HttpMessageReader; -import org.springframework.http.server.reactive.ServerHttpRequest; -import org.springframework.http.server.reactive.ServerHttpRequestDecorator; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.BodyInserter; -import org.springframework.web.reactive.function.BodyInserters; -import org.springframework.web.reactive.function.server.HandlerStrategies; -import org.springframework.web.reactive.function.server.ServerRequest; -import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; -import java.nio.charset.Charset; -import java.util.List; -import java.util.Map; -import java.util.function.Function; - -/** - * @author lengleng - * @date 2020/1/8 密码解密工具类 - *

- * 参考 ModifyRequestBodyGatewayFilterFactory 实现 - */ -@Slf4j -@Component -@RequiredArgsConstructor -@SuppressWarnings("all") -public class PasswordDecoderFilter extends AbstractGatewayFilterFactory { - - private final List> messageReaders = HandlerStrategies.withDefaults().messageReaders(); - - private static final String PASSWORD = "password"; - - private static final String KEY_ALGORITHM = "AES"; - - private final StringRedisTemplate redisTemplate; - - private final GatewayConfigProperties gatewayConfig; - - static { - // 关闭hutool 强制关闭Bouncy Castle库的依赖 - SecureUtil.disableBouncyCastle(); - } - - @Override - public GatewayFilter apply(Object config) { - return (exchange, chain) -> { - ServerHttpRequest request = exchange.getRequest(); - // 1. 不是登录请求,直接向下执行 - if (!StrUtil.containsAnyIgnoreCase(request.getURI().getPath(), SecurityConstants.OAUTH_TOKEN_URL)) { - return chain.filter(exchange); - } - - // 2. 刷新token类型,直接向下执行 - String grantType = request.getQueryParams().getFirst("grant_type"); - if (StrUtil.equals(SecurityConstants.REFRESH_TOKEN, grantType)) { - return chain.filter(exchange); - } - - // 3. 判断客户端是否需要解密,明文传输直接向下执行 - if (!isEncClient(request)) { - return chain.filter(exchange); - } - - // 4. 前端加密密文解密逻辑 - Class inClass = String.class; - Class outClass = String.class; - ServerRequest serverRequest = ServerRequest.create(exchange, messageReaders); - - // 解密生成新的报文 - Mono modifiedBody = serverRequest.bodyToMono(inClass).flatMap(decryptAES()); - - BodyInserter bodyInserter = BodyInserters.fromPublisher(modifiedBody, outClass); - HttpHeaders headers = new HttpHeaders(); - headers.putAll(exchange.getRequest().getHeaders()); - headers.remove(HttpHeaders.CONTENT_LENGTH); - - headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE); - CachedBodyOutputMessage outputMessage = new CachedBodyOutputMessage(exchange, headers); - return bodyInserter.insert(outputMessage, new BodyInserterContext()).then(Mono.defer(() -> { - ServerHttpRequest decorator = decorate(exchange, headers, outputMessage); - return chain.filter(exchange.mutate().request(decorator).build()); - })); - }; - } - - /** - * 根据请求的clientId 查询客户端配置是否是加密传输 - * @param request 请求上下文 - * @return true 加密传输 、 false 原文传输 - */ - private boolean isEncClient(ServerHttpRequest request) { - String header = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION); - String clientId = WebUtils.extractClientId(header).orElse(null); - // 获取租户拼接区分租户的key - String tenantId = request.getHeaders().getFirst(CommonConstants.TENANT_ID); - String key = String.format("%s:%s:%s", StrUtil.isBlank(tenantId) ? CommonConstants.TENANT_ID_1 : tenantId, - CacheConstants.CLIENT_FLAG, clientId); - - String val = redisTemplate.opsForValue().get(key); - - // 当配置不存在时,默认需要解密 - if (val == null) { - return true; - } - - JSONObject information = JSONUtil.parseObj(val); - if (StrUtil.equals(EncFlagTypeEnum.NO.getType(), information.getStr(CommonConstants.ENC_FLAG))) { - return false; - } - return true; - } - - /** - * 原文解密 - * @return - */ - private Function decryptAES() { - return s -> { - // 构建前端对应解密AES 因子 - AES aes = new AES(Mode.CFB, Padding.NoPadding, - new SecretKeySpec(gatewayConfig.getEncodeKey().getBytes(), KEY_ALGORITHM), - new IvParameterSpec(gatewayConfig.getEncodeKey().getBytes())); - - // 获取请求密码并解密 - Map inParamsMap = HttpUtil.decodeParamMap((String) s, CharsetUtil.CHARSET_UTF_8); - if (inParamsMap.containsKey(PASSWORD)) { - String password = aes.decryptStr(inParamsMap.get(PASSWORD)); - // 返回修改后报文字符 - inParamsMap.put(PASSWORD, password); - } - else { - log.error("非法请求数据:{}", s); - } - - // 使用 - return Mono.just(HttpUtil.toParams(inParamsMap, Charset.defaultCharset(), true)); - }; - } - - /** - * 报文转换 - * @return - */ - private ServerHttpRequestDecorator decorate(ServerWebExchange exchange, HttpHeaders headers, - CachedBodyOutputMessage outputMessage) { - return new ServerHttpRequestDecorator(exchange.getRequest()) { - @Override - public HttpHeaders getHeaders() { - long contentLength = headers.getContentLength(); - HttpHeaders httpHeaders = new HttpHeaders(); - httpHeaders.putAll(super.getHeaders()); - if (contentLength > 0) { - httpHeaders.setContentLength(contentLength); - } - else { - httpHeaders.set(HttpHeaders.TRANSFER_ENCODING, "chunked"); - } - return httpHeaders; - } - - @Override - public Flux getBody() { - return outputMessage.getBody(); - } - }; - } - -} diff --git a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/filter/ValidateCodeGatewayFilter.java b/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/filter/ValidateCodeGatewayFilter.java deleted file mode 100644 index 8df22d6aa..000000000 --- a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/filter/ValidateCodeGatewayFilter.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.gateway.filter; - -import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.anji.captcha.model.vo.CaptchaVO; -import com.anji.captcha.service.CaptchaService; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.pig4cloud.pigx.common.core.constant.CacheConstants; -import com.pig4cloud.pigx.common.core.constant.CommonConstants; -import com.pig4cloud.pigx.common.core.constant.SecurityConstants; -import com.pig4cloud.pigx.common.core.constant.enums.CaptchaFlagTypeEnum; -import com.pig4cloud.pigx.common.core.exception.ValidateCodeException; -import com.pig4cloud.pigx.common.core.util.R; -import com.pig4cloud.pigx.common.core.util.SpringContextHolder; -import com.pig4cloud.pigx.common.core.util.WebUtils; -import lombok.AllArgsConstructor; -import lombok.SneakyThrows; -import lombok.extern.slf4j.Slf4j; -import org.springframework.cloud.gateway.filter.GatewayFilter; -import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.server.reactive.ServerHttpRequest; -import org.springframework.http.server.reactive.ServerHttpResponse; -import org.springframework.stereotype.Component; -import reactor.core.publisher.Mono; - -/** - * @author lengleng - * @date 2020/5/19 登录逻辑验证码处理 - */ -@Slf4j -@Component -@AllArgsConstructor -@SuppressWarnings("all") -public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory { - - private final StringRedisTemplate redisTemplate; - - private final ObjectMapper objectMapper; - - @Override - public GatewayFilter apply(Object config) { - return (exchange, chain) -> { - ServerHttpRequest request = exchange.getRequest(); - - // 不是登录请求直接向下执行 - if (!StrUtil.containsAnyIgnoreCase(request.getURI().getPath(), SecurityConstants.OAUTH_TOKEN_URL)) { - return chain.filter(exchange); - } - - // 刷新token,直接向下执行 - String grantType = request.getQueryParams().getFirst("grant_type"); - if (StrUtil.equals(SecurityConstants.REFRESH_TOKEN, grantType)) { - return chain.filter(exchange); - } - - // mobile模式, 如果请求不包含mobile 参数直接 - String mobile = request.getQueryParams().getFirst(SecurityConstants.GRANT_MOBILE); - if (StrUtil.equals(SecurityConstants.GRANT_MOBILE, grantType) && StrUtil.isBlank(mobile)) { - throw new ValidateCodeException(); - } - - // mobile模式, 社交登录模式不校验验证码直接跳过 - if (StrUtil.equals(SecurityConstants.GRANT_MOBILE, grantType) && !StrUtil.contains(mobile, "SMS")) { - return chain.filter(exchange); - } - - // 判断客户端是否跳过检验 - if (!isCheckCaptchaClient(request)) { - return chain.filter(exchange); - } - - try { - // 校验验证码 - checkCode(request); - } - catch (Exception e) { - ServerHttpResponse response = exchange.getResponse(); - response.getHeaders().setContentType(MediaType.APPLICATION_JSON); - response.setStatusCode(HttpStatus.PRECONDITION_REQUIRED); - try { - return response.writeWith(Mono.just( - response.bufferFactory().wrap(objectMapper.writeValueAsBytes(R.failed(e.getMessage()))))); - } - catch (JsonProcessingException e1) { - log.error("对象输出异常", e1); - } - } - - return chain.filter(exchange); - }; - } - - /** - * 是否需要校验客户端,根据client 查询客户端配置 - * @param request 请求 - * @return true 需要校验, false 不需要校验 - */ - private boolean isCheckCaptchaClient(ServerHttpRequest request) { - String header = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION); - String clientId = WebUtils.extractClientId(header).orElse(null); - // 获取租户拼接区分租户的key - String tenantId = request.getHeaders().getFirst(CommonConstants.TENANT_ID); - String key = String.format("%s:%s:%s", StrUtil.isBlank(tenantId) ? CommonConstants.TENANT_ID_1 : tenantId, - CacheConstants.CLIENT_FLAG, clientId); - - String val = redisTemplate.opsForValue().get(key); - - // 当配置不存在时,不用校验 - if (val == null) { - return false; - } - - JSONObject information = JSONUtil.parseObj(val); - if (StrUtil.equals(CaptchaFlagTypeEnum.OFF.getType(), information.getStr(CommonConstants.CAPTCHA_FLAG))) { - return false; - } - return true; - } - - /** - * 检查code - * @param request - */ - @SneakyThrows - private void checkCode(ServerHttpRequest request) { - String code = request.getQueryParams().getFirst("code"); - - if (StrUtil.isBlank(code)) { - throw new ValidateCodeException("验证码不能为空"); - } - - String randomStr = request.getQueryParams().getFirst("randomStr"); - - // 若是滑块登录 - if (CommonConstants.IMAGE_CODE_TYPE.equalsIgnoreCase(randomStr)) { - CaptchaService captchaService = SpringContextHolder.getBean(CaptchaService.class); - CaptchaVO vo = new CaptchaVO(); - vo.setCaptchaVerification(code); - vo.setCaptchaType(CommonConstants.IMAGE_CODE_TYPE); - if (!captchaService.verification(vo).isSuccess()) { - throw new ValidateCodeException("验证码不能为空"); - } - return; - } - - // https://gitee.com/log4j/pig/issues/IWA0D - String mobile = request.getQueryParams().getFirst("mobile"); - if (StrUtil.isNotBlank(mobile)) { - randomStr = mobile; - } - - String key = CacheConstants.DEFAULT_CODE_KEY + randomStr; - if (!redisTemplate.hasKey(key)) { - throw new ValidateCodeException("验证码不合法"); - } - - String saveCode = redisTemplate.opsForValue().get(key); - - if (saveCode == null) { - throw new ValidateCodeException("验证码不合法"); - } - - if (StrUtil.isBlank(saveCode)) { - redisTemplate.delete(key); - throw new ValidateCodeException("验证码不合法"); - } - - if (!StrUtil.equals(saveCode, code)) { - redisTemplate.delete(key); - throw new ValidateCodeException("验证码不合法"); - } - - redisTemplate.delete(key); - } - -} diff --git a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/handler/ImageCodeCheckHandler.java b/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/handler/ImageCodeCheckHandler.java deleted file mode 100644 index 003d2328b..000000000 --- a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/handler/ImageCodeCheckHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.gateway.handler; - -import com.anji.captcha.model.common.ResponseModel; -import com.anji.captcha.model.vo.CaptchaVO; -import com.anji.captcha.service.CaptchaService; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.pig4cloud.pigx.common.core.constant.CommonConstants; -import com.pig4cloud.pigx.common.core.util.R; -import com.pig4cloud.pigx.common.core.util.SpringContextHolder; -import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.BodyInserters; -import org.springframework.web.reactive.function.server.HandlerFunction; -import org.springframework.web.reactive.function.server.ServerRequest; -import org.springframework.web.reactive.function.server.ServerResponse; -import reactor.core.publisher.Mono; - -/** - * @author lengleng - * @date 2020/5/19 验证码生成逻辑处理类 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class ImageCodeCheckHandler implements HandlerFunction { - - private final ObjectMapper objectMapper; - - @Override - @SneakyThrows - public Mono handle(ServerRequest request) { - CaptchaVO vo = new CaptchaVO(); - vo.setPointJson(request.queryParam("pointJson").get()); - vo.setToken(request.queryParam("token").get()); - vo.setCaptchaType(CommonConstants.IMAGE_CODE_TYPE); - - CaptchaService captchaService = SpringContextHolder.getBean(CaptchaService.class); - ResponseModel responseModel = captchaService.check(vo); - - return ServerResponse.status(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON) - .body(BodyInserters.fromValue(objectMapper.writeValueAsString(R.ok(responseModel)))); - } - -} diff --git a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/handler/ImageCodeCreateHandler.java b/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/handler/ImageCodeCreateHandler.java deleted file mode 100644 index edd33974d..000000000 --- a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/handler/ImageCodeCreateHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.gateway.handler; - -import com.anji.captcha.model.common.ResponseModel; -import com.anji.captcha.model.vo.CaptchaVO; -import com.anji.captcha.service.CaptchaService; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.pig4cloud.pigx.common.core.constant.CommonConstants; -import com.pig4cloud.pigx.common.core.util.R; -import com.pig4cloud.pigx.common.core.util.SpringContextHolder; -import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.BodyInserters; -import org.springframework.web.reactive.function.server.HandlerFunction; -import org.springframework.web.reactive.function.server.ServerRequest; -import org.springframework.web.reactive.function.server.ServerResponse; -import reactor.core.publisher.Mono; - -/** - * @author lengleng - * @date 2020/5/19 验证码生成逻辑处理类 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class ImageCodeCreateHandler implements HandlerFunction { - - private final ObjectMapper objectMapper; - - @Override - @SneakyThrows - public Mono handle(ServerRequest serverRequest) { - CaptchaVO vo = new CaptchaVO(); - vo.setCaptchaType(CommonConstants.IMAGE_CODE_TYPE); - CaptchaService captchaService = SpringContextHolder.getBean(CaptchaService.class); - ResponseModel responseModel = captchaService.get(vo); - - return ServerResponse.status(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON) - .body(BodyInserters.fromValue(objectMapper.writeValueAsString(R.ok(responseModel)))); - } - -} diff --git a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/handler/ImageCodeMathHandler.java b/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/handler/ImageCodeMathHandler.java deleted file mode 100755 index c784e0b13..000000000 --- a/pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/handler/ImageCodeMathHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pigx.gateway.handler; - -import com.pig4cloud.pigx.common.core.constant.CacheConstants; -import com.pig4cloud.pigx.common.core.constant.SecurityConstants; -import io.springboot.captcha.ArithmeticCaptcha; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.core.io.ByteArrayResource; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; -import org.springframework.util.FastByteArrayOutputStream; -import org.springframework.web.reactive.function.BodyInserters; -import org.springframework.web.reactive.function.server.HandlerFunction; -import org.springframework.web.reactive.function.server.ServerRequest; -import org.springframework.web.reactive.function.server.ServerResponse; -import reactor.core.publisher.Mono; - -import java.util.Optional; -import java.util.concurrent.TimeUnit; - -/** - * @author lengleng - * @date 2023-09-29 数据验证码实现 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class ImageCodeMathHandler implements HandlerFunction { - - private static final Integer DEFAULT_IMAGE_WIDTH = 100; - - private static final Integer DEFAULT_IMAGE_HEIGHT = 40; - - private final StringRedisTemplate redisTemplate; - - @Override - public Mono handle(ServerRequest serverRequest) { - ArithmeticCaptcha captcha = new ArithmeticCaptcha(DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT); - - String result = captcha.text(); - - // 保存验证码信息 - Optional randomStr = serverRequest.queryParam("randomStr"); - randomStr.ifPresent(s -> redisTemplate.opsForValue().set(CacheConstants.DEFAULT_CODE_KEY + s, result, - SecurityConstants.CODE_TIME, TimeUnit.SECONDS)); - - // 转换流信息写出 - FastByteArrayOutputStream os = new FastByteArrayOutputStream(); - captcha.out(os); - - return ServerResponse.status(HttpStatus.OK).contentType(MediaType.IMAGE_JPEG) - .body(BodyInserters.fromResource(new ByteArrayResource(os.toByteArray()))); - } - -} diff --git a/pigx-register/pom.xml b/pigx-register/pom.xml index d1a8313fd..3e5e3898a 100644 --- a/pigx-register/pom.xml +++ b/pigx-register/pom.xml @@ -18,7 +18,7 @@ com.pig4cloud pigx - 5.4.0 + 5.5.0-SNAPSHOT pigx-register diff --git a/pigx-upms/pigx-upms-api/pom.xml b/pigx-upms/pigx-upms-api/pom.xml index d8466b20f..619758fac 100644 --- a/pigx-upms/pigx-upms-api/pom.xml +++ b/pigx-upms/pigx-upms-api/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-upms - 5.4.0 + 5.5.0-SNAPSHOT pigx-upms-api diff --git a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteFileService.java b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteFileService.java new file mode 100644 index 000000000..02120b00f --- /dev/null +++ b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteFileService.java @@ -0,0 +1,20 @@ +package com.pig4cloud.pigx.admin.api.feign; + +import com.pig4cloud.pigx.common.core.constant.ServiceNameConstants; +import feign.Response; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * 文件读取 + * + * @author lengleng + * @date 2024/3/14 + */ +@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.UPMS_SERVICE) +public interface RemoteFileService { + + @GetMapping("/sys-file/oss/file") + Response getFile(@RequestParam String fileName); +} diff --git a/pigx-upms/pigx-upms-biz/pom.xml b/pigx-upms/pigx-upms-biz/pom.xml index 2d38fed84..ef7877745 100644 --- a/pigx-upms/pigx-upms-biz/pom.xml +++ b/pigx-upms/pigx-upms-biz/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-upms - 5.4.0 + 5.5.0-SNAPSHOT pigx-upms-biz @@ -161,27 +161,28 @@ + + + cloud + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + false + + + + + + + - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - io.fabric8 - docker-maven-plugin - - false - - - src/main/resources @@ -201,5 +202,4 @@ - diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysTokenController.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysTokenController.java index fe095d240..36564a00b 100644 --- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysTokenController.java +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysTokenController.java @@ -39,7 +39,7 @@ import java.util.Map; */ @RestController @AllArgsConstructor -@RequestMapping("/token") +@RequestMapping("/sys-token") @Tag(description = "token", name = "令牌管理模块") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SysTokenController { diff --git a/pigx-upms/pom.xml b/pigx-upms/pom.xml index a5ca37148..862794ba6 100644 --- a/pigx-upms/pom.xml +++ b/pigx-upms/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - 5.4.0 + 5.5.0-SNAPSHOT pigx-upms diff --git a/pigx-visual/pigx-codegen/pom.xml b/pigx-visual/pigx-codegen/pom.xml index e947169e5..7eedac863 100755 --- a/pigx-visual/pigx-codegen/pom.xml +++ b/pigx-visual/pigx-codegen/pom.xml @@ -6,7 +6,7 @@ com.pig4cloud pigx-visual - 5.4.0 + 5.5.0-SNAPSHOT pigx-codegen @@ -175,26 +175,24 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - io.fabric8 - docker-maven-plugin - - false - - - - + + + cloud + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + false + + + + + + diff --git a/pigx-visual/pigx-daemon-elastic-job/pom.xml b/pigx-visual/pigx-daemon-elastic-job/pom.xml index 5f4e668e8..1a39bee08 100644 --- a/pigx-visual/pigx-daemon-elastic-job/pom.xml +++ b/pigx-visual/pigx-daemon-elastic-job/pom.xml @@ -23,7 +23,7 @@ com.pig4cloud pigx-visual - 5.4.0 + 5.5.0-SNAPSHOT pigx-daemon-elastic-job @@ -93,27 +93,25 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - io.fabric8 - docker-maven-plugin - - false - - - - + + + cloud + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + false + + + + + + diff --git a/pigx-visual/pigx-daemon-quartz/pom.xml b/pigx-visual/pigx-daemon-quartz/pom.xml index 0a5b1c162..ac957ff46 100644 --- a/pigx-visual/pigx-daemon-quartz/pom.xml +++ b/pigx-visual/pigx-daemon-quartz/pom.xml @@ -1,126 +1,124 @@ - - com.pig4cloud - pigx-visual - 5.4.0 - - 4.0.0 + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + com.pig4cloud + pigx-visual + 5.5.0-SNAPSHOT + + 4.0.0 - pigx-daemon-quartz - jar + pigx-daemon-quartz + jar - 基于quartz后台跑批定时任务模块 + 基于quartz后台跑批定时任务模块 - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-config - - - - com.pig4cloud - pigx-common-log - - - com.pig4cloud - pigx-common-data - - - - com.baomidou - mybatis-plus-boot-starter - - - - com.mysql - mysql-connector-j - - - - com.microsoft.sqlserver - mssql-jdbc - - - - com.oracle.database.jdbc - ojdbc8 - - - - org.postgresql - postgresql - - - - com.alibaba - druid-spring-boot-starter - - - - com.pig4cloud - pigx-common-swagger - - - - com.pig4cloud - pigx-common-security - - - - com.pig4cloud - pigx-common-sentinel - - - - com.pig4cloud - pigx-common-gray - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-undertow - - - - org.springframework.boot - spring-boot-starter-quartz - - + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + com.pig4cloud + pigx-common-log + + + com.pig4cloud + pigx-common-data + + + + com.baomidou + mybatis-plus-boot-starter + + + + com.mysql + mysql-connector-j + + + + com.microsoft.sqlserver + mssql-jdbc + + + + com.oracle.database.jdbc + ojdbc8 + + + + org.postgresql + postgresql + + + + com.alibaba + druid-spring-boot-starter + + + + com.pig4cloud + pigx-common-swagger + + + + com.pig4cloud + pigx-common-security + + + + com.pig4cloud + pigx-common-sentinel + + + + com.pig4cloud + pigx-common-gray + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-undertow + + + + org.springframework.boot + spring-boot-starter-quartz + + - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - io.fabric8 - docker-maven-plugin - - false - - - - + + + cloud + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + false + + + + + + diff --git a/pigx-visual/pigx-jimu-platform/pom.xml b/pigx-visual/pigx-jimu-platform/pom.xml index 0874c2db9..271e24595 100755 --- a/pigx-visual/pigx-jimu-platform/pom.xml +++ b/pigx-visual/pigx-jimu-platform/pom.xml @@ -5,7 +5,7 @@ com.pig4cloud pigx-visual - 5.4.0 + 5.5.0-SNAPSHOT pigx-jimu-platform diff --git a/pigx-visual/pigx-monitor/pom.xml b/pigx-visual/pigx-monitor/pom.xml index 2bfd1f9a3..fe4dfdbc8 100644 --- a/pigx-visual/pigx-monitor/pom.xml +++ b/pigx-visual/pigx-monitor/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-visual - 5.4.0 + 5.5.0-SNAPSHOT pigx-monitor diff --git a/pigx-visual/pigx-mp-platform/pom.xml b/pigx-visual/pigx-mp-platform/pom.xml index af47ad33b..4ebc5b1bb 100755 --- a/pigx-visual/pigx-mp-platform/pom.xml +++ b/pigx-visual/pigx-mp-platform/pom.xml @@ -6,7 +6,7 @@ com.pig4cloud pigx-visual - 5.4.0 + 5.5.0-SNAPSHOT pigx-mp-platform @@ -115,26 +115,24 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - io.fabric8 - docker-maven-plugin - - false - - - - + + + cloud + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + false + + + + + + diff --git a/pigx-visual/pigx-pay-platform/pom.xml b/pigx-visual/pigx-pay-platform/pom.xml index b5318b228..a87cf8839 100755 --- a/pigx-visual/pigx-pay-platform/pom.xml +++ b/pigx-visual/pigx-pay-platform/pom.xml @@ -6,7 +6,7 @@ com.pig4cloud pigx-visual - 5.4.0 + 5.5.0-SNAPSHOT pigx-pay-platform @@ -141,26 +141,24 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - io.fabric8 - docker-maven-plugin - - false - - - - + + + cloud + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + false + + + + + + diff --git a/pigx-visual/pigx-report-platform/pom.xml b/pigx-visual/pigx-report-platform/pom.xml index 8240f027a..e6d996eb6 100644 --- a/pigx-visual/pigx-report-platform/pom.xml +++ b/pigx-visual/pigx-report-platform/pom.xml @@ -5,7 +5,7 @@ com.pig4cloud pigx-visual - 5.4.0 + 5.5.0-SNAPSHOT pigx-report-platform diff --git a/pigx-visual/pigx-seata-server/pom.xml b/pigx-visual/pigx-seata-server/pom.xml index 29e714901..d232555ba 100644 --- a/pigx-visual/pigx-seata-server/pom.xml +++ b/pigx-visual/pigx-seata-server/pom.xml @@ -20,7 +20,7 @@ com.pig4cloud pigx-visual - 5.4.0 + 5.5.0-SNAPSHOT 4.0.0 pigx-seata-server diff --git a/pigx-visual/pigx-sentinel-dashboard/pom.xml b/pigx-visual/pigx-sentinel-dashboard/pom.xml index 6c6c7e2ce..c0bb3e5a9 100755 --- a/pigx-visual/pigx-sentinel-dashboard/pom.xml +++ b/pigx-visual/pigx-sentinel-dashboard/pom.xml @@ -6,7 +6,7 @@ com.pig4cloud pigx-visual - 5.4.0 + 5.5.0-SNAPSHOT pigx-sentinel-dashboard diff --git a/pigx-visual/pigx-xxl-job-admin/pom.xml b/pigx-visual/pigx-xxl-job-admin/pom.xml index a8bfa2a80..f186e25d1 100644 --- a/pigx-visual/pigx-xxl-job-admin/pom.xml +++ b/pigx-visual/pigx-xxl-job-admin/pom.xml @@ -4,7 +4,7 @@ com.pig4cloud pigx-visual - 5.4.0 + 5.5.0-SNAPSHOT pigx-xxl-job-admin diff --git a/pigx-visual/pom.xml b/pigx-visual/pom.xml index b2d631023..47386df52 100644 --- a/pigx-visual/pom.xml +++ b/pigx-visual/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - 5.4.0 + 5.5.0-SNAPSHOT pigx-visual diff --git a/pom.xml b/pom.xml index c48a2b095..84d716ddf 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - 5.4.0 + 5.5.0-SNAPSHOT ${project.artifactId} pom @@ -50,6 +50,7 @@ 2.0.0 3.0.0 2.3 + 3.0.5 3.1 3.0.5 2.12.6 @@ -114,6 +115,7 @@ + pigx-boot pigx-register pigx-gateway pigx-auth @@ -251,45 +253,9 @@ - - - - rdc-releases - https://packages.aliyun.com/maven/repository/2161442-release-DcBZC1/ - - - rdc-snapshots - https://packages.aliyun.com/maven/repository/2161442-snapshot-FzKqZK/ - - - - - - public - aliyun nexus - https://maven.aliyun.com/repository/public/ - - true - - - - - - - aliyun-plugin - https://maven.aliyun.com/repository/public - - true - - - false - - - - - dev + cloud dev @@ -301,6 +267,12 @@ true + + boot + + pigx-boot + +