use of org.codice.ddf.admin.common.fields.base.scalar.BooleanField in project admin-console-beta by connexta.
the class LdapTestConnection method performFunction.
// Possible message types: CANNOT_CONFIGURE, CANNOT_CONNECT
@Override
public BooleanField performFunction() {
LdapConnectionAttempt connectionAttempt = utils.getLdapConnection(connection);
addResultMessages(connectionAttempt.messages());
return new BooleanField(connectionAttempt.connection().isPresent());
}
use of org.codice.ddf.admin.common.fields.base.scalar.BooleanField in project admin-console-beta by connexta.
the class LdapTestDirectorySettings method performFunction.
@Override
public BooleanField performFunction() {
try (LdapConnectionAttempt connectionAttempt = utils.bindUserToLdapConnection(conn, bindInfo)) {
addErrorMessages(connectionAttempt);
if (containsErrorMsgs()) {
return new BooleanField(false);
}
Connection ldapConnection = connectionAttempt.getResult();
addErrorMessages(utils.checkDirExists(settings.baseGroupDnField(), ldapConnection));
addErrorMessages(utils.checkDirExists(settings.baseUserDnField(), ldapConnection));
// Short-circuit return here, if either the user or group directory does not exist
if (containsErrorMsgs()) {
return new BooleanField(false);
}
checkUsersInDir(ldapConnection);
// Short-circuit return here, if there are no users in base dir
if (containsErrorMsgs()) {
return new BooleanField(false);
}
if (settings.useCaseField().isAttributeStore()) {
// Check if group objectClass is on at least one entry in the directory
checkGroupObjectClass(ldapConnection);
// Don't check the group if there is no entry with the correct objectClass
if (containsErrorMsgs()) {
return new BooleanField(false);
}
// Then, check that there is a group entry (of the correct objectClass) that has
// any member references
checkGroup(ldapConnection);
}
} catch (IOException e) {
LOGGER.warn("Error closing LDAP connection", e);
}
return new BooleanField(!containsErrorMsgs());
}
use of org.codice.ddf.admin.common.fields.base.scalar.BooleanField in project admin-console-beta by connexta.
the class LdapTestBind method performFunction.
// Possible message types: CANNOT_CONFIGURE, CANNOT_CONNECT, CANNOT_BIND
@Override
public BooleanField performFunction() {
LdapConnectionAttempt connectionAttempt = utils.bindUserToLdapConnection(conn, creds);
addResultMessages(connectionAttempt.messages());
return new BooleanField(connectionAttempt.connection().isPresent());
}
use of org.codice.ddf.admin.common.fields.base.scalar.BooleanField in project admin-console-beta by connexta.
the class LdapTestSettings method performFunction.
@Override
public BooleanField performFunction() {
LdapConnectionAttempt connectionAttempt = utils.bindUserToLdapConnection(conn, bindInfo);
addResultMessages(connectionAttempt.messages());
if (!connectionAttempt.connection().isPresent()) {
return new BooleanField(false);
}
Connection ldapConnection = connectionAttempt.connection().get();
if (!checkDirExists(settings.baseUserDn(), ldapConnection)) {
addArgumentMessage(BASE_USER_DN_NOT_FOUND.setPath(settings.path()));
} else {
addArgumentMessages(checkUsersInDir(settings, ldapConnection));
}
if (!checkDirExists(settings.baseGroupDn(), ldapConnection)) {
addArgumentMessage(BASE_GROUP_DN_NOT_FOUND.setPath(settings.path()));
} else {
// First check the group objectClass is on at least one entry in the directory
addArgumentMessages(checkGroupObjectClass(settings, ldapConnection));
// Then, check that there is a group entry (of the correct objectClass) that has
// any member references
addArgumentMessages(checkGroup(settings, ldapConnection));
}
return new BooleanField(!containsErrorMsgs());
}
use of org.codice.ddf.admin.common.fields.base.scalar.BooleanField in project admin-console-beta by connexta.
the class LdapTestClaimMappings method performFunction.
@Override
public BooleanField performFunction() {
try (LdapConnectionAttempt connectionAttempt = utils.bindUserToLdapConnection(conn, bindInfo)) {
addErrorMessages(connectionAttempt);
if (containsErrorMsgs()) {
return new BooleanField(false);
}
Connection ldapConnection = connectionAttempt.getResult();
addErrorMessages(utils.checkDirExists(baseUserDn, ldapConnection));
// Short-circuit return here, if either the user or group directory does not exist
if (containsErrorMsgs()) {
return new BooleanField(false);
}
claimMappings.getList().stream().map(ClaimsMapEntry::claimValueField).filter(claim -> !mappingAttributeFound(ldapConnection, claim.getValue())).forEach(claim -> addErrorMessage(userAttributeNotFoundError(claim.getPath())));
} catch (IOException e) {
LOGGER.warn("Error closing LDAP connection", e);
}
return new BooleanField(!containsErrorMsgs());
}
Aggregations