|
49 | 49 | import org.springframework.security.oauth2.jwt.ReactiveJwtDecoderFactory;
|
50 | 50 | import org.springframework.util.Assert;
|
51 | 51 | import org.springframework.util.StringUtils;
|
| 52 | +import org.springframework.web.reactive.function.client.WebClient; |
52 | 53 |
|
53 | 54 | /**
|
54 | 55 | * A {@link ReactiveJwtDecoderFactory factory} that provides a {@link ReactiveJwtDecoder}
|
@@ -89,6 +90,7 @@ public final class ReactiveOidcIdTokenDecoderFactory implements ReactiveJwtDecod
|
89 | 90 | private Function<ClientRegistration, Converter<Map<String, Object>, Map<String, Object>>> claimTypeConverterFactory = (
|
90 | 91 | clientRegistration) -> DEFAULT_CLAIM_TYPE_CONVERTER;
|
91 | 92 |
|
| 93 | + private WebClient webClient = WebClient.create(); |
92 | 94 | /**
|
93 | 95 | * Returns the default {@link Converter}'s used for type conversion of claim values
|
94 | 96 | * for an {@link OidcIdToken}.
|
@@ -164,6 +166,7 @@ private NimbusReactiveJwtDecoder buildDecoder(ClientRegistration clientRegistrat
|
164 | 166 | throw new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString());
|
165 | 167 | }
|
166 | 168 | return NimbusReactiveJwtDecoder.withJwkSetUri(jwkSetUri).jwsAlgorithm((SignatureAlgorithm) jwsAlgorithm)
|
| 169 | + .webClient(webClient) |
167 | 170 | .build();
|
168 | 171 | }
|
169 | 172 | if (jwsAlgorithm != null && MacAlgorithm.class.isAssignableFrom(jwsAlgorithm.getClass())) {
|
@@ -239,4 +242,15 @@ public void setClaimTypeConverterFactory(
|
239 | 242 | this.claimTypeConverterFactory = claimTypeConverterFactory;
|
240 | 243 | }
|
241 | 244 |
|
| 245 | + /** |
| 246 | + * Sets the custom web client that will be used in {@link NimbusReactiveJwtDecoder}. |
| 247 | + * The default webClient is created by {@code WebClient.create()}. |
| 248 | + * This is optional method if we need to set custom web client in {@link NimbusReactiveJwtDecoder}. |
| 249 | + * |
| 250 | + * @param webClient webclient |
| 251 | + */ |
| 252 | + public void setWebClient(WebClient webClient) { |
| 253 | + this.webClient = webClient; |
| 254 | + } |
| 255 | + |
242 | 256 | }
|
0 commit comments