diff --git a/pigx-auth/pom.xml b/pigx-auth/pom.xml index 8568ea524..219bf294f 100644 --- a/pigx-auth/pom.xml +++ b/pigx-auth/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - ${pigx.version} + 1.7.0 pigx-auth @@ -42,13 +42,13 @@ com.pig4cloud pigx-upms-api - ${pigx.version} + 1.7.0 com.pig4cloud pigx-common-security - ${pigx.version} + 1.7.0 diff --git a/pigx-common/pigx-common-core/pom.xml b/pigx-common/pigx-common-core/pom.xml index eb4dd7005..ddbf689d6 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 - ${pigx.version} + 1.7.0 pigx-common-core diff --git a/pigx-common/pigx-common-job/pom.xml b/pigx-common/pigx-common-job/pom.xml index f9650cb69..f58da7175 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 - ${pigx.version} + 1.7.0 pigx-common-job @@ -33,12 +33,6 @@ pigx 定时任务 - - org.projectlombok - lombok - true - - com.dangdang diff --git a/pigx-common/pigx-common-log/pom.xml b/pigx-common/pigx-common-log/pom.xml index eca18bad8..75ca4bac4 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 - ${pigx.version} + 1.7.0 pigx-common-log @@ -38,18 +38,22 @@ com.pig4cloud pigx-common-core - ${pigx.version} + 1.7.0 com.pig4cloud pigx-upms-api - ${pigx.version} + 1.7.0 + + + + org.springframework.security + spring-security-core - com.pig4cloud - pigx-common-security - ${pigx.version} + org.springframework.security.oauth + spring-security-oauth2 diff --git a/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/util/SysLogUtils.java b/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/util/SysLogUtils.java index 968ae1600..f6060beb5 100644 --- a/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/util/SysLogUtils.java +++ b/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/util/SysLogUtils.java @@ -23,11 +23,14 @@ import cn.hutool.core.util.URLUtil; import cn.hutool.http.HttpUtil; import com.pig4cloud.pigx.admin.api.entity.SysLog; import com.pig4cloud.pigx.common.core.constant.CommonConstant; -import com.pig4cloud.pigx.common.security.util.SecurityUtils; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; +import java.util.Objects; /** * 系统日志工具类 @@ -36,16 +39,45 @@ import javax.servlet.http.HttpServletRequest; */ public class SysLogUtils { public static SysLog getSysLog() { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + HttpServletRequest request = ((ServletRequestAttributes) Objects + .requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); SysLog sysLog = new SysLog(); - sysLog.setCreateBy(SecurityUtils.getUser().getUsername()); + sysLog.setCreateBy(Objects.requireNonNull(getUsername())); sysLog.setType(CommonConstant.STATUS_NORMAL); sysLog.setRemoteAddr(HttpUtil.getClientIP(request)); sysLog.setRequestUri(URLUtil.getPath(request.getRequestURI())); sysLog.setMethod(request.getMethod()); sysLog.setUserAgent(request.getHeader("user-agent")); sysLog.setParams(HttpUtil.toParams(request.getParameterMap())); - sysLog.setServiceId(SecurityUtils.getClientId()); + sysLog.setServiceId(getClientId()); return sysLog; } + + /** + * 获取客户端 + * + * @return clientId + */ + private static String getClientId() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication instanceof OAuth2Authentication) { + OAuth2Authentication auth2Authentication = (OAuth2Authentication) authentication; + return auth2Authentication.getOAuth2Request().getClientId(); + } + return null; + } + + /** + * 获取用户名称 + * + * @return username + */ + private static String getUsername() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null) { + return null; + } + return authentication.getName(); + } + } diff --git a/pigx-common/pigx-common-security/pom.xml b/pigx-common/pigx-common-security/pom.xml index 89154956b..a58d4480a 100644 --- a/pigx-common/pigx-common-security/pom.xml +++ b/pigx-common/pigx-common-security/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-common - ${pigx.version} + 1.7.0 pigx-common-security @@ -38,7 +38,7 @@ com.pig4cloud pigx-common-core - ${pigx.version} + 1.7.0 @@ -49,7 +49,7 @@ com.pig4cloud pigx-upms-api - ${pigx.version} + 1.7.0 diff --git a/pigx-common/pigx-common-swagger/pom.xml b/pigx-common/pigx-common-swagger/pom.xml index 597c7bb98..ade99628d 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 - ${pigx.version} + 1.7.0 pigx-common-swagger @@ -34,12 +34,6 @@ - - - com.pig4cloud - pigx-common-security - ${pigx.version} - io.springfox diff --git a/pigx-common/pigx-common-transaction/pom.xml b/pigx-common/pigx-common-transaction/pom.xml index 9062d1adb..125ad4135 100644 --- a/pigx-common/pigx-common-transaction/pom.xml +++ b/pigx-common/pigx-common-transaction/pom.xml @@ -5,7 +5,7 @@ com.pig4cloud pigx-common - ${pigx.version} + 1.7.0 pigx-common-transaction @@ -17,7 +17,7 @@ com.pig4cloud pigx-common-core - ${pigx.version} + 1.7.0 diff --git a/pigx-common/pom.xml b/pigx-common/pom.xml index 99bc4a584..4f3e927d6 100644 --- a/pigx-common/pom.xml +++ b/pigx-common/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - ${pigx.version} + 1.7.0 pigx-common diff --git a/pigx-config/pom.xml b/pigx-config/pom.xml index c40548009..dc2e0f9e1 100644 --- a/pigx-config/pom.xml +++ b/pigx-config/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - ${pigx.version} + 1.7.0 pigx-config diff --git a/pigx-eureka/pom.xml b/pigx-eureka/pom.xml index f4253b057..b2110aa27 100644 --- a/pigx-eureka/pom.xml +++ b/pigx-eureka/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - ${pigx.version} + 1.7.0 pigx-eureka diff --git a/pigx-eureka/src/main/resources/bootstrap.yml b/pigx-eureka/src/main/resources/bootstrap.yml index 2c36ec856..dac0fd7a6 100644 --- a/pigx-eureka/src/main/resources/bootstrap.yml +++ b/pigx-eureka/src/main/resources/bootstrap.yml @@ -7,8 +7,10 @@ spring: name: pig password: pig application: - name: pigx-eureka - + name: pig-eureka + cloud: + config: + enabled: false # docker-compose部署时候 hostname 换成pigx-eureka # 类似的 redis 使用pigx-redis ,gateway 换成 pigx-gateway eureka: diff --git a/pigx-gateway/pom.xml b/pigx-gateway/pom.xml index 1e518691f..6472481c6 100644 --- a/pigx-gateway/pom.xml +++ b/pigx-gateway/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - ${pigx.version} + 1.7.0 pigx-gateway @@ -57,7 +57,7 @@ com.pig4cloud pigx-common-core - ${pigx.version} + 1.7.0 diff --git a/pigx-upms/pigx-upms-api/pom.xml b/pigx-upms/pigx-upms-api/pom.xml index 1e421ba1d..b47946ebf 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 - ${pigx.version} + 1.7.0 pigx-upms-api @@ -38,7 +38,7 @@ com.pig4cloud pigx-common-core - ${pigx.version} + 1.7.0 diff --git a/pigx-upms/pigx-upms-biz/pom.xml b/pigx-upms/pigx-upms-biz/pom.xml index 939ffbf1e..e71344cb3 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 - ${pigx.version} + 1.7.0 pigx-upms-biz @@ -37,19 +37,19 @@ com.pig4cloud pigx-upms-api - ${pigx.version} + 1.7.0 com.pig4cloud pigx-common-log - ${pigx.version} + 1.7.0 com.pig4cloud pigx-common-swagger - ${pigx.version} + 1.7.0 @@ -63,8 +63,9 @@ - org.springframework.cloud - spring-cloud-starter-security + com.pig4cloud + pigx-common-security + 1.7.0 diff --git a/pigx-upms/pom.xml b/pigx-upms/pom.xml index 3767fb208..862a81210 100644 --- a/pigx-upms/pom.xml +++ b/pigx-upms/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - ${pigx.version} + 1.7.0 pigx-upms diff --git a/pigx-visual/pigx-codegen/pom.xml b/pigx-visual/pigx-codegen/pom.xml index 32a13d2de..9adbfb3a6 100755 --- a/pigx-visual/pigx-codegen/pom.xml +++ b/pigx-visual/pigx-codegen/pom.xml @@ -6,7 +6,7 @@ com.pig4cloud pigx-visual - ${pigx.version} + 1.7.0 pigx-codegen @@ -34,13 +34,19 @@ com.pig4cloud pigx-common-core - ${pigx.version} + 1.7.0 - + com.pig4cloud pigx-common-swagger - ${pigx.version} + 1.7.0 + + + + com.pig4cloud + pigx-common-security + 1.7.0 diff --git a/pigx-visual/pigx-daemon/pom.xml b/pigx-visual/pigx-daemon/pom.xml index 04b1a8872..23292b6da 100644 --- a/pigx-visual/pigx-daemon/pom.xml +++ b/pigx-visual/pigx-daemon/pom.xml @@ -23,7 +23,7 @@ com.pig4cloud pigx-visual - ${pigx.version} + 1.7.0 pigx-daemon @@ -41,7 +41,7 @@ com.pig4cloud pigx-common-job - ${pigx.version} + 1.7.0 @@ -64,11 +64,17 @@ curator-recipes ${curator.version} - + com.pig4cloud pigx-common-swagger - ${pigx.version} + 1.7.0 + + + + com.pig4cloud + pigx-common-security + 1.7.0 diff --git a/pigx-visual/pigx-monitor/pom.xml b/pigx-visual/pigx-monitor/pom.xml index d482c5803..79d6fda2e 100644 --- a/pigx-visual/pigx-monitor/pom.xml +++ b/pigx-visual/pigx-monitor/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx-visual - ${pigx.version} + 1.7.0 pigx-monitor diff --git a/pigx-visual/pigx-tx-manager/pom.xml b/pigx-visual/pigx-tx-manager/pom.xml index fa2557769..d584d0533 100644 --- a/pigx-visual/pigx-tx-manager/pom.xml +++ b/pigx-visual/pigx-tx-manager/pom.xml @@ -5,7 +5,7 @@ com.pig4cloud pigx-visual - ${pigx.version} + 1.7.0 pigx-tx-manager @@ -63,7 +63,7 @@ com.pig4cloud pigx-common-core - ${pigx.version} + 1.7.0 diff --git a/pigx-visual/pom.xml b/pigx-visual/pom.xml index 3c86f6da5..2f93af30a 100644 --- a/pigx-visual/pom.xml +++ b/pigx-visual/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pigx - ${pigx.version} + 1.7.0 pigx-visual diff --git a/pom.xml b/pom.xml index 7be3c10aa..7122a1b86 100644 --- a/pom.xml +++ b/pom.xml @@ -24,13 +24,12 @@ com.pig4cloud pigx - ${pigx.version} + 1.7.0 ${project.artifactId} pom https://www.pig4cloud.com - 1.7.0 2.0.6.RELEASE Finchley.SR2 Cairo-SR3