Add Default Timeout to JwtDecoders RestTemplate
Closes gh-14269
This commit is contained in:
parent
a4dbf458ab
commit
24fd19b107
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -39,6 +39,7 @@ import com.nimbusds.jwt.proc.ConfigurableJWTProcessor;
|
|||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.security.oauth2.jose.jws.SignatureAlgorithm;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
@ -65,6 +66,15 @@ final class JwtDecoderProviderConfigurationUtils {
|
|||
|
||||
private static final RestTemplate rest = new RestTemplate();
|
||||
|
||||
static {
|
||||
int connectTimeout = Integer.parseInt(System.getProperty("sun.net.client.defaultConnectTimeout", "30000"));
|
||||
int readTimeout = Integer.parseInt(System.getProperty("sun.net.client.defaultReadTimeout", "30000"));
|
||||
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
|
||||
requestFactory.setConnectTimeout(connectTimeout);
|
||||
requestFactory.setReadTimeout(readTimeout);
|
||||
rest.setRequestFactory(requestFactory);
|
||||
}
|
||||
|
||||
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue