public void configure()

in ldap/src/java/org/apache/fulcrum/security/ldap/LDAPUserManagerImpl.java [516:576]


    public void configure(Configuration conf) throws ConfigurationException
    {
        super.configure(conf);

        Configuration ldap = conf.getChild(LDAP_KEY, false);

        if (ldap == null)
        {
            throw new ConfigurationException("LDAP configuration is mandatory.", conf);
        }

        this.ldapBasesearch = ldap.getChild(LDAP_BASE_SEARCH_KEY).getValue(null);

        if (this.ldapBasesearch == null)
        {
            throw new ConfigurationException("LDAP configuration requires a base search domain", ldap);
        }

        this.ldapAdminUsername = ldap.getChild(LDAP_ADMIN_USERNAME_KEY).getValue(null);

        if (this.ldapAdminUsername == null)
        {
            throw new ConfigurationException("LDAP configuration requires an admin user", ldap);
        }

        this.ldapAdminPassword = ldap.getChild(LDAP_ADMIN_PASSWORD_KEY).getValue(null);

        if (this.ldapAdminPassword == null)
        {
            throw new ConfigurationException("LDAP configuration requires an admin password", ldap);
        }

        this.ldapHost = ldap.getChild(LDAP_HOST_KEY).getValue(LDAP_HOST_DEFAULT);
        this.ldapPort = ldap.getChild(LDAP_PORT_KEY).getValue(LDAP_PORT_DEFAULT);
        this.ldapProvider = ldap.getChild(LDAP_PROVIDER_KEY).getValue(LDAP_PROVIDER_DEFAULT);
        this.ldapSecurityAuthentication = ldap.getChild(LDAP_AUTH_KEY).getValue(LDAP_AUTH_DEFAULT);

        Configuration ldapUser = ldap.getChild(LDAP_USER_KEY, false);

        if (ldapUser == null)
        {
            getLogger().info("No LDAP user attributes defined, using defaults.");
            this.ldapObjectClass = LDAP_USER_OBJECTCLASS_DEFAULT;
            this.ldapUserid = LDAP_USER_USERID_DEFAULT;
            this.ldapUsername = LDAP_USER_USERNAME_DEFAULT;
            this.ldapFirstname = LDAP_USER_FIRSTNAME_DEFAULT;
            this.ldapLastname = LDAP_USER_LASTNAME_DEFAULT;
            this.ldapEmail = LDAP_USER_EMAIL_DEFAULT;
            this.ldapPassword = LDAP_USER_PASSWORD_DEFAULT;
        }
        else
        {
            this.ldapObjectClass = ldapUser.getChild(LDAP_USER_OBJECTCLASS_KEY).getValue(LDAP_USER_OBJECTCLASS_DEFAULT);
            this.ldapUserid = ldapUser.getChild(LDAP_USER_USERID_KEY).getValue(LDAP_USER_USERID_DEFAULT);
            this.ldapUsername = ldapUser.getChild(LDAP_USER_USERNAME_KEY).getValue(LDAP_USER_USERNAME_DEFAULT);
            this.ldapFirstname = ldapUser.getChild(LDAP_USER_FIRSTNAME_KEY).getValue(LDAP_USER_FIRSTNAME_DEFAULT);
            this.ldapLastname = ldapUser.getChild(LDAP_USER_LASTNAME_KEY).getValue(LDAP_USER_LASTNAME_DEFAULT);
            this.ldapEmail = ldapUser.getChild(LDAP_USER_EMAIL_KEY).getValue(LDAP_USER_EMAIL_DEFAULT);
            this.ldapPassword = ldapUser.getChild(LDAP_USER_PASSWORD_KEY).getValue(LDAP_USER_PASSWORD_DEFAULT);
        }
    }