ClientRegistrations#rest defines 30s connect and read timeouts

This commit is contained in:
Daniel Garnier-Moiroux 2022-05-16 14:52:10 +02:00 committed by Steve Riesenberg
parent 70eea8dc67
commit bea7761a1c
No known key found for this signature in database
GPG Key ID: 5F311AB48A55D521
1 changed files with 8 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import net.minidev.json.JSONObject;
import org.springframework.core.ParameterizedTypeReference; import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.RequestEntity; import org.springframework.http.RequestEntity;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.security.oauth2.core.AuthorizationGrantType; import org.springframework.security.oauth2.core.AuthorizationGrantType;
import org.springframework.security.oauth2.core.ClientAuthenticationMethod; import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
import org.springframework.security.oauth2.core.oidc.IdTokenClaimNames; import org.springframework.security.oauth2.core.oidc.IdTokenClaimNames;
@ -58,6 +59,13 @@ public final class ClientRegistrations {
private static final RestTemplate rest = new RestTemplate(); private static final RestTemplate rest = new RestTemplate();
static {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(30_000);
requestFactory.setReadTimeout(30_000);
rest.setRequestFactory(requestFactory);
}
private static final ParameterizedTypeReference<Map<String, Object>> typeReference = new ParameterizedTypeReference<Map<String, Object>>() { private static final ParameterizedTypeReference<Map<String, Object>> typeReference = new ParameterizedTypeReference<Map<String, Object>>() {
}; };