-1
我想知道如果有retirieve連接的LDAP服務器類型(OpenLDAP或Active Directory)Retrive LDAP服務器類型
這個我下面的連接方法
public DirContext ldapUserConnect(String serverUrl, int serverPort, String serverType, String userDn,
String userPassword, boolean binaryAttribute) throws NamingException {
// connect to ldap server using ldap_server table data
if ((userDn != null && !userDn.isEmpty()) || (userPassword != null && !userPassword.isEmpty())) {
Map<String, String> environment = getLdapEnvironement(serverUrl, serverPort, serverType, binaryAttribute);
// connect with user account
environment.put(javax.naming.Context.SECURITY_PRINCIPAL, userDn);
environment.put(javax.naming.Context.SECURITY_CREDENTIALS, userPassword);
return new InitialDirContext((Hashtable<String, String>) environment);
} else {
return null;
}
}