-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
15 additions
and
10 deletions.
There are no files selected for viewing
14 changes: 8 additions & 6 deletions
14
...der/src/main/java/pro/fessional/wings/batrider/servcomb/handler/ProviderAuth9Handler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters