Keycloak-14726 - release connections after fetching the OIDC-Config
This commit is contained in:
parent
1441e5d6f8
commit
5255336be2
1 changed files with 10 additions and 5 deletions
|
@ -20,6 +20,7 @@ package org.keycloak.adapters;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.adapters.authentication.ClientCredentialsProvider;
|
import org.keycloak.adapters.authentication.ClientCredentialsProvider;
|
||||||
import org.keycloak.adapters.authorization.PolicyEnforcer;
|
import org.keycloak.adapters.authorization.PolicyEnforcer;
|
||||||
|
@ -216,12 +217,16 @@ public class KeycloakDeployment {
|
||||||
HttpGet request = new HttpGet(discoveryUrl);
|
HttpGet request = new HttpGet(discoveryUrl);
|
||||||
request.addHeader("accept", "application/json");
|
request.addHeader("accept", "application/json");
|
||||||
|
|
||||||
HttpResponse response = getClient().execute(request);
|
try {
|
||||||
if (response.getStatusLine().getStatusCode() != 200) {
|
HttpResponse response = getClient().execute(request);
|
||||||
throw new Exception(response.getStatusLine().getReasonPhrase());
|
if (response.getStatusLine().getStatusCode() != 200) {
|
||||||
|
EntityUtils.consumeQuietly(response.getEntity());
|
||||||
|
throw new Exception(response.getStatusLine().getReasonPhrase());
|
||||||
|
}
|
||||||
|
return JsonSerialization.readValue(response.getEntity().getContent(), OIDCConfigurationRepresentation.class);
|
||||||
|
} finally {
|
||||||
|
request.releaseConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonSerialization.readValue(response.getEntity().getContent(), OIDCConfigurationRepresentation.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RelativeUrlsUsed getRelativeUrls() {
|
public RelativeUrlsUsed getRelativeUrls() {
|
||||||
|
|
Loading…
Reference in a new issue