|
15 | 15 | import org.springframework.context.ApplicationContext;
|
16 | 16 | import org.springframework.context.annotation.Bean;
|
17 | 17 | import org.springframework.context.annotation.Configuration;
|
| 18 | +import org.springframework.core.annotation.Order; |
18 | 19 | import org.springframework.http.CacheControl;
|
19 | 20 | import org.springframework.http.HttpMethod;
|
20 | 21 | import org.springframework.http.MediaType;
|
|
40 | 41 | import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
41 | 42 | import run.halo.app.core.extension.endpoint.CustomEndpointsBuilder;
|
42 | 43 | import run.halo.app.infra.properties.HaloProperties;
|
| 44 | +import run.halo.app.plugin.extensionpoint.ExtensionGetter; |
| 45 | +import run.halo.app.webfilter.AdditionalWebFilterChainProxy; |
43 | 46 |
|
44 | 47 | @Configuration
|
45 | 48 | public class WebFluxConfig implements WebFluxConfigurer {
|
@@ -200,4 +203,23 @@ ProxyFilter consoleProxyFilter() {
|
200 | 203 | ProxyFilter ucProxyFilter() {
|
201 | 204 | return new ProxyFilter("/uc/**", haloProp.getUc().getProxy());
|
202 | 205 | }
|
| 206 | + |
| 207 | + /** |
| 208 | + * Create a WebFilterChainProxy for all AdditionalWebFilters. |
| 209 | + * |
| 210 | + * <p>The reason why the order is -101 is that the current |
| 211 | + * AdditionalWebFilterChainProxy should be executed before WebFilterChainProxy |
| 212 | + * and the order of WebFilterChainProxy is -100. |
| 213 | + * |
| 214 | + * <p>See {@code org.springframework.security.config.annotation.web.reactive |
| 215 | + * .WebFluxSecurityConfiguration#WEB_FILTER_CHAIN_FILTER_ORDER} for more |
| 216 | + * |
| 217 | + * @param extensionGetter extension getter. |
| 218 | + * @return additional web filter chain proxy. |
| 219 | + */ |
| 220 | + @Bean |
| 221 | + @Order(-101) |
| 222 | + AdditionalWebFilterChainProxy additionalWebFilterChainProxy(ExtensionGetter extensionGetter) { |
| 223 | + return new AdditionalWebFilterChainProxy(extensionGetter); |
| 224 | + } |
203 | 225 | }
|
0 commit comments