com.novell.ldap.LDAPConnection.connect()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中com.novell.ldap.LDAPConnection.connect()方法的一些代码示例,展示了LDAPConnection.connect()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LDAPConnection.connect()方法的具体详情如下:
包路径:com.novell.ldap.LDAPConnection
类名称:LDAPConnection
方法名:connect

LDAPConnection.connect介绍

[英]Connects to the specified host and port.

If this LDAPConnection object represents an open connection, the connection is closed first before the new connection is opened. At this point, there is no authentication, and any operations are conducted as an anonymous client.

When more than one host name is specified, each host is contacted in turn until a connection can be established.
[中]连接到指定的主机和端口。
如果此LDAPConnection对象表示打开的连接,则在打开新连接之前先关闭该连接。此时,没有身份验证,任何操作都作为匿名客户端进行。
当指定多个主机名时,将依次联系每个主机,直到可以建立连接。

代码示例

代码示例来源:origin: glyptodon/guacamole-client

ldapConnection.connect(
  confService.getServerHostname(),
  confService.getServerPort()

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

private LDAPConnection getConnection() throws LDAPException, UnsupportedEncodingException {
//        LDAPSocketFactory ssf;
//        Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
      // String path ="C:\\j2sdk1.4.2_09\\jre\\lib\\security\\cacerts";
      //op("the trustStore: " + System.getProperty("javax.net.ssl.trustStore"));
      // System.setProperty("javax.net.ssl.trustStore", path);
//        op(" reading the strustStore: " + System.getProperty("javax.net.ssl.trustStore"));
//        ssf = new LDAPJSSESecureSocketFactory();
//        LDAPConnection.setSocketFactory(ssf);

      LDAPConnection lc = new LDAPConnection();
      lc.connect(ldapHost, ldapPort);

      // bind to the server
      lc.bind(ldapVersion, loginDN, password.getBytes("UTF8"));
      // tbd
      // LDAPConnection pooling here?
      //
      return lc;
    }

代码示例来源:origin: org.xwiki.platform/xwiki-platform-ldap-authenticator

/**
 * Connect to server.
 * 
 * @param ldapHost the host of the server to connect to.
 * @param port the port of the server to connect to.
 * @throws LDAPException error when trying to connect.
 */
private void connect(String ldapHost, int port) throws LDAPException
{
  LOGGER.debug("Connection to LDAP server [{}:{}]", ldapHost, port);
  // connect to the server
  this.connection.connect(ldapHost, port);
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * Connect to server.
 * 
 * @param ldapHost the host of the server to connect to.
 * @param port the port of the server to connect to.
 * @throws LDAPException error when trying to connect.
 */
private void connect(String ldapHost, int port) throws LDAPException
{
  if (LOG.isDebugEnabled()) {
    LOG.debug("Connection to LDAP server [" + ldapHost + ":" + port + "]");
  }
  // connect to the server
  this.connection.connect(ldapHost, port);
}

代码示例来源:origin: com.novell.ldap/jldap

/**
 *
 * Connects to the specified host and port
 *
 * @see <a href="../../../../api/com/novell/ldap/LDAPConnection.html#connect(java.lang.String, int)">
    com.novell.ldap.LDAPConnection.connect(String, int)</a>
 */
public void connect(String host, int port)
  throws LDAPException
{
  try {
    conn.connect( host, port);
  } catch( com.novell.ldap.LDAPException ex) {
    throw new LDAPException( ex);
  }
  return;
}

代码示例来源:origin: stackoverflow.com

LDAPConnection ldc = new LDAPConnection()
ldc.connect(...);
if (ldc.isConnected())
{
  do good stuff
}
else
{
  getLDAPConnection(...);
}

代码示例来源:origin: stackoverflow.com

LDAPConnection ld = new LDAPConnection();
ld.connect(LDAP_SERVER, LDAP_PORT);
LDAPSearchResults res = ld.search(BASE_DN, SEARCH_SCOPE, "(uid=" + THE_ID +")", null, false);

代码示例来源:origin: stackoverflow.com

LDAPConnection connection = new LDAPConnection( new LDAPJSSEStartTLSFactory() );
connection.connect(hostname, port);
connection.startTLS();
connection.bind(LDAPConnection.LDAP_V3, username+"@"+domain, password.getBytes());

代码示例来源:origin: stackoverflow.com

public static LDAPConnection getNewSSLConnection(String address, int port, BindRequest bindRequest) throws LDAPException, GeneralSecurityException
{
  SSLUtil sslUtil = new SSLUtil(new TrustAllTrustManager());
  SSLSocketFactory sslSocketFactory = sslUtil.createSSLSocketFactory();
  LDAPConnection ldc = new LDAPConnection(sslSocketFactory);
  ldc.connect(address, port);
  ldc.bind(bindRequest);
  return ldc;
}

代码示例来源:origin: com.bbossgroups.pdp/pdp-ldap

lc.connect(ldapBean.getUrl(), ldapBean.getPort());
String dn = response.get("distinguishedName");
lc.bind(LDAPConnection.LDAP_V3, response.get("distinguishedName"), password);//如果口令为空,则会导致转化为匿名用户

代码示例来源:origin: stackoverflow.com

try
  connection.connect("localhost", 10389);

代码示例来源:origin: stackoverflow.com

LDAPConnection conn = new LDAPConnection();
conn.connect("blah.blah.address", 389);

String[] attrIDs = {"uniqueMember"};
LDAPSearchResults search = conn.search("dc=foo,dc=bar",
                    LDAPConnection.SCOPE_ONE,
                    "cn=testgroup", attrIDs, false);

while(search.hasMore()) {
  LDAPEntry entry = search.next();
  for (String string : entry.getAttribute("uniqueMember").getStringValueArray()) {
    System.out.println(string);
  }
}

代码示例来源:origin: OpenNMS/opennms

/** {@inheritDoc} */
  @Override
  public void connect(final InetAddress address, final int port, final int timeout) throws IOException, Exception {
    super.connect(address, port, timeout);
    final LDAPConnection lc = new LDAPConnection(new TimeoutLDAPSocket(timeout));
    lc.connect(InetAddressUtils.str(address), port);
  }
}

代码示例来源:origin: org.opennms/opennms-detector-lineoriented

/** {@inheritDoc} */
  @Override
  public void connect(final InetAddress address, final int port, final int timeout) throws IOException, Exception {
    super.connect(address, port, timeout);
    final LDAPConnection lc = new LDAPConnection(new TimeoutLDAPSocket(timeout));
    lc.connect(InetAddressUtils.str(address), port);
  }
}

