KEYCLOAK-4038 Get bind credential from component if stored
This commit is contained in:
parent
ebd3d522e2
commit
08d7211a93
2 changed files with 10 additions and 2 deletions
|
@ -41,6 +41,7 @@ import org.keycloak.models.ClientModel;
|
|||
import org.keycloak.models.Constants;
|
||||
import org.keycloak.models.GroupModel;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.LDAPConstants;
|
||||
import org.keycloak.models.ModelDuplicateException;
|
||||
import org.keycloak.models.RealmModel;
|
||||
import org.keycloak.models.UserSessionModel;
|
||||
|
@ -56,6 +57,8 @@ import org.keycloak.provider.ProviderFactory;
|
|||
import org.keycloak.representations.adapters.action.GlobalRequestResult;
|
||||
import org.keycloak.representations.idm.AdminEventRepresentation;
|
||||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||
import org.keycloak.representations.idm.EventRepresentation;
|
||||
import org.keycloak.representations.idm.GroupRepresentation;
|
||||
import org.keycloak.representations.idm.PartialImportRepresentation;
|
||||
|
@ -747,9 +750,13 @@ public class RealmAdminResource {
|
|||
@NoCache
|
||||
public Response testLDAPConnection(@QueryParam("action") String action, @QueryParam("connectionUrl") String connectionUrl,
|
||||
@QueryParam("bindDn") String bindDn, @QueryParam("bindCredential") String bindCredential,
|
||||
@QueryParam("useTruststoreSpi") String useTruststoreSpi) {
|
||||
@QueryParam("useTruststoreSpi") String useTruststoreSpi, @QueryParam("componentId") String componentId) {
|
||||
auth.init(RealmAuth.Resource.REALM).requireManage();
|
||||
|
||||
if (componentId != null && bindCredential.equals(ComponentRepresentation.SECRET_VALUE)) {
|
||||
bindCredential = realm.getComponent(componentId).getConfig().getFirst(LDAPConstants.BIND_CREDENTIAL);
|
||||
}
|
||||
|
||||
boolean result = new LDAPConnectionTestManager().testLDAP(action, connectionUrl, bindDn, bindCredential, useTruststoreSpi);
|
||||
return result ? Response.noContent().build() : ErrorResponse.error("LDAP test error", Response.Status.BAD_REQUEST);
|
||||
}
|
||||
|
|
|
@ -1261,7 +1261,8 @@ module.controller('LDAPUserStorageCtrl', function($scope, $location, Notificatio
|
|||
connectionUrl: ldapConfig.connectionUrl,
|
||||
bindDn: ldapConfig.bindDn,
|
||||
bindCredential: ldapConfig.bindCredential,
|
||||
useTruststoreSpi: ldapConfig.useTruststoreSpi
|
||||
useTruststoreSpi: ldapConfig.useTruststoreSpi,
|
||||
componentId: instance.id
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue