Пример #1
0
  protected void postConnect(LDAPConnection conn) throws LDAPException {

    if (M_log.isDebugEnabled()) {
      M_log.debug("postConnect()");
    }

    if (config.isSecureConnection() && isTlsSocketFactory()) {
      if (M_log.isDebugEnabled()) {
        M_log.debug("postConnect(): starting TLS");
      }
      conn.startTLS();
    }
  }
Пример #2
0
  /** {@inheritDoc} */
  public void init() {

    if (M_log.isDebugEnabled()) {
      M_log.debug("init()");
    }

    if (config.isSecureConnection()) {
      if (M_log.isDebugEnabled()) {
        M_log.debug("init(): initializing keystore");
      }
      initKeystoreLocation();
      initKeystorePassword();
    }
  }
Пример #3
0
  /**
   * Return a new LDAPConnection with the appropriate socket factory set for the connection type.
   */
  private LDAPConnection createConnectionWithSocketFactory() {
    LDAPSocketFactory factory;

    if (config.isSecureConnection()) {
      factory = config.getSecureSocketFactory();

      if (factory == null) {
        throw new RuntimeException(
            "You must set a 'secureSocketFactory' (in jldap-beans.xml) when using LDAPS");
      }
    } else {
      factory = config.getSocketFactory();
    }

    if (factory == null) {
      return new LDAPConnection();
    } else {
      return new LDAPConnection(factory);
    }
  }