Ejemplo n.º 1
0
 public ADConfig updateCurrentConfig(LDAPConstants config) {
   settingsUtils.changeSetting(ADConstants.ACCESS_MODE_SETTING, config.getAccessMode());
   settingsUtils.changeSetting(ADConstants.DOMAIN_SETTING, config.getDomain());
   settingsUtils.changeSetting(ADConstants.GROUP_NAME_FIELD_SETTING, config.getGroupNameField());
   settingsUtils.changeSetting(
       ADConstants.GROUP_OBJECT_CLASS_SETTING, config.getGroupObjectClass());
   settingsUtils.changeSetting(
       ADConstants.GROUP_SEARCH_FIELD_SETTING, config.getGroupSearchField());
   settingsUtils.changeSetting(ADConstants.LOGIN_DOMAIN_SETTING, config.getLoginDomain());
   settingsUtils.changeSetting(ADConstants.PORT_SETTING, config.getPort());
   settingsUtils.changeSetting(ADConstants.SERVER_SETTING, config.getServer());
   settingsUtils.changeSetting(
       ADConstants.SERVICE_ACCOUNT_PASSWORD_SETTING, config.getServiceAccountPassword());
   settingsUtils.changeSetting(
       ADConstants.SERVICE_ACCOUNT_USERNAME_SETTING, config.getServiceAccountUsername());
   settingsUtils.changeSetting(ADConstants.TLS_SETTING, config.getTls());
   settingsUtils.changeSetting(
       ADConstants.USER_DISABLED_BIT_MASK_SETTING, config.getUserDisabledBitMask());
   settingsUtils.changeSetting(
       ADConstants.USER_ENABLED_ATTRIBUTE_SETTING, config.getUserEnabledAttribute());
   settingsUtils.changeSetting(ADConstants.USER_LOGIN_FIELD_SETTING, config.getUserLoginField());
   settingsUtils.changeSetting(ADConstants.USER_NAME_FIELD_SETTING, config.getUserNameField());
   settingsUtils.changeSetting(ADConstants.USER_OBJECT_CLASS_SETTING, config.getUserObjectClass());
   settingsUtils.changeSetting(ADConstants.USER_SEARCH_FIELD_SETTING, config.getUserSearchField());
   settingsUtils.changeSetting(ADConstants.TIMEOUT_SETTING, config.getConnectionTimeout());
   settingsUtils.changeSetting(SecurityConstants.SECURITY_SETTING, config.getEnabled());
   if (config.getEnabled() != null) {
     settingsUtils.changeSetting(SecurityConstants.AUTH_PROVIDER_SETTING, ADConstants.CONFIG);
   } else {
     settingsUtils.changeSetting(
         SecurityConstants.AUTH_PROVIDER_SETTING, SecurityConstants.NO_PROVIDER);
   }
   return currentLdapConfig(config);
 }
Ejemplo n.º 2
0
  private ADConfig currentLdapConfig(LDAPConstants config) {
    ADConfig currentConfig = (ADConfig) listInternal(null, null, null, null);
    String domain = currentConfig.getDomain();
    if (config.getDomain() != null) {
      domain = config.getDomain();
    }
    String server = currentConfig.getServer();
    if (config.getServer() != null) {
      server = config.getServer();
    }
    String loginDomain = currentConfig.getLoginDomain();
    if (config.getLoginDomain() != null) {
      loginDomain = config.getLoginDomain();
    }
    String accessMode = currentConfig.getAccessMode();
    if (config.getAccessMode() != null) {
      accessMode = config.getAccessMode();
    }
    String serviceAccountUsername = currentConfig.getServiceAccountUsername();
    if (config.getServiceAccountUsername() != null) {
      serviceAccountUsername = config.getServiceAccountUsername();
    }
    String serviceAccountPassword = currentConfig.getServiceAccountPassword();
    if (config.getServiceAccountPassword() != null) {
      serviceAccountPassword = config.getServiceAccountPassword();
    }
    boolean tls = currentConfig.getTls();
    if (config.getTls() != null) {
      tls = config.getTls();
    }
    int port = currentConfig.getPort();
    if (config.getPort() != null) {
      port = config.getPort();
    }
    boolean enabled = currentConfig.getEnabled();
    if (config.getEnabled() != null) {
      enabled = config.getEnabled();
    }
    String userSearchField = currentConfig.getUserSearchField();
    if (config.getUserSearchField() != null) {
      userSearchField = config.getUserSearchField();
    }
    String groupSearchField = currentConfig.getGroupSearchField();
    if (config.getGroupSearchField() != null) {
      groupSearchField = config.getGroupSearchField();
    }
    String userLoginField = currentConfig.getUserLoginField();
    if (config.getUserLoginField() != null) {
      userLoginField = config.getUserLoginField();
    }
    int userEnabledMaskBit = currentConfig.getUserDisabledBitMask();
    if (config.getUserDisabledBitMask() != null) {
      userEnabledMaskBit = config.getUserDisabledBitMask();
    }

    String userObjectClass = currentConfig.getUserObjectClass();
    if (config.getUserObjectClass() != null) {
      userObjectClass = config.getUserObjectClass();
    }
    String userNameField = currentConfig.getUserNameField();
    if (config.getUserNameField() != null) {
      userNameField = config.getUserNameField();
    }
    String userEnabledAttribute = currentConfig.getUserEnabledAttribute();
    if (config.getUserEnabledAttribute() != null) {
      userEnabledAttribute = config.getUserEnabledAttribute();
    }
    String groupObjectClass = currentConfig.getGroupObjectClass();
    if (config.getGroupObjectClass() != null) {
      groupObjectClass = config.getGroupObjectClass();
    }
    String groupNameField = currentConfig.getGroupNameField();
    if (config.getGroupNameField() != null) {
      groupNameField = config.getGroupNameField();
    }
    return new ADConfig(
        server,
        port,
        userEnabledMaskBit,
        loginDomain,
        domain,
        enabled,
        accessMode,
        serviceAccountUsername,
        serviceAccountPassword,
        tls,
        userSearchField,
        userLoginField,
        userObjectClass,
        userNameField,
        userEnabledAttribute,
        groupSearchField,
        groupObjectClass,
        groupNameField,
        config.getConnectionTimeout());
  }