You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by sa...@apache.org on 2021/09/10 03:39:10 UTC
[incubator-shenyu] branch master updated: [type: refactor] refactor
sign api (#2050)
This is an automated email from the ASF dual-hosted git repository.
sabersola pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 0fa2789 [type: refactor] refactor sign api (#2050)
0fa2789 is described below
commit 0fa278926129e1ece4ffb692cac0e83163bfbc93
Author: xiaoyu <xi...@apache.org>
AuthorDate: Fri Sep 10 11:39:06 2021 +0800
[type: refactor] refactor sign api (#2050)
* refactor sign api
* modify admin dist
---
.../shenyu-admin-dist/src/main/assembly/binary.xml | 8 +-
.../src/main/resources/application-h2.yml | 28 -----
.../src/main/resources/application.yml | 118 ---------------------
.../src/main/resources/application.yml | 2 +
.../src/main/resources/spring-dubbo.xml | 2 +-
.../org/apache/shenyu/plugin/sign/SignPlugin.java | 2 +-
.../plugin/sign/api}/DefaultSignProvider.java | 2 +-
.../plugin/sign/api}/ShenyuSignProviderWrap.java | 2 +-
.../shenyu/plugin/sign/api}/SignProvider.java | 2 +-
.../shenyu/plugin/sign/api}/SignService.java | 2 +-
.../plugin/sign/service/DefaultSignService.java | 4 +-
.../apache/shenyu/plugin/sign/SignPluginTest.java | 2 +-
.../sign/service/DefaultSignServiceTest.java | 6 +-
.../plugin/sign/sign/DefaultSignProviderTest.java | 6 +-
.../plugin/sign/SignPluginConfiguration.java | 8 +-
.../plugin/sign/SignPluginConfigurationTest.java | 2 +-
16 files changed, 29 insertions(+), 167 deletions(-)
diff --git a/shenyu-dist/shenyu-admin-dist/src/main/assembly/binary.xml b/shenyu-dist/shenyu-admin-dist/src/main/assembly/binary.xml
index 12b4e51..d7ff799 100644
--- a/shenyu-dist/shenyu-admin-dist/src/main/assembly/binary.xml
+++ b/shenyu-dist/shenyu-admin-dist/src/main/assembly/binary.xml
@@ -31,12 +31,18 @@
<directory>src/main/resources</directory>
<lineEnding>unix</lineEnding>
<includes>
- <include>*.yml</include>
<include>*.xml</include>
</includes>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
+ <directory>${project.basedir}/../../shenyu-admin/src/main/resources</directory>
+ <includes>
+ <include>*.yml</include>
+ </includes>
+ <outputDirectory>conf</outputDirectory>
+ </fileSet>
+ <fileSet>
<directory>src/main/resources/bin</directory>
<lineEnding>unix</lineEnding>
<includes>
diff --git a/shenyu-dist/shenyu-admin-dist/src/main/resources/application-h2.yml b/shenyu-dist/shenyu-admin-dist/src/main/resources/application-h2.yml
deleted file mode 100644
index be77f69..0000000
--- a/shenyu-dist/shenyu-admin-dist/src/main/resources/application-h2.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-
-shenyu:
- database:
- dialect: h2
- init_script: "META-INF/schema.sql"
- init_enable: true
-
-spring:
- datasource:
- url: jdbc:h2:mem:~/shenyu;DB_CLOSE_DELAY=-1;MODE=MySQL;
- username: sa
- password: sa
- driver-class-name: org.h2.Driver
-
diff --git a/shenyu-dist/shenyu-admin-dist/src/main/resources/application.yml b/shenyu-dist/shenyu-admin-dist/src/main/resources/application.yml
deleted file mode 100644
index fbdaa74..0000000
--- a/shenyu-dist/shenyu-admin-dist/src/main/resources/application.yml
+++ /dev/null
@@ -1,118 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-
-server:
- port: 9095
- address: 0.0.0.0
-
-spring:
- profiles:
- active: h2
- thymeleaf:
- cache: true
- encoding: utf-8
- enabled: true
- prefix: classpath:/static/
- suffix: .html
- datasource:
- url: jdbc:mysql://localhost:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
- username: root
- password:
- driver-class-name: com.mysql.jdbc.Driver
-
-mybatis:
- config-location: classpath:/mybatis/mybatis-config.xml
- mapper-locations: classpath:/mappers/*.xml
-
-shenyu:
- register:
- registerType: http #http #zookeeper #etcd #nacos #consul
- serverLists: #localhost:2181 #http://localhost:2379 #localhost:8848
- props:
- sessionTimeout: 5000
- connectionTimeout: 2000
- checked: true
- zombieCheckTimes: 5
- scheduledTime: 10
- nacosNameSpace: ShenyuRegisterCenter
- database:
- dialect: mysql
- init_script: "META-INF/schema.sql"
- init_enable: true
- sync:
- websocket:
- enabled: true
-# zookeeper:
-# url: localhost:2181
-# sessionTimeout: 5000
-# connectionTimeout: 2000
-# http:
-# enabled: true
-# nacos:
-# url: localhost:8848
-# namespace: 1c10d748-af86-43b9-8265-75f487d20c6c
-# username:
-# password:
-# acm:
-# enabled: false
-# endpoint: acm.aliyun.com
-# namespace:
-# accessKey:
-# secretKey:
-# etcd:
-# url: http://localhost:2379
- aes:
- secret:
- key: 2095132720951327
- iv: 6075877187097700
- ldap:
- enabled: false
- url: ldap://xxxx:xxx
- bind-dn: cn=xxx,dc=xxx,dc=xxx
- password: xxxx
- base-dn: ou=xxx,dc=xxx,dc=xxx
- object-class: person
- login-field: cn
- jwt:
- key: 2095132720951327
- shiro:
- white-list:
- - /
- - /favicon.*
- - /static/**
- - /index**
- - /plugin
- - /platform/**
- - /websocket
- - /configs/**
- - /shenyu-client/**
- - /error
- - /actuator/health
- - /swagger-ui.html
- - /webjars/**
- - /swagger-resources/**
- - /v2/api-docs
- - /csrf
- swagger:
- enable: true
-
-logging:
- level:
- root: info
- org.springframework.boot: info
- org.apache.ibatis: info
- org.apache.shenyu.bonuspoint: info
- org.apache.shenyu.lottery: info
- org.apache.shenyu: info
diff --git a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/application.yml b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/application.yml
index d638488..ebc630d 100644
--- a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/application.yml
+++ b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/application.yml
@@ -21,6 +21,8 @@ server:
spring:
main:
allow-bean-definition-overriding: true
+dubbo:
+ zk: zookeeper://localhost:2181
shenyu:
client:
registerType: http #zookeeper #etcd #nacos #consul
diff --git a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/spring-dubbo.xml b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/spring-dubbo.xml
index 269b894..8d4845e 100644
--- a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/spring-dubbo.xml
+++ b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/spring-dubbo.xml
@@ -26,7 +26,7 @@
<dubbo:application name="test-dubbo-service"/>
- <dubbo:registry address="zookeeper://localhost:2181"/>
+ <dubbo:registry address="${dubbo.zk}"/>
<dubbo:protocol name="dubbo" port="20888"/>
diff --git a/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/SignPlugin.java b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/SignPlugin.java
index 756b085..c10296d 100644
--- a/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/SignPlugin.java
+++ b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/SignPlugin.java
@@ -26,7 +26,7 @@ import org.apache.shenyu.plugin.api.result.ShenyuResultWrap;
import org.apache.shenyu.plugin.api.ShenyuPluginChain;
import org.apache.shenyu.plugin.base.AbstractShenyuPlugin;
import org.apache.shenyu.plugin.api.utils.WebFluxResultUtils;
-import org.apache.shenyu.plugin.api.sign.SignService;
+import org.apache.shenyu.plugin.sign.api.SignService;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
diff --git a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/DefaultSignProvider.java b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/DefaultSignProvider.java
similarity index 96%
rename from shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/DefaultSignProvider.java
rename to shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/DefaultSignProvider.java
index 6a88e73..463d307 100644
--- a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/DefaultSignProvider.java
+++ b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/DefaultSignProvider.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shenyu.plugin.api.sign;
+package org.apache.shenyu.plugin.sign.api;
import org.apache.shenyu.common.utils.SignUtils;
diff --git a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/ShenyuSignProviderWrap.java b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/ShenyuSignProviderWrap.java
similarity index 97%
rename from shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/ShenyuSignProviderWrap.java
rename to shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/ShenyuSignProviderWrap.java
index 89453c5..d4bbddb 100644
--- a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/ShenyuSignProviderWrap.java
+++ b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/ShenyuSignProviderWrap.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shenyu.plugin.api.sign;
+package org.apache.shenyu.plugin.sign.api;
import org.apache.shenyu.plugin.api.utils.SpringBeanUtils;
diff --git a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/SignProvider.java b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/SignProvider.java
similarity index 96%
rename from shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/SignProvider.java
rename to shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/SignProvider.java
index aceae3b..c67a534 100644
--- a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/SignProvider.java
+++ b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/SignProvider.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shenyu.plugin.api.sign;
+package org.apache.shenyu.plugin.sign.api;
import java.util.Map;
diff --git a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/SignService.java b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/SignService.java
similarity index 96%
rename from shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/SignService.java
rename to shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/SignService.java
index d8e277d..d75d382 100644
--- a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/sign/SignService.java
+++ b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/api/SignService.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shenyu.plugin.api.sign;
+package org.apache.shenyu.plugin.sign.api;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.web.server.ServerWebExchange;
diff --git a/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/service/DefaultSignService.java b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/service/DefaultSignService.java
index fa960c9..e6ec574 100644
--- a/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/service/DefaultSignService.java
+++ b/shenyu-plugin/shenyu-plugin-sign/src/main/java/org/apache/shenyu/plugin/sign/service/DefaultSignService.java
@@ -31,8 +31,8 @@ import org.apache.shenyu.common.utils.DateUtils;
import org.apache.shenyu.common.utils.PathMatchUtils;
import org.apache.shenyu.plugin.api.context.ShenyuContext;
import org.apache.shenyu.plugin.api.result.ShenyuResultEnum;
-import org.apache.shenyu.plugin.api.sign.ShenyuSignProviderWrap;
-import org.apache.shenyu.plugin.api.sign.SignService;
+import org.apache.shenyu.plugin.sign.api.ShenyuSignProviderWrap;
+import org.apache.shenyu.plugin.sign.api.SignService;
import org.apache.shenyu.plugin.base.cache.BaseDataCache;
import org.apache.shenyu.plugin.sign.cache.SignAuthDataCache;
import org.slf4j.Logger;
diff --git a/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/SignPluginTest.java b/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/SignPluginTest.java
index 3549360..00ac55d 100644
--- a/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/SignPluginTest.java
+++ b/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/SignPluginTest.java
@@ -20,7 +20,7 @@ package org.apache.shenyu.plugin.sign;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.shenyu.common.dto.RuleData;
import org.apache.shenyu.common.dto.SelectorData;
-import org.apache.shenyu.plugin.api.sign.SignService;
+import org.apache.shenyu.plugin.sign.api.SignService;
import org.apache.shenyu.plugin.api.ShenyuPluginChain;
import org.junit.Before;
diff --git a/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/service/DefaultSignServiceTest.java b/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/service/DefaultSignServiceTest.java
index 7ddea88..562c213 100644
--- a/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/service/DefaultSignServiceTest.java
+++ b/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/service/DefaultSignServiceTest.java
@@ -26,11 +26,11 @@ import org.apache.shenyu.common.dto.AuthPathData;
import org.apache.shenyu.common.dto.PluginData;
import org.apache.shenyu.common.enums.PluginEnum;
import org.apache.shenyu.common.utils.SignUtils;
-import org.apache.shenyu.plugin.api.sign.DefaultSignProvider;
-import org.apache.shenyu.plugin.api.sign.SignService;
+import org.apache.shenyu.plugin.sign.api.DefaultSignProvider;
+import org.apache.shenyu.plugin.sign.api.SignService;
import org.apache.shenyu.plugin.api.context.ShenyuContext;
import org.apache.shenyu.plugin.api.result.ShenyuResultEnum;
-import org.apache.shenyu.plugin.api.sign.SignProvider;
+import org.apache.shenyu.plugin.sign.api.SignProvider;
import org.apache.shenyu.plugin.api.utils.SpringBeanUtils;
import org.apache.shenyu.plugin.base.cache.BaseDataCache;
import org.apache.shenyu.plugin.sign.cache.SignAuthDataCache;
diff --git a/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/sign/DefaultSignProviderTest.java b/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/sign/DefaultSignProviderTest.java
index 7f5d6f7..3585a59 100644
--- a/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/sign/DefaultSignProviderTest.java
+++ b/shenyu-plugin/shenyu-plugin-sign/src/test/java/org/apache/shenyu/plugin/sign/sign/DefaultSignProviderTest.java
@@ -17,9 +17,9 @@
package org.apache.shenyu.plugin.sign.sign;
-import org.apache.shenyu.plugin.api.sign.DefaultSignProvider;
-import org.apache.shenyu.plugin.api.sign.ShenyuSignProviderWrap;
-import org.apache.shenyu.plugin.api.sign.SignProvider;
+import org.apache.shenyu.plugin.sign.api.DefaultSignProvider;
+import org.apache.shenyu.plugin.sign.api.ShenyuSignProviderWrap;
+import org.apache.shenyu.plugin.sign.api.SignProvider;
import org.apache.shenyu.plugin.api.utils.SpringBeanUtils;
import org.junit.Before;
import org.junit.Test;
diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sign/src/main/java/org/apache/shenyu/springboot/starter/plugin/sign/SignPluginConfiguration.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sign/src/main/java/org/apache/shenyu/springboot/starter/plugin/sign/SignPluginConfiguration.java
index 80179e8..c6d9665 100644
--- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sign/src/main/java/org/apache/shenyu/springboot/starter/plugin/sign/SignPluginConfiguration.java
+++ b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sign/src/main/java/org/apache/shenyu/springboot/starter/plugin/sign/SignPluginConfiguration.java
@@ -17,10 +17,10 @@
package org.apache.shenyu.springboot.starter.plugin.sign;
-import org.apache.shenyu.plugin.api.sign.DefaultSignProvider;
-import org.apache.shenyu.plugin.api.sign.SignService;
+import org.apache.shenyu.plugin.sign.api.DefaultSignProvider;
+import org.apache.shenyu.plugin.sign.api.SignService;
import org.apache.shenyu.plugin.api.ShenyuPlugin;
-import org.apache.shenyu.plugin.api.sign.SignProvider;
+import org.apache.shenyu.plugin.sign.api.SignProvider;
import org.apache.shenyu.plugin.sign.SignPlugin;
import org.apache.shenyu.plugin.sign.service.DefaultSignService;
import org.apache.shenyu.plugin.sign.subscriber.SignAuthDataSubscriber;
@@ -54,7 +54,7 @@ public class SignPluginConfiguration {
*/
@Bean
@ConditionalOnMissingBean(value = SignProvider.class, search = SearchStrategy.ALL)
- public SignProvider signer() {
+ public SignProvider signProvider() {
return new DefaultSignProvider();
}
diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sign/src/test/java/org/apache/shenyu/springboot/starter/plugin/sign/SignPluginConfigurationTest.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sign/src/test/java/org/apache/shenyu/springboot/starter/plugin/sign/SignPluginConfigurationTest.java
index 374c1ad..0c47488 100644
--- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sign/src/test/java/org/apache/shenyu/springboot/starter/plugin/sign/SignPluginConfigurationTest.java
+++ b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sign/src/test/java/org/apache/shenyu/springboot/starter/plugin/sign/SignPluginConfigurationTest.java
@@ -18,7 +18,7 @@
package org.apache.shenyu.springboot.starter.plugin.sign;
import org.apache.shenyu.common.enums.PluginEnum;
-import org.apache.shenyu.plugin.api.sign.SignService;
+import org.apache.shenyu.plugin.sign.api.SignService;
import org.apache.shenyu.plugin.api.ShenyuPlugin;
import org.apache.shenyu.sync.data.api.AuthDataSubscriber;
import org.junit.Test;