Examples of DirectoryServerException


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

        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

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

            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

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

            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

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

            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

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

            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

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

            configureDirectoryService();

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

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

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

                        return registry.lookup(oid);
                    } catch (LdapException e) {
                        String msg = "An error occurred while querying attribute " + attributeName +
                                     " from registry.";
                        logger.error(msg, e);
                        throw new DirectoryServerException(msg, e);
                    }
                } else {
                    String msg = "Could not get attribute registry.";
                    logger.error(msg);
                    throw new DirectoryServerException(msg);

                }

            } else {
                String msg = "Cannot access schema manager. Directory server may not have started.";
                logger.error(msg);
                throw new DirectoryServerException(msg);

            }
        } else {
            String msg = "The directory service is null. LDAP server might not have started.";
            logger.error(msg);
            throw new DirectoryServerException(msg);

        }
    }
View Full Code Here

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

    private void throwException(String message, Throwable e)
            throws DirectoryServerException {
        if (e == null) {
            logger.error(message);
            throw new DirectoryServerException(message);
        } else {
            logger.error(message, e);
            throw new DirectoryServerException(message, e);
        }
    }
View Full Code Here

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

            try {
                adminSession = this.service.getAdminSession();
            } catch (Exception e) {
                String msg = "An error occurred while retraining admin session.";
                logger.error(msg, e);
                throw new DirectoryServerException(msg, e);
            }
            if (adminSession != null) {
                LdapPrincipal adminPrincipal = adminSession.getAuthenticatedPrincipal();
                if (adminPrincipal != null) {
                    return adminPrincipal;
                } else {
                    String msg = "Could not retrieve admin principle. Failed changing connection " +
                                 "user password.";
                    logger.error(msg);
                    throw new DirectoryServerException(msg);
                }
            } else {
                String msg = "Directory admin session is null. The LDAP server may not have " +
                             "started yet.";
                logger.error(msg);
                throw new DirectoryServerException(msg);
            }
        } else {
            String msg = "Directory service is null. The LDAP server may not have started yet.";
            logger.error(msg);
            throw new DirectoryServerException(msg);
        }

    }
View Full Code Here

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

            try {
                adminSession = this.service.getAdminSession();
            } catch (Exception e) {
                String msg = "An error occurred while retraining admin session.";
                logger.error(msg, e);
                throw new DirectoryServerException(msg, e);
            }
            if (adminSession != null) {
                LdapPrincipal adminPrincipal = adminSession.getAuthenticatedPrincipal();
                if (adminPrincipal != null) {

                    String passwordToStore = "{" + ConfigurationConstants.ADMIN_PASSWORD_ALGORITHM +
                                             "}";

                    MessageDigest messageDigest;
                    try {
                        messageDigest = MessageDigest.getInstance(
                                ConfigurationConstants.ADMIN_PASSWORD_ALGORITHM);
                    } catch (NoSuchAlgorithmException e) {
                        throw new DirectoryServerException(
                                "Could not find digest algorithm - " +
                                ConfigurationConstants.ADMIN_PASSWORD_ALGORITHM);
                    }
                    messageDigest.update(password.getBytes());
                    byte[] bytes = messageDigest.digest();
                    String hash = Base64.encode(bytes);
                    passwordToStore = passwordToStore + hash;

                    adminPrincipal.setUserPassword(passwordToStore.getBytes());

                    InternalModifyDnRequest request = new ModifyDnRequestImpl(0);

                    EntryAttribute passwordAttribute = new DefaultServerAttribute(
                            getAttributeType("userPassword"));
                    passwordAttribute.add(passwordToStore.getBytes());

                    ServerModification serverModification =
                            new ServerModification(ModificationOperation.REPLACE_ATTRIBUTE,
                                                   passwordAttribute);

                    List<Modification> modifiedList = new ArrayList<Modification>();
                    modifiedList.add(serverModification);

                    try {
                        adminSession.modify(adminPrincipal.getClonedName(), modifiedList);
                    } catch (Exception e) {
                        String msg = "Failed changing connection user password.";
                        logger.error(msg, e);
                        throw new DirectoryServerException(msg, e);
                    }

                } else {
                    String msg = "Could not retrieve admin principle. Failed changing connection " +
                                 "user password.";
                    logger.error(msg);
                    throw new DirectoryServerException(msg);
                }
            } else {
                String msg = "Directory admin session is null. The LDAP server may not have " +
                             "started yet.";
                logger.error(msg);
                throw new DirectoryServerException(msg);
            }
        } else {
            String msg = "Directory service is null. The LDAP server may not have started yet.";
            logger.error(msg);
            throw new DirectoryServerException(msg);
        }

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.