Skip to content

Commit

Permalink
📌 servicecomb3 and springboot3 #71
Browse files Browse the repository at this point in the history
  • Loading branch information
trydofor committed Dec 26, 2023
1 parent 2e50da8 commit fcba071
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<!-- sharding jdbc -->
<shardingsphere.version>5.4.1</shardingsphere.version> <!-- https://github.com/apache/shardingsphere/releases -->
<!-- servicecomb -->
<servicecomb.version>2.8.8</servicecomb.version> <!-- https://github.com/apache/servicecomb-java-chassis/releases -->
<servicecomb.version>3.0.0</servicecomb.version> <!-- https://github.com/apache/servicecomb-java-chassis/releases -->
<!-- others -->
<springdoc.version>2.3.0</springdoc.version> <!-- https://github.com/springdoc/springdoc-openapi/releases -->
<boot-admin.version>3.2.0</boot-admin.version> <!-- https://github.com/codecentric/spring-boot-admin/releases -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
package pro.fessional.wings.batrider.servcomb.handler;

import org.apache.servicecomb.authentication.provider.ProviderAuthHanlder;
import org.apache.servicecomb.authentication.provider.ProviderAuthFilter;
import org.apache.servicecomb.core.Invocation;
import org.apache.servicecomb.swagger.invocation.AsyncResponse;
import org.apache.servicecomb.core.filter.FilterNode;
import org.apache.servicecomb.swagger.invocation.Response;
import pro.fessional.mirana.func.Dcl;
import pro.fessional.wings.batrider.spring.prop.BatriderHandlerProp;
import pro.fessional.wings.silencer.spring.help.ApplicationContextHelper;

import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CompletableFuture;

/**
* @author trydofor
* @since 2022-08-07
*/
public class ProviderAuth9Handler extends ProviderAuthHanlder {
public class ProviderAuth9Handler extends ProviderAuthFilter {

private final Dcl<Set<String>> skipSchemaId = Dcl.of(() -> {
final BatriderHandlerProp prop = ApplicationContextHelper.getBean(BatriderHandlerProp.class);
return new HashSet<>(prop.getAuthSkipSchema());
});

@Override
public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {
public CompletableFuture<Response> onFilter(Invocation invocation, FilterNode nextNode) {
if (skipSchemaId.runIfDirty().contains(invocation.getSchemaId())) {
invocation.next(asyncResp);
return nextNode.onFilter(invocation);
}
else {
super.handle(invocation, asyncResp);
return super.onFilter(invocation, nextNode);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package pro.fessional.wings.batrider.spring.bean;

import org.apache.servicecomb.springboot2.starter.EnableServiceComb;

import org.springframework.context.annotation.Configuration;
import pro.fessional.wings.silencer.spring.boot.ConditionalWingsEnabled;

Expand All @@ -10,6 +10,5 @@
*/
@Configuration(proxyBeanMethods = false)
@ConditionalWingsEnabled
@EnableServiceComb
public class BatriderServcombConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dataSources:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
# driverClassName: org.h2.Driver
# jdbcUrl: jdbc:h2:~/wings_shard_0;USER=trydofor;PASSWORD=moilioncircle;MODE=MySQL;CASE_INSENSITIVE_IDENTIFIERS=TRUE;AUTO_RECONNECT=TRUE;AUTO_SERVER=TRUE
driverClassName: com.mysql.jdbc.Driver
driverClassName: com.mysql.cj.jdbc.Driver
jdbcUrl: jdbc:mysql://localhost:3306/wings_shard_0
username: trydofor
password: moilioncircle
Expand All @@ -25,7 +25,7 @@ dataSources:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
# driverClassName: org.h2.Driver
# jdbcUrl: jdbc:h2:~/wings_shard_1;USER=trydofor;PASSWORD=moilioncircle;MODE=MySQL;CASE_INSENSITIVE_IDENTIFIERS=TRUE;AUTO_RECONNECT=TRUE;AUTO_SERVER=TRUE
driverClassName: com.mysql.jdbc.Driver
driverClassName: com.mysql.cj.jdbc.Driver
jdbcUrl: jdbc:mysql://localhost:3306/wings_shard_1
username: trydofor
password: moilioncircle
Expand Down
4 changes: 4 additions & 0 deletions wings/testing-database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down

0 comments on commit fcba071

Please sign in to comment.