KEYCLOAK-2434
BasicAuthRequestAuthenticator ignores HttpClientBuilder configuration
This commit is contained in:
parent
5f41215e27
commit
528e3127e6
2 changed files with 29 additions and 33 deletions
|
@ -85,9 +85,8 @@ public class BasicAuthRequestAuthenticator extends BearerTokenRequestAuthenticat
|
|||
|
||||
private AccessTokenResponse getToken(String username, String password) throws Exception {
|
||||
AccessTokenResponse tokenResponse=null;
|
||||
HttpClient client = new HttpClientBuilder().disableTrustManager().build();
|
||||
HttpClient client = deployment.getClient();
|
||||
|
||||
try {
|
||||
HttpPost post = new HttpPost(
|
||||
KeycloakUriBuilder.fromUri(deployment.getAuthServerBaseUrl())
|
||||
.path(ServiceUrlConstants.TOKEN_PATH).build(deployment.getRealm()));
|
||||
|
@ -118,9 +117,6 @@ public class BasicAuthRequestAuthenticator extends BearerTokenRequestAuthenticat
|
|||
is.close();
|
||||
} catch (java.io.IOException ignored) { }
|
||||
}
|
||||
} finally {
|
||||
client.getConnectionManager().shutdown();
|
||||
}
|
||||
|
||||
return (tokenResponse);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class KeycloakDeploymentBuilder {
|
|||
if (realmKeyPem == null && adapterConfig.isBearerOnly() && adapterConfig.getAuthServerUrl() == null) {
|
||||
throw new IllegalArgumentException("For bearer auth, you must set the realm-public-key or auth-server-url");
|
||||
}
|
||||
if (realmKeyPem == null || !deployment.isBearerOnly() || deployment.isRegisterNodeAtStartup() || deployment.getRegisterNodePeriod() != -1) {
|
||||
if (realmKeyPem == null || !deployment.isBearerOnly() || deployment.isEnableBasicAuth() || deployment.isRegisterNodeAtStartup() || deployment.getRegisterNodePeriod() != -1) {
|
||||
deployment.setClient(new HttpClientBuilder().build(adapterConfig));
|
||||
}
|
||||
if (adapterConfig.getAuthServerUrl() == null && (!deployment.isBearerOnly() || realmKeyPem == null)) {
|
||||
|
|
Loading…
Reference in a new issue