Skip to content

Commit

Permalink
feat: remove cache http client
Browse files Browse the repository at this point in the history
(cherry picked from commit 2ba3359)
  • Loading branch information
1nb0und committed Jan 10, 2024
1 parent 06523a3 commit 560be7b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package io.camunda.common.auth;

import io.camunda.common.exception.SdkException;
import io.camunda.common.json.JsonMapper;
import io.camunda.common.json.SdkObjectMapper;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.io.entity.StringEntity;
import org.slf4j.Logger;
Expand Down Expand Up @@ -53,7 +52,7 @@ public void resetToken(Product product) {
}

private String retrieveToken(Product product, JwtCredential jwtCredential) {
try(CloseableHttpClient client = HttpClient.getInstance()){
try(CloseableHttpClient client = HttpClients.createDefault()){
HttpPost request = buildRequest(jwtCredential);
TokenResponse tokenResponse = client.execute(request, response ->
jsonMapper.fromJson(EntityUtils.toString(response.getEntity()), TokenResponse.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.message.BasicNameValuePair;
Expand Down Expand Up @@ -48,7 +48,7 @@ public Authentication build() {
}

private String retrieveToken(Product product, SimpleCredential simpleCredential) {
try(CloseableHttpClient client = HttpClient.getInstance()) {
try(CloseableHttpClient client = HttpClients.createDefault()) {
HttpPost request = buildRequest(simpleCredential);
String cookie = client.execute(request, response -> {
Header[] cookieHeaders = response.getHeaders("Set-Cookie");
Expand Down

0 comments on commit 560be7b

Please sign in to comment.