diff --git a/.idea/libraries/Maven__com_alibaba_fastjson_1_2_47.xml b/.idea/libraries/Maven__com_alibaba_fastjson_1_2_47.xml deleted file mode 100644 index dcd6ee59..00000000 --- a/.idea/libraries/Maven__com_alibaba_fastjson_1_2_47.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__com_jcraft_jsch_0_1_54.xml b/.idea/libraries/Maven__com_jcraft_jsch_0_1_54.xml deleted file mode 100644 index 2a43ce75..00000000 --- a/.idea/libraries/Maven__com_jcraft_jsch_0_1_54.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_eclipse_jgit_org_eclipse_jgit_5_1_3_201810200350_r.xml b/.idea/libraries/Maven__org_eclipse_jgit_org_eclipse_jgit_5_1_3_201810200350_r.xml deleted file mode 100644 index 93b51034..00000000 --- a/.idea/libraries/Maven__org_eclipse_jgit_org_eclipse_jgit_5_1_3_201810200350_r.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/xm-backend.iml b/.idea/xm-backend.iml index 8f05b870..6f2d6c42 100644 --- a/.idea/xm-backend.iml +++ b/.idea/xm-backend.iml @@ -191,7 +191,6 @@ - \ No newline at end of file diff --git a/xm-bootstrap/pom.xml b/xm-bootstrap/pom.xml index f5522db1..cc2ea7c1 100644 --- a/xm-bootstrap/pom.xml +++ b/xm-bootstrap/pom.xml @@ -16,22 +16,16 @@ mdp-cloud-starter ${mdp.version} + + com.mdp + mdp-oauth2-client-cloud + ${mdp.version} + com.xm xm-core - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - diff --git a/xm-bootstrap/src/main/java/com/xm/XmApplication.java b/xm-bootstrap/src/main/java/com/xm/XmApplication.java index 052e327a..93b10ac5 100644 --- a/xm-bootstrap/src/main/java/com/xm/XmApplication.java +++ b/xm-bootstrap/src/main/java/com/xm/XmApplication.java @@ -2,10 +2,13 @@ package com.xm; import org.springframework.boot.SpringApplication; import org.springframework.cloud.client.SpringCloudApplication; +import org.springframework.context.annotation.ComponentScan; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; +import org.springframework.stereotype.Component; @SpringCloudApplication @EnableRedisHttpSession +@ComponentScan(basePackages={"com.mdp"}) public class XmApplication { diff --git a/xm-bootstrap/src/main/resources/application-dev.properties b/xm-bootstrap/src/main/resources/application-dev.properties index 186e9111..33c546fb 100644 --- a/xm-bootstrap/src/main/resources/application-dev.properties +++ b/xm-bootstrap/src/main/resources/application-dev.properties @@ -2,7 +2,7 @@ spring.application.name=xm server.port=7067 -server.context-path=/${spring.application.name} +#server.context-path=/${spring.application.name} #session失效时间 秒 server.session.timeout=43200 spring.session.store-type=none @@ -13,7 +13,7 @@ spring.cloud.inetutils.preferredNetworks[1]=^172\. #eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port} #eureka.instance.prefer-ip-address=true -spring.cloud.consul.host=localhost +spring.cloud.consul.host=134.175.57.249 spring.cloud.consul.port=8500 @@ -42,6 +42,42 @@ mdp.arc.file-upload-root-path=E:/arc/files spring.http.multipart.maxFileSize=10Mb spring.http.multipart.maxRequestSize=10Mb + +# mdp平台授权验证服务器访问地址 cloud环境下换成 http://gate,本地调试如果不起验证服务器,可改为 https://www.qingqinkj.com/api/m1/oauth2/oauth2 +mdp.oauth2.server.uri=http://134.175.57.249:7000 +# 客户端必须在数据库表adm.oauth_client_details中配置,否则无法访问 + +# 下面配置 password 模式 +spring.security.oauth2.client.registration.password-client.provider=def-oauth-server +spring.security.oauth2.client.registration.password-client.client-id=${spring.application.name} +spring.security.oauth2.client.registration.password-client.client-secret= ${spring.application.name}-8888 +spring.security.oauth2.client.registration.password-client.authorization-grant-type= password +spring.security.oauth2.client.registration.password-client.scope= all + +# 下面配置 client_credentials 模式 +spring.security.oauth2.client.registration.def-client.provider=def-oauth-server +spring.security.oauth2.client.registration.def-client.client-id=${spring.application.name} +spring.security.oauth2.client.registration.def-client.client-secret= ${spring.application.name}-8888 +spring.security.oauth2.client.registration.def-client.authorization-grant-type= client_credentials +spring.security.oauth2.client.registration.def-client.scope= all + +# 下面配置authorization_code模式 +spring.security.oauth2.client.registration.code-client.provider=def-oauth-server +spring.security.oauth2.client.registration.code-client.client-id=${spring.application.name} +spring.security.oauth2.client.registration.code-client.client-secret= ${spring.application.name}-8888 +spring.security.oauth2.client.registration.code-client.authorization-grant-type= authorization_code +# 授权码模式下需要配置重定向地址 +spring.security.oauth2.client.registration.code-client.redirect-uri= ${messages.base-uri}/authorized +spring.security.oauth2.client.registration.code-client.scope= all + +# 授权码方式获取code +spring.security.oauth2.client.provider.def-oauth-server.authorization-uri= ${mdp.oauth2.server.uri}/oauth2/authorize +# 获取token接口 +spring.security.oauth2.client.provider.def-oauth-server.token-uri= ${mdp.oauth2.server.uri}/oauth2/token + +# 资源服务器 +spring.security.oauth2.resourceserver.jwt.jwk-set-uri= ${mdp.oauth2.server.uri}/oauth2/jwks + #配置数据源 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.jdbc-url=jdbc:mysql://123.207.117.5:3306/arc?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=CTT @@ -67,7 +103,7 @@ mdp.sms.app-secret=4b0659a2ee8ba4e54a570515fda94aef # Redis数据库索引(默认为0) spring.redis.database=0 # Redis服务器地址 -spring.redis.host=10.0.0.17 +spring.redis.host=134.175.57.249 # Redis服务器连接端口 spring.redis.port=6379 # Redis服务器连接密码(默认为空) diff --git a/xm-bootstrap/src/main/resources/application-m1prod.properties b/xm-bootstrap/src/main/resources/application-m1prod.properties index 1af80ebd..761e7ce0 100644 --- a/xm-bootstrap/src/main/resources/application-m1prod.properties +++ b/xm-bootstrap/src/main/resources/application-m1prod.properties @@ -2,7 +2,7 @@ spring.application.name=xm server.port=7067 -server.context-path=/${spring.application.name} +#server.context-path=/${spring.application.name} #session失效时间 秒 server.session.timeout=43200 spring.session.store-type=none @@ -13,7 +13,7 @@ spring.cloud.inetutils.preferredNetworks[1]=^172\. #eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port} #eureka.instance.prefer-ip-address=true -spring.cloud.consul.host=localhost +spring.cloud.consul.host=172.16.16.16 spring.cloud.consul.port=8500 @@ -48,6 +48,43 @@ mdp.platform-branch-id=platform-branch-001 spring.http.multipart.maxFileSize=10Mb spring.http.multipart.maxRequestSize=10Mb + + +# mdp平台授权验证服务器访问地址 cloud环境下换成 http://gate,本地调试如果不起验证服务器,可改为 https://www.qingqinkj.com/api/m1/oauth2/oauth2 +mdp.oauth2.server.uri=http://172.16.16.16:7000 +# 客户端必须在数据库表adm.oauth_client_details中配置,否则无法访问 + +# 下面配置 password 模式 +spring.security.oauth2.client.registration.password-client.provider=def-oauth-server +spring.security.oauth2.client.registration.password-client.client-id=${spring.application.name} +spring.security.oauth2.client.registration.password-client.client-secret= ${spring.application.name}-8888 +spring.security.oauth2.client.registration.password-client.authorization-grant-type= password +spring.security.oauth2.client.registration.password-client.scope= all + +# 下面配置 client_credentials 模式 +spring.security.oauth2.client.registration.def-client.provider=def-oauth-server +spring.security.oauth2.client.registration.def-client.client-id=${spring.application.name} +spring.security.oauth2.client.registration.def-client.client-secret= ${spring.application.name}-8888 +spring.security.oauth2.client.registration.def-client.authorization-grant-type= client_credentials +spring.security.oauth2.client.registration.def-client.scope= all + +# 下面配置authorization_code模式 +spring.security.oauth2.client.registration.code-client.provider=def-oauth-server +spring.security.oauth2.client.registration.code-client.client-id=${spring.application.name} +spring.security.oauth2.client.registration.code-client.client-secret= ${spring.application.name}-8888 +spring.security.oauth2.client.registration.code-client.authorization-grant-type= authorization_code +# 授权码模式下需要配置重定向地址 +spring.security.oauth2.client.registration.code-client.redirect-uri= ${messages.base-uri}/authorized +spring.security.oauth2.client.registration.code-client.scope= all + +# 授权码方式获取code +spring.security.oauth2.client.provider.def-oauth-server.authorization-uri= ${mdp.oauth2.server.uri}/oauth2/authorize +# 获取token接口 +spring.security.oauth2.client.provider.def-oauth-server.token-uri= ${mdp.oauth2.server.uri}/oauth2/token + +# 资源服务器 +spring.security.oauth2.resourceserver.jwt.jwk-set-uri= ${mdp.oauth2.server.uri}/oauth2/jwks + #配置数据源 #spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver #spring.datasource.jdbc-url=jdbc:oracle:thin:@193.112.138.144:1521:KEYUNSITDB diff --git a/xm-bootstrap/src/main/resources/mybatis/mybatis-config.xml b/xm-bootstrap/src/main/resources/mybatis/mybatis-config.xml deleted file mode 100644 index 8c92d0f5..00000000 --- a/xm-bootstrap/src/main/resources/mybatis/mybatis-config.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/xm-bootstrap/xm-bootstrap.iml b/xm-bootstrap/xm-bootstrap.iml index 5ddb71f4..94521c63 100644 --- a/xm-bootstrap/xm-bootstrap.iml +++ b/xm-bootstrap/xm-bootstrap.iml @@ -1,16 +1,21 @@ - - - - - - + + + + + + + + + + + @@ -19,13 +24,6 @@ - - - - - - - @@ -72,10 +70,11 @@ - - + + + @@ -103,16 +102,11 @@ - - - - - - - + + @@ -121,6 +115,15 @@ + + + + + + + + + @@ -278,7 +281,6 @@ - \ No newline at end of file diff --git a/xm-core/pom.xml b/xm-core/pom.xml index fef4ccd7..88cf7893 100644 --- a/xm-core/pom.xml +++ b/xm-core/pom.xml @@ -13,6 +13,12 @@ + + + com.mdp + mdp-oauth2-client + ${mdp.version} + net.coobird thumbnailator @@ -44,6 +50,11 @@ jsoup 1.11.3 + + com.alibaba + fastjson + 1.2.59 + diff --git a/xm-core/src/main/resources/application-dev.properties b/xm-core/src/main/resources/application-dev.properties index 26688003..08d53e8a 100644 --- a/xm-core/src/main/resources/application-dev.properties +++ b/xm-core/src/main/resources/application-dev.properties @@ -81,6 +81,43 @@ mdp.auth.qx-regist-url=/sys/sys/sys/qx/autoRegist mdp.audit.audit-log-url=/audit/audit/audit/base/operLog/add mdp.platform-branch-id=platform-branch-001 + + +# mdp平台授权验证服务器访问地址 cloud环境下换成 http://gate,本地调试如果不起验证服务器,可改为 https://www.qingqinkj.com/api/m1/oauth2/oauth2 +mdp.oauth2.server.uri=http://134.175.57.249:7000 +# 客户端必须在数据库表adm.oauth_client_details中配置,否则无法访问 + +# 下面配置 password 模式 +spring.security.oauth2.client.registration.password-client.provider=def-oauth-server +spring.security.oauth2.client.registration.password-client.client-id=${spring.application.name} +spring.security.oauth2.client.registration.password-client.client-secret= ${spring.application.name}-8888 +spring.security.oauth2.client.registration.password-client.authorization-grant-type= password +spring.security.oauth2.client.registration.password-client.scope= all + +# 下面配置 client_credentials 模式 +spring.security.oauth2.client.registration.def-client.provider=def-oauth-server +spring.security.oauth2.client.registration.def-client.client-id=${spring.application.name} +spring.security.oauth2.client.registration.def-client.client-secret= ${spring.application.name}-8888 +spring.security.oauth2.client.registration.def-client.authorization-grant-type= client_credentials +spring.security.oauth2.client.registration.def-client.scope= all + +# 下面配置authorization_code模式 +spring.security.oauth2.client.registration.code-client.provider=def-oauth-server +spring.security.oauth2.client.registration.code-client.client-id=${spring.application.name} +spring.security.oauth2.client.registration.code-client.client-secret= ${spring.application.name}-8888 +spring.security.oauth2.client.registration.code-client.authorization-grant-type= authorization_code +# 授权码模式下需要配置重定向地址 +spring.security.oauth2.client.registration.code-client.redirect-uri= ${messages.base-uri}/authorized +spring.security.oauth2.client.registration.code-client.scope= all + +# 授权码方式获取code +spring.security.oauth2.client.provider.def-oauth-server.authorization-uri= ${mdp.oauth2.server.uri}/oauth2/authorize +# 获取token接口 +spring.security.oauth2.client.provider.def-oauth-server.token-uri= ${mdp.oauth2.server.uri}/oauth2/token + +# 资源服务器 +spring.security.oauth2.resourceserver.jwt.jwk-set-uri= ${mdp.oauth2.server.uri}/oauth2/jwks + ##begin 商户相关配置###顶级商户########################################################### mdp.topMech.mechId=m1000 mdp.topMech.userid=m1000 diff --git a/xm-core/src/test/java/com/xm/XmApplication.java b/xm-core/src/test/java/com/xm/XmApplication.java index 31b89803..7c2fb0df 100644 --- a/xm-core/src/test/java/com/xm/XmApplication.java +++ b/xm-core/src/test/java/com/xm/XmApplication.java @@ -2,8 +2,9 @@ package com.xm; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; - +@ComponentScan(basePackages={"com.mdp"}) @SpringBootApplication @EnableRedisHttpSession public class XmApplication { diff --git a/xm-core/xm-core.iml b/xm-core/xm-core.iml index 32fa1600..adcd80e1 100644 --- a/xm-core/xm-core.iml +++ b/xm-core/xm-core.iml @@ -11,24 +11,6 @@ - - - - - - - - - - - - - - - - - - @@ -37,6 +19,7 @@ + @@ -74,6 +57,24 @@ + + + + + + + + + + + + + + + + + + @@ -194,7 +195,6 @@ - \ No newline at end of file