public LdapSettingResp readLdapConfig()

in manager/general/src/main/java/org/apache/doris/stack/component/LdapComponent.java [161:220]


    public LdapSettingResp readLdapConfig() {
        LdapSettingResp ldapSettingResp = new LdapSettingResp();

        if (!enabled()) {
            log.warn("Ldap configuration don't exist.");
            ldapSettingResp.setLdapEnabled(false);
            return ldapSettingResp;
        }

        ldapSettingResp.setLdapEnabled(true);

        SettingEntity ldapHost = settingComponent.readSetting(ConfigConstant.LDAP_HOST_KEY);
        if (ldapHost != null) {
            ldapSettingResp.setLdapHost(ldapHost.getValue());
        }

        SettingEntity ldapPort = settingComponent.readSetting(ConfigConstant.LDAP_PORT_KEY);
        if (ldapPort != null) {
            ldapSettingResp.setLdapPort(Integer.parseInt(ldapPort.getValue()));
        }

        SettingEntity ldapSecurity = settingComponent.readSetting(ConfigConstant.LDAP_SECURITY_KEY);
        if (ldapSecurity != null) {
            ldapSettingResp.setLdapSecurity(ldapSecurity.getValue());
        }

        SettingEntity ldapBindDN = settingComponent.readSetting(ConfigConstant.LDAP_BIND_DN_KEY);
        if (ldapBindDN != null) {
            ldapSettingResp.setLdapBindDn(ldapBindDN.getValue());
        }

        SettingEntity ldapPassword = settingComponent.readSetting(ConfigConstant.LDAP_PASSWORD_KEY);
        if (ldapPassword != null) {
            ldapSettingResp.setLdapPassword(ldapPassword.getValue());
        }

        ldapSettingResp.setLdapUserBase(getBaseDn());

        SettingEntity ldapUserFilter = settingComponent.readSetting(ConfigConstant.LDAP_USER_FILTER_KEY);
        if (ldapUserFilter != null) {
            ldapSettingResp.setLdapUserFilter(ldapUserFilter.getValue());
        }

        SettingEntity ldapAttributeEmail = settingComponent.readSetting(ConfigConstant.LDAP_ATTRIBUTE_EMAIL_KEY);
        if (ldapAttributeEmail != null) {
            ldapSettingResp.setLdapAttributeEmail(ldapAttributeEmail.getValue());
        }

        SettingEntity ldapAttributeFirstName = settingComponent.readSetting(ConfigConstant.LDAP_ATTRIBUTE_FIRSTNAME_KEY);
        if (ldapAttributeFirstName != null) {
            ldapSettingResp.setLdapAttributeFirstName(ldapAttributeFirstName.getValue());
        }

        SettingEntity ldapAttributeLastName = settingComponent.readSetting(ConfigConstant.LDAP_ATTRIBUTE_LASTNAME_KEY);
        if (ldapAttributeLastName != null) {
            ldapSettingResp.setLdapAttributeLastName(ldapAttributeLastName.getValue());
        }

        return ldapSettingResp;
    }