Skip to content

Commit

Permalink
upgrade spring boot with http headers workaround
Browse files Browse the repository at this point in the history
Signed-off-by: ac892247 <a.chmelo@gmail.com>
  • Loading branch information
achmelo committed Nov 6, 2024
1 parent defe1dc commit c864d4d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseCookie;
import org.springframework.http.server.reactive.ServerHttpRequestDecorator;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.security.config.annotation.method.configuration.EnableReactiveMethodSecurity;
import org.springframework.security.config.web.server.SecurityWebFiltersOrder;
Expand All @@ -53,6 +54,7 @@
import org.springframework.security.web.server.util.matcher.PathPatternParserServerWebExchangeMatcher;
import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatchers;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.zowe.apiml.gateway.config.oidc.ClientConfiguration;
import org.zowe.apiml.gateway.controllers.GatewayExceptionHandler;
import org.zowe.apiml.gateway.filters.security.BasicAuthFilter;
Expand Down Expand Up @@ -465,4 +467,24 @@ public Mono<OAuth2AuthorizationRequest> removeAuthorizationRequest(ServerWebExch

}

@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
WebFilter writeableHeaders() {
return (exchange, chain) -> {
HttpHeaders writeableHeaders = HttpHeaders.writableHttpHeaders(
exchange.getRequest().getHeaders());
ServerHttpRequestDecorator writeableRequest = new ServerHttpRequestDecorator(
exchange.getRequest()) {
@Override
public HttpHeaders getHeaders() {
return writeableHeaders;
}
};
ServerWebExchange writeableExchange = exchange.mutate()
.request(writeableRequest)
.build();
return chain.filter(writeableExchange);
};
}

}
2 changes: 1 addition & 1 deletion gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencyResolutionManagement {
version('projectNode', '20.14.0')
version('projectNpm', '10.7.0')

version('springBoot', '3.3.4')
version('springBoot', '3.3.5')
version('springBootGraphQl', '3.3.4')
version('springCloudNetflix', '4.1.3')
version('springCloudCommons', '4.1.4')
Expand Down

0 comments on commit c864d4d

Please sign in to comment.