代码示例来源:origin: stackoverflow.com

conn.connect("ldap.mycompany.com",389);
LDAPSearchResults searchResults = conn.search("ou=people,dc=mycompany,dc=com",
  LDAPConnection.SCOPE_ONE, "cn=Surname Name", null, false);
  tmp.connect("ldap.mycompany.com", 389);
  tmp.bind("suid=" + cnValue + "," + "ou=people,dc=mycompany,dc=com", "MYPASSWORD");

代码示例来源:origin: sakaiproject/sakai

conn.connect(config.getLdapHost(), config.getLdapPort());

代码示例来源:origin: com.bbossgroups.pdp/pdp-ldap

LDAPConnection lc = new LDAPConnection();
try {
  lc.connect(ldapBean.getUrl(), ldapBean.getPort());
  lc.bind(LDAPConnection.LDAP_V3, ldapBean.getSecurityId(), new DESCipher().decrypt(ldapBean.getSecurityPsw()));

代码示例来源:origin: com.novell.ldap/jldap

lconn.connect(toGet.getHost(),toGet.getPort());
LDAPEntry toReturn = lconn.read(toGet.getDN(),toGet.getAttributeArray());
if( Debug.LDAP_DEBUG) {

代码示例来源:origin: com.novell.ldap/jldap

lconn.connect(toGet.getHost(),toGet.getPort());
LDAPEntry toReturn = lconn.read(toGet.getDN(),
              toGet.getAttributeArray(), cons);

代码示例来源:origin: com.novell.ldap/jldap

lconn.connect(toGet.getHost(),toGet.getPort());
if( cons == null) {

相关文章