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

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

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

LDAPConnection.bind介绍

[英]Synchronously authenticates to the LDAP server (that the object is currently connected to) using the specified name, password, and LDAP version.

If the object has been disconnected from an LDAP server, this method attempts to reconnect to the server. If the object has already authenticated, the old authentication is discarded.
[中]使用指定的名称、密码和LDAP版本对LDAP服务器(对象当前连接到的服务器)进行同步身份验证。
如果对象已从LDAP服务器断开连接,此方法将尝试重新连接到服务器。如果对象已通过身份验证,则旧的身份验证将被丢弃。

代码示例

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

ldapConnection.bind(LDAPConnection.LDAP_V3, userDN, passwordBytes);

代码示例来源: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: sakaiproject/sakai

public void bind(int i, String s, String s1, LDAPConstraints ldapconstraints) throws LDAPException {
  bindAttempted = true;
  super.bind(i, s, s1, ldapconstraints);
}

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

public void bind(String s, String s1) throws LDAPException {
  bindAttempted = true;
  super.bind(s, s1);
}

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

public void bind(int i, String s, byte[] abyte0) throws LDAPException {
  bindAttempted = true;
  super.bind(i, s, abyte0);
}

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

public void bind(String s, String s1, String[] as, Map map, Object obj) throws LDAPException {
  bindAttempted = true;
  super.bind(s, s1, as, map, obj);
}

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

public void bind(int i, String s, byte[] abyte0, LDAPConstraints ldapconstraints) throws LDAPException {
  bindAttempted = true;
  super.bind(i, s, abyte0, ldapconstraints);
}

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

public LDAPResponseQueue bind(int i, String s, byte[] abyte0, LDAPResponseQueue ldapresponsequeue) throws LDAPException {
  bindAttempted = true;
  return super.bind(i, s, abyte0, ldapresponsequeue);
}

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

public void bind(int i, String s, String s1) throws LDAPException {
  bindAttempted = true;
  super.bind(i, s, s1);
}

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

public void bind(String s, String s1, LDAPConstraints ldapconstraints) throws LDAPException {
  bindAttempted = true;
  super.bind(s, s1, ldapconstraints);
}

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

public void bind(String s, String s1, Map map, Object obj, LDAPConstraints ldapconstraints) throws LDAPException {
  bindAttempted = true;
  super.bind(s, s1, map, obj, ldapconstraints);
}

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

public LDAPResponseQueue bind(int i, String s, byte[] abyte0, LDAPResponseQueue ldapresponsequeue, LDAPConstraints ldapconstraints) throws LDAPException {
  bindAttempted = true;
  return super.bind(i, s, abyte0, ldapresponsequeue, ldapconstraints);
}

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

public void bind(String s, String s1, Map map, Object obj) throws LDAPException {
  bindAttempted = true;
  super.bind(s, s1, map, obj);
}

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

public void bind(String s, String s1, String[] as, Map map, Object obj, LDAPConstraints ldapconstraints) throws LDAPException {
  bindAttempted = true;
  super.bind(s, s1, as, map, obj, ldapconstraints);
}

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

/**
 * Bind to LDAP server.
 * 
 * @param loginDN the user DN to connect to LDAP server.
 * @param password the password to connect to LDAP server.
 * @throws UnsupportedEncodingException error when converting provided password to UTF-8 table.
 * @throws LDAPException error when trying to bind.
 */
public void bind(String loginDN, String password) throws UnsupportedEncodingException, LDAPException
{
  LOGGER.debug("Binding to LDAP server with credentials login=[{}]", loginDN);
  // authenticate to the server
  this.connection.bind(LDAPConnection.LDAP_V3, loginDN, password.getBytes("UTF8"));
}

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

private void bind(LDAPConnection conn, String dn, String pw)
throws LDAPException {
  
  if ( log.isDebugEnabled() ) {
    log.debug("bind(): binding [dn = " + dn + "]");
  }
  
  try {
    conn.bind(LDAPConnection.LDAP_V3, dn, pw.getBytes("UTF8"));
  } catch ( UnsupportedEncodingException e ) {
    throw new RuntimeException("Failed to encode user password", e);
  }
}

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

// exception handling not shown
LDAPConnection ldapConnection = new LDAPConnection(hostname,port);
BindRequest bindRequest = new SimpleBindRequest(username,password);
BindResult bindResult = ldapConnection.bind(bindRequest);
if(bindResult.getResultCode().equals(ResultCode.SUCCESS)) {
  /// successful authentication
}
ldapConnection.close();

代码示例来源: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

// exception handling is not shown
final String dn = ....;
final byte[] password = ....;
final BindRequest bindRequest = new SimpleBindRequest(dn,password);
final LDAPConnection ldapConnection = new LDAPConnection(hostname,port);
final BindResult bindResult = ldapConnection.bind(bindRequest);
final ResultCode resultCode = bindResult.getResultCode();
if(resultCode.equals(ResultCode.SUCCESS))
{
  // user is authenticated
}
ldapConnection.close();

代码示例来源: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;
}

相关文章