Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Align NimbusJwtDecoder HTTP timeout defaults with Nimbus by setting to 500ms #17669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
jzheaux merged 1 commit into spring-projects:main from frido37:main
Sep 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.security.oauth2.core.OAuth2Error;
import org.springframework.security.oauth2.core.OAuth2TokenValidator;
import org.springframework.security.oauth2.core.OAuth2TokenValidatorResult;
Expand Down Expand Up @@ -293,7 +294,7 @@ public static final class JwkSetUriJwtDecoderBuilder {

private final Set<SignatureAlgorithm> signatureAlgorithms = new HashSet<>();

private RestOperations restOperations = new RestTemplate();
private RestOperations restOperations = new RestTemplateWithNimbusDefaultTimeouts();

private Cache cache = new NoOpCache("default");

Expand Down Expand Up @@ -545,6 +546,21 @@ public void close() {

}

/**
* A RestTemplate with timeouts configured to avoid blocking indefinitely when
* fetching JWK Sets while holding the reentrantLock.
*/
private static final class RestTemplateWithNimbusDefaultTimeouts extends RestTemplate {

private RestTemplateWithNimbusDefaultTimeouts() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(JWKSourceBuilder.DEFAULT_HTTP_CONNECT_TIMEOUT);
requestFactory.setReadTimeout(JWKSourceBuilder.DEFAULT_HTTP_READ_TIMEOUT);
setRequestFactory(requestFactory);
}

}

/**
* A builder for creating {@link NimbusJwtDecoder} instances based on a public key.
*/
Expand Down

AltStyle によって変換されたページ (->オリジナル) /