File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
tokens/src/main/java/io/scalecube/security/tokens/jwt Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,10 @@ private JwksKeyLocator(Builder builder) {
4545 this .connectTimeout = Objects .requireNonNull (builder .connectTimeout , "connectTimeout" );
4646 this .requestTimeout = Objects .requireNonNull (builder .requestTimeout , "requestTimeout" );
4747 this .keyTtl = builder .keyTtl ;
48- this .httpClient = HttpClient .newBuilder ().connectTimeout (connectTimeout ).build ();
48+ this .httpClient =
49+ builder .httpClient != null
50+ ? builder .httpClient
51+ : HttpClient .newBuilder ().connectTimeout (connectTimeout ).build ();
4952 }
5053
5154 public static Builder builder () {
@@ -160,6 +163,7 @@ public static class Builder {
160163 private Duration connectTimeout = Duration .ofSeconds (10 );
161164 private Duration requestTimeout = Duration .ofSeconds (10 );
162165 private int keyTtl = 60 * 1000 ;
166+ private HttpClient httpClient ;
163167
164168 private Builder () {}
165169
@@ -211,6 +215,17 @@ public Builder keyTtl(int keyTtl) {
211215 return this ;
212216 }
213217
218+ /**
219+ * Setter for optional {@link HttpClient}.
220+ *
221+ * @param httpClient httpClient
222+ * @return this
223+ */
224+ public Builder httpClient (HttpClient httpClient ) {
225+ this .httpClient = httpClient ;
226+ return this ;
227+ }
228+
214229 public JwksKeyLocator build () {
215230 return new JwksKeyLocator (this );
216231 }
You can’t perform that action at this time.
0 commit comments