Package org.wso2.carbon.apacheds.exception

Examples of org.wso2.carbon.apacheds.exception.DirectoryServerException


        } catch (LdapInvalidDnException e) {
            String msg = "Could not add a new partition with partition id " + partitionId +
                         " and suffix " + partitionSuffix;
            logger.error(msg, e);
            throw new DirectoryServerException(msg, e);
        }
    }
View Full Code Here


    public void init(final KdcConfiguration configuration, LDAPServer ldapServer)
        throws DirectoryServerException {

        if (configuration == null) {
            throw new DirectoryServerException("Could not initialize KDC server. " +
                                               "KDC configurations are null");
        }

        if (ldapServer == null) {
            throw new DirectoryServerException("Could not initialize KDC server. " +
                                               "Directory service is null.");
        }

        if (!(ldapServer instanceof ApacheLDAPServer)) {
            throw new DirectoryServerException("Apache KDC server is only compatible with " +
                                               "ApacheLDAPServer");
        }

        ApacheLDAPServer apacheLDAP = (ApacheLDAPServer)ldapServer;

        this.kdcServer.setServiceName(configuration.getKdcName());
        this.kdcServer.setKdcPrincipal(configuration.getKdcPrinciple());
        this.kdcServer.setPrimaryRealm(configuration.getPrimaryRealm());
        this.kdcServer.setMaximumTicketLifetime(configuration.getMaxTicketLifeTime());
        this.kdcServer.setMaximumRenewableLifetime(configuration.getMaxRenewableLifeTime());
        this.kdcServer.setSearchBaseDn(configuration.getSearchBaseDomainName());
        this.kdcServer.setPaEncTimestampRequired(
                configuration.isPreAuthenticateTimeStampRequired());
       
        configureTransportHandlers(configuration);

        DirectoryService directoryService = apacheLDAP.getService();

        if (directoryService == null) {
            throw new DirectoryServerException("LDAP service is null. " +
                                               "Could not configure Kerberos.");
        }

        this.kdcServer.setDirectoryService(directoryService);
View Full Code Here

                schemaRoot.modifyAttributes("cn=Krb5kdc", mods);
            }
        } catch (NamingException e) {
            String msg = "An error occurred while enabling Kerberos schema.";
            logger.error(msg, e);
            throw new DirectoryServerException(msg, e);
        }
    }
View Full Code Here

        DirContext ctx = null;

        try {

            if (!(ldapServer instanceof ApacheLDAPServer)) {
                throw new DirectoryServerException("Apache KDC server is only compatible with " +
                                                   "ApacheLDAPServer");
            }

            ApacheLDAPServer apacheLDAP = (ApacheLDAPServer)ldapServer;

            // Get a context, create the ou=users subcontext, then create the 3 principals.
            Hashtable<String, Object> env = new Hashtable<String, Object>();
            env.put(DirectoryService.JNDI_KEY, apacheLDAP.getService());
            env.put(Context.INITIAL_CONTEXT_FACTORY,
                    ConfigurationConstants.LDAP_INITIAL_CONTEXT_FACTORY);
            env.put(Context.PROVIDER_URL, ConfigurationConstants.USER_SUB_CONTEXT + "," +
                                          partitionInfo.getRootDN());
            env.put(Context.SECURITY_PRINCIPAL, partitionInfo.getAdminDomainName());
            env.put(Context.SECURITY_CREDENTIALS,
                    partitionInfo.getPartitionAdministrator().getAdminPassword());
            env.put(Context.SECURITY_AUTHENTICATION, ConfigurationConstants.SIMPLE_AUTHENTICATION);

            ctx = new InitialDirContext(env);


            // Set KDC principle for this partition
            Attributes attrs = getPrincipalAttributes(ConfigurationConstants.SERVER_PRINCIPLE,
                                           ConfigurationConstants.KDC_SERVER_COMMON_NAME,
                                           ConfigurationConstants.KDC_SERVER_UID,
                                           partitionInfo.getPartitionKdcPassword(),
                                           getKDCPrincipleName(partitionInfo));

            ctx.createSubcontext("uid=" + ConfigurationConstants.KDC_SERVER_UID, attrs);

            // Set LDAP principle for this partition
            attrs = getPrincipalAttributes(ConfigurationConstants.SERVER_PRINCIPLE,
                                           ConfigurationConstants.LDAP_SERVER_COMMON_NAME,
                                           ConfigurationConstants.LDAP_SERVER_UID,
                                           partitionInfo.getLdapServerPrinciplePassword(),
                                           getLDAPPrincipleName(partitionInfo));

            ctx.createSubcontext("uid=" + ConfigurationConstants.LDAP_SERVER_UID, attrs);

        } catch (NamingException e) {
            String msg = "Unable to add server principles for KDC and LDAP. " +
                         "Incorrect domain names.";
            logger.error(msg, e);
            throw new DirectoryServerException(msg, e);
        } finally {

            if (ctx != null) {
                try {
                    ctx.close();
View Full Code Here

        env.put(Context.PROVIDER_URL, SchemaConstants.OU_SCHEMA);

        try {
            schemaRoot = new InitialLdapContext(env, null);
        } catch (NamingException e) {
            throw new DirectoryServerException(
                "Unable to create Schema context with user " + connectionUser);
        }

    }
View Full Code Here

            logger.info("KDC server started ...");
        } catch (IOException e) {

            String msg = "Could not start KDC server due to an IOException";
            logger.error(msg, e);
            throw new DirectoryServerException(msg, e);

        } catch (LdapInvalidDnException e) {
            String msg = "Could not start KDC server due to an error in a domain name.";
            logger.error(msg, e);
            throw new DirectoryServerException(msg, e);
        }
    }
View Full Code Here

            throws DirectoryServerException {

        if (configurations == null) {
            logger.error("LDAP server initialization failed. " +
                         "LDAP server configuration is invalid.");
            throw new DirectoryServerException("Cannot initialize LDAP server. " +
                                               "Configuration is null");
        }


        this.ldapConfigurations = configurations;

        try {

            initializeDefaultDirectoryService();
            initializeLDAPServer();

            partitionManager = new ApacheDirectoryPartitionManager(
                    this.service, this.ldapConfigurations.getWorkingDirectory());

        } catch (Exception e) {
            logger.error("LDAP server initialization failed.", e);
            throw new DirectoryServerException("Error initializing ApacheLDAPServer. ", e);
        }

    }
View Full Code Here

            this.ldapServer.start();
            logger.info("LDAP server started.");
        } catch (Exception e) {

            logger.error("Error starting LDAP server.", e);
            throw new DirectoryServerException("Can not start the server ", e);
        }
    }
View Full Code Here

            this.service.shutdown();
            logger.info("LDAP server stopped.");
        } catch (Exception e) {

            logger.error("Error stopping LDAP server.", e);
            throw new DirectoryServerException("Can not start the server ", e);
        }
    }
View Full Code Here

            configureDirectoryService();

            factory.init(this.ldapConfigurations.getInstanceId());

        } catch (Exception e) {
            throw new DirectoryServerException("Can not start the Default apacheds service ", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.apacheds.exception.DirectoryServerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.