Package com.unboundid.util.ssl

Examples of com.unboundid.util.ssl.TrustAllTrustManager


      String bindPassword = settings.getString(Keys.realm.ldap.password, "");

      LDAPConnection conn;
      if (ldapUrl.getScheme().equalsIgnoreCase("ldaps")) {
        // SSL
        SSLUtil sslUtil = new SSLUtil(new TrustAllTrustManager());
        conn = new LDAPConnection(sslUtil.createSSLSocketFactory());
        if (ldapPort == -1) {
          ldapPort = 636;
        }
      } else if (ldapUrl.getScheme().equalsIgnoreCase("ldap") || ldapUrl.getScheme().equalsIgnoreCase("ldap+tls")) {
        // no encryption or StartTLS
        conn = new LDAPConnection();
         if (ldapPort == -1) {
           ldapPort = 389;
         }
      } else {
        logger.error("Unsupported LDAP URL scheme: " + ldapUrl.getScheme());
        return null;
      }

      conn.connect(ldapHost, ldapPort);

      if (ldapUrl.getScheme().equalsIgnoreCase("ldap+tls")) {
        SSLUtil sslUtil = new SSLUtil(new TrustAllTrustManager());
        ExtendedResult extendedResult = conn.processExtendedOperation(
            new StartTLSExtendedRequest(sslUtil.createSSLContext()));
        if (extendedResult.getResultCode() != ResultCode.SUCCESS) {
          throw new LDAPException(extendedResult.getResultCode());
        }
View Full Code Here


      String bindPassword = settings.getString(Keys.realm.ldap.password, "");

      LDAPConnection conn;
      if (ldapUrl.getScheme().equalsIgnoreCase("ldaps")) {
        // SSL
        SSLUtil sslUtil = new SSLUtil(new TrustAllTrustManager());
        conn = new LDAPConnection(sslUtil.createSSLSocketFactory());
        if (ldapPort == -1) {
          ldapPort = 636;
        }
      } else if (ldapUrl.getScheme().equalsIgnoreCase("ldap") || ldapUrl.getScheme().equalsIgnoreCase("ldap+tls")) {
        // no encryption or StartTLS
        conn = new LDAPConnection();
         if (ldapPort == -1) {
           ldapPort = 389;
         }
      } else {
        logger.error("Unsupported LDAP URL scheme: " + ldapUrl.getScheme());
        return null;
      }

      conn.connect(ldapHost, ldapPort);

      if (ldapUrl.getScheme().equalsIgnoreCase("ldap+tls")) {
        SSLUtil sslUtil = new SSLUtil(new TrustAllTrustManager());
        ExtendedResult extendedResult = conn.processExtendedOperation(
            new StartTLSExtendedRequest(sslUtil.createSSLContext()));
        if (extendedResult.getResultCode() != ResultCode.SUCCESS) {
          throw new LDAPException(extendedResult.getResultCode());
        }
View Full Code Here

TOP

Related Classes of com.unboundid.util.ssl.TrustAllTrustManager

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.