From fbf5301645f05052dec7bb2caa633e30b2c94e8e Mon Sep 17 00:00:00 2001 From: Martin Bogusz Date: Fri, 3 Nov 2023 12:35:58 +0100 Subject: [PATCH] formatting --- .../authentication/JwtClientAssertionDecoderFactory.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/JwtClientAssertionDecoderFactory.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/JwtClientAssertionDecoderFactory.java index f0362ba8b..bb57bcbb8 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/JwtClientAssertionDecoderFactory.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/JwtClientAssertionDecoderFactory.java @@ -88,13 +88,16 @@ public final class JwtClientAssertionDecoderFactory implements JwtDecoderFactory mappings.put(MacAlgorithm.HS512, "HmacSHA512"); JCA_ALGORITHM_MAPPINGS = Collections.unmodifiableMap(mappings); } + private static final RestTemplate rest = new RestTemplate(); + static { SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setConnectTimeout(15_000); requestFactory.setReadTimeout(15_000); rest.setRequestFactory(requestFactory); } + private final Map jwtDecoders = new ConcurrentHashMap<>(); private Function> jwtValidatorFactory = DEFAULT_JWT_VALIDATOR_FACTORY; @@ -132,7 +135,8 @@ private static NimbusJwtDecoder buildDecoder(RegisteredClient registeredClient) JWT_CLIENT_AUTHENTICATION_ERROR_URI); throw new OAuth2AuthenticationException(oauth2Error); } - return NimbusJwtDecoder.withJwkSetUri(jwkSetUrl).jwsAlgorithm((SignatureAlgorithm) jwsAlgorithm).restOperations(rest).build(); + return NimbusJwtDecoder.withJwkSetUri(jwkSetUrl).jwsAlgorithm((SignatureAlgorithm) jwsAlgorithm) + .restOperations(rest).build(); } if (jwsAlgorithm instanceof MacAlgorithm) { String clientSecret = registeredClient.getClientSecret();