Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #13 from admin-ch/feature/web-client-fix
Browse files Browse the repository at this point in the history
enable web client to handle larger responses
  • Loading branch information
ubhaller authored Jul 22, 2021
2 parents e5115e2 + d29b93b commit 8289bad
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
import org.springframework.security.oauth2.client.InMemoryOAuth2AuthorizedClientService;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction;
import org.springframework.web.reactive.function.client.ExchangeStrategies;
import org.springframework.web.reactive.function.client.WebClient;

public class BitClientOauthImpl implements BitClient {

private final String lightCertificateEndpoint;
private final ObjectMapper objectMapper;
private final WebClient webClient;
Expand All @@ -32,7 +34,19 @@ public BitClientOauthImpl(
new InMemoryOAuth2AuthorizedClientService(clientRegistrations));
var oauth = new ServletOAuth2AuthorizedClientExchangeFilterFunction(clientRepository);
oauth.setDefaultClientRegistrationId(clientId);
this.webClient = WebClient.builder().filter(oauth).build();
this.webClient =
WebClient.builder()
.filter(oauth)
.exchangeStrategies(
ExchangeStrategies.builder()
.codecs(
configurer ->
configurer
.defaultCodecs()
.maxInMemorySize(
20 * 1024 * 1024)) // 20MB
.build())
.build();
}

@Override
Expand Down

0 comments on commit 8289bad

Please sign in to comment.