java ad域 ldap 怎么获取用户和用户组 10C

获取数据的时候有个属性searchFilter,

 String searchFilter = "objectclass=*”

这个是获取所有

 String searchFilter = "objectclass=user”

这个是获取用户,我想问获取用户和用户组怎么写,不要 "objectclass=*”

2个回答

请求大神指导,searchFilter = "objectclass=user || objectClass=organizationalUnit”这么写行吗?

单独获取用户组是啥也行

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
求ldap获取域用户
最近在弄AD域方面的东西,遇到障碍,有一个需求:就是获取当前域的所有域用户账号,求大神帮助呀!
ldap管理AD域用户问题
关于ldap管理AD域用户有两个问题。方便的话可否QQ沟通下(QQ:55754999)[color=#FF0000](紧急)[/color]rn证书已经导入到jdk中,没导入证书前也可以新增用户,是不是修改用户密码一定要导入证书?rn1、新增用户可以,但是是禁用状态的,而且密码也不对。rn2、修改用户密码不成功,异常信息:javax.naming.CommunicationException: simple bind failed: 172.16.5.254:636 [Root exception is javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty]rn at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:197)rn at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2637)rn at com.sun.jndi.ldap.LdapCtx.(LdapCtx.java:283)rn at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)rn at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)rn at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)rn at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)rn at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)rn at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)rn at javax.naming.InitialContext.init(InitialContext.java:223)rn at javax.naming.ldap.InitialLdapContext.(InitialLdapContext.java:134)rn at org.gycv.com.LdapConnectionFactory.getConnectionFromFool(LdapConnectionFactory.java:61)rn at org.gycv.com.LdapConnectionFactory.addUser(LdapConnectionFactory.java:122)rn at org.gycv.com.test.main(test.java:13)rnCaused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-emptyrn at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:166)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1476)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1443)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1426)rn at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:64)rn at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)rn at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)rn at com.sun.jndi.ldap.Connection.writeRequest(Connection.java:390)rn at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:334)rn at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:192)rn ... 13 morernCaused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-emptyrn at sun.security.validator.PKIXValidator.(PKIXValidator.java:56)rn at sun.security.validator.Validator.getInstance(Validator.java:146)rn at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:105)rn at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:167)rn at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320)rn at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:836)rn at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106)rn at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495)rn at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433)falsernrn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:815)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1025)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:619)rn at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)rn ... 18 morernCaused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-emptyrn at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:183)rn at java.security.cert.PKIXParameters.(PKIXParameters.java:103)rn at java.security.cert.PKIXBuilderParameters.(PKIXBuilderParameters.java:87)rn at sun.security.validator.PKIXValidator.(PKIXValidator.java:54)rn ... 30 morernrn
批量导入ad用户到用户组
命令: $Users=Get-Content C:\group\groupusers.txt Add-ADGroupMember -Identity nexus -Members $Users      groupusers.txt文件内容为用户登录名(sAMAccountName),用户名用“逗号”隔开,或者一行放一个用户名即可。 ...
获取 AD域 用户列表
获取 AD域 用户列表获取
java使用ldap修改ad域用户密码
java使用ldap修改ad域用户密码
AD 域单点登陆之 LDAP (二)
官方 API: http://msdn.microsoft.com/en-us/library/windows/desktop/aa746467(v=vs.85).aspx                http://www.iteye.com/problems/67745                http://baike.baidu.cn/view/159263.htm   一...
AD域验证,ldap问题
rnpublic class LdapHelper rnrn private static DirContext ctx;rnrn @SuppressWarnings(value = "unchecked")rn public static DirContext getCtx() rn // if (ctx != null ) rn // return ctx;rn // rn String account = "itwechat"; // binddnrn String password = "t@hcew1T"; // bindpwdrnrn String root = "OU=LIZHI,OU=WX,DC=SOHU-INC,DC=COM"; // rootrn account = "cn=itwechat";rnrn Hashtable env = new Hashtable();rn env.put(Context.INITIAL_CONTEXT_FACTORY,rn "com.sun.jndi.ldap.LdapCtxFactory");rn env.put(Context.PROVIDER_URL, "ldap://Ldap.sohu-inc.com:389/" + root);rn env.put(Context.SECURITY_AUTHENTICATION, "simple");rn env.put(Context.SECURITY_PRINCIPAL, account);rn env.put(Context.SECURITY_CREDENTIALS, password);rn try rn // 链接ldaprn ctx = new InitialDirContext(env);rn System.out.println("认证成功");rn catch (javax.naming.AuthenticationException e) rn System.out.println("认证失败");rn catch (Exception e) rn System.out.println("认证出错:");rn e.printStackTrace();rn rn return ctx;rn rnrn public static void closeCtx() rn try rn ctx.close();rn catch (NamingException ex) rn Logger.getLogger(LdapHelper.class.getName()).log(Level.SEVERE,rn null, ex);rn rn rnrn我在网上看了例子,然后自己写的验证,但是始终是一直连接不上。求大神解救啊。
java验证AD域用户
import java.util.Hashtable;   import javax.naming.Context; import javax.naming.NamingException; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; /** *...
添加AD域用户
rnSet objOU = GetObject("LDAP://OU=management,dc=vdi,dc=com")rnSet objUser = objOU.Create("User","cn=cc")rnobjUser.Put"sAMAccountName","cc"rnobjUser.Setinfornrn这段命令是新创建一个AD用户,这里的域名是vdi.com,用户名为cc,我想问下这个OU是什么,谢谢!
C# 获取AD(域用户)的问题
在C#代码里有这么一段代码rnrn[code=C#]rnDirectoryEntry entry = new DirectoryEntry(path);rnDirectorySearcher searcher = new DirectorySearcher(entry);rnsearcher.Filter = "(objectClass=*)";rnrnsearcher.PropertiesToLoad.Clear();rnSearchResultCollection searchResultCollection = searcher.FindAll();rnrnforeach (SearchResult result in resultCollection)rn if ([color=#FF0000]result.Properties.Contains("samaccountname"))[/color] rn ResultPropertyValueCollection resultValue = result.Properties["samaccountname"];rn if (resultValue != null && resultValue.Count > 0 && resultValue[0] != null)rn rn userName = resultValue[0].ToString();rn rn rnrn[/code]rnrn请问红色那部分表示的是什么意思,获取的是什么的属性?AD里的属性么?
怎么获取AD组里的用户
怎么获取AD组里的用户
LDAP获取AD用户名信息
[code=csharp] private void FindByNTID(string ntid)rn rn DirectoryEntry entry = null;rn tryrn rn using (entry = new DirectoryEntry(string.Format("LDAP://0", Domain)))rn rn entry.RefreshCache();rnrn DirectorySearcher search = new DirectorySearcher(entry);rnrn if (ntid.IndexOf('@') != -1)rn rn search.Filter = string.Format("Mail=0", ntid);rn rn elsern rn search.Filter = string.Format("sAMAccountName=0", ntid);rn rn this.search = search.FindOne();rnrn if (this.search == null)rn rn search.Filter = string.Format("DisplayName=0", ntid);rn this.search = search.FindOne();rn rn rn rn catch rn finally entry.Close(); rn [/code]在本地可以获取AD信息,部署到服务器就不行了。
获取AD域数据 出现错误:LDAP: error code 1
博主在最近一次项目最需要使用AD域同步用户信息时,发现了这个问题 这个问题也就搞了比较久,最后发现问题是在于 所属的位置上有 “/” 斜杠导致 经查阅资料发现,在AD域查询时,斜杠 "/"始终表示的是转义字符,这可把我搞懵逼了 不过还好每个特么字符都有对应的转换格式,如下图: 以下表格是AD域查询对应的特殊字符格式 (该编码是与之十六进制对应的ASCII代码) 符号 编码 符号 编码 符...
AD域证书申请,导入Java密钥库,实现ldap修改AD用户密码
环境:Windows Server 2012 R2 + Active Directory 说明:LDAP 无法直接获取windows Active Directory 用户密码,需要通过一个安全的通道(SSL)。 经过三天的折腾,查阅了无数博客论坛,其中基本都是安装AD证书服务器,或者是跳过申请导出过程(个人觉得这部分很重要,主要是卡在这里),所以特以此博文记录下来,帮助广大猿兄。 以下为服...
如何用java获取AD服务器的域用户列表
请问如何用java获取AD服务器的域用户列表.rnrn前提是不认证.也就是不能先用一个域用户和密码认证上去,然后再去查询有所有的域用户.rnrn
java AD域登陆验证并获取用户属性值
public class ADDemo { /**     * 使用java连接AD域     * @return void       * @throws 异常说明     * @param host 连接AD域服务器的ip     * @param post AD域服务器的端口     * @param username 用户名     * @param password 密码     */ ...
用java如何获取AD域的用户和组的信息,
用java获取AD域中的用户以及组的所有信息
急急急~~~LDAP操作AD域问题
直接上代码请大神指点哈!!!!!!rn[code=java]rnpublic static void main(String[] args) rn String adminName = "cn=Administrator,cn=Users,dc=MCIPT,dc=COM";rn String adminpassword = "Cp1322716";rn rn String keystore = "E:\\openProject\\JDK6\\bin\\sec.keystore";rn String keypassword = "123456";rn System.setProperty("javax.net.ssl.trustStore",keystore);rn System.setProperty("javax.net.ssl.trustStorePassword", keypassword);rn rn String userName = "CN=jack,OU=IT,DC=MCIPT,DC=COM";rn String newpassword = "test";rn rn Hashtable env = new Hashtable();rn env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");rn env.put(Context.SECURITY_AUTHENTICATION,"simple");rn env.put(Context.SECURITY_PRINCIPAL,adminName);rn env.put(Context.SECURITY_CREDENTIALS,adminpassword);rn env.put(Context.SECURITY_PROTOCOL,"ssl");rn String ldapURL = "LDAP://192.168.139.131:636";rn env.put(Context.PROVIDER_URL,ldapURL);rn rn tryrn LdapContext ctx = new InitialLdapContext(env,null);rn ModificationItem[] mods = new ModificationItem[1];rn String newQuotedPassword = "\"" + newpassword + "\"";rn byte[] newUnicodePassword = newQuotedPassword.getBytes("UTF-16LE");rn mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,new BasicAttribute("unicodePwd",newUnicodePassword));rn ctx.modifyAttributes(userName, mods); rn System.out.println(" sss" + userName);rn ctx.close();rn System.out.println("Problem encoding password222: ");rn catch (Exception e) rn e.printStackTrace(); rn rn rn[/code]rn报错信息:rnjavax.naming.CommunicationException: simple bind failed: 192.168.139.131:636 [Root exception is javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset]rn at com.sun.jndi.ldap.LdapClient.authenticate(Unknown Source)rn at com.sun.jndi.ldap.LdapCtx.connect(Unknown Source)rn at com.sun.jndi.ldap.LdapCtx.(Unknown Source)rn at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(Unknown Source)rn at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(Unknown Source)rn at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(Unknown Source)rn at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(Unknown Source)rn at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)rn at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)rn at javax.naming.InitialContext.init(Unknown Source)rn at javax.naming.ldap.InitialLdapContext.(Unknown Source)rn at ldap.Test.main(Test.java:35)rnCaused by: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection resetrn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkEOF(Unknown Source)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkWrite(Unknown Source)rn at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)rn at java.io.BufferedOutputStream.flushBuffer(Unknown Source)rn at java.io.BufferedOutputStream.flush(Unknown Source)rn at com.sun.jndi.ldap.Connection.writeRequest(Unknown Source)rn at com.sun.jndi.ldap.Connection.writeRequest(Unknown Source)rn at com.sun.jndi.ldap.LdapClient.ldapBind(Unknown Source)rn ... 12 morernCaused by: javax.net.ssl.SSLException: java.net.SocketException: Connection resetrn at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(Unknown Source)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(Unknown Source)rn at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)rn at java.io.BufferedInputStream.fill(Unknown Source)rn at java.io.BufferedInputStream.read1(Unknown Source)rn at java.io.BufferedInputStream.read(Unknown Source)rn at com.sun.jndi.ldap.Connection.run(Unknown Source)rn at java.lang.Thread.run(Unknown Source)rnCaused by: java.net.SocketException: Connection resetrn at java.net.SocketInputStream.read(Unknown Source)rn at com.sun.net.ssl.internal.ssl.InputRecord.readFully(Unknown Source)rn at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.waitForClose(Unknown Source)rn at com.sun.net.ssl.internal.ssl.HandshakeOutStream.flush(Unknown Source)rn at com.sun.net.ssl.internal.ssl.Handshaker.kickstart(Unknown Source)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.kickstartHandshake(Unknown Source)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)rn at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)rn ... 6 morernrn说明:rnenv.put(Context.SECURITY_PROTOCOL,"ssl");注释掉 端口改成389可正常链接但报错LDAP: error code 53 - 0000001F: SvcErr: DSID-031A12D2//需要SSL安全连接修改密码!!!
Java AD域插入用户和密码修改
配合本人AD域证书导入的配置博客,本代码为AD域用户插入和密码修改
怎么获取域用户的登录名
怎么通过程序获取所有域用户的登陆账号(是登陆账号不是显示的用户名)
java怎么获取LDAP的dn?
java怎么获取LDAP的dn?
关于LDAP 登陆,和获取用户组集合的一些问题.
[img=https://img-bbs.csdn.net/upload/201507/14/1436844137_454433.png][/img]rn这是我做的登陆,在object obj = entry.NativeObject;这一步的时候显示服务器无法操作,在正式服务器上面是可以正常登陆的,但是在本地和测试服务器上面就显示服务器无法操作了,我想请问一下是什么问题. rnrn还有我这边大概需要做一个获取域内所有用户的集合,我想请教一下怎么写代码,求各位路过的大神帮忙解答,谢谢各位了
单点登录、域用户、常规登录、AD域
我是把CSDN博客当笔记使的,以前总结过不知道放在哪里了,好郁闷。 仅限于基础 1、单点登录 (1)啥是单点登录? 用户只需要登录一次就可以访问所有相互信任的应用系统。(Single Sign On,简称为 SSO) (2)解决啥问题? 各个server拿到同一个ID,都能有办法检验出ID的有效性、并且能得到ID对应的用户信息。 (3)咋实现? 实现步骤: 登录...
AD域,C程序实现域用户验证
怎么程序实现本地计算机的AD域用户在域认证服务器上实现认证。rn我试了ADsOpenObject,但返回0x8007203a错误。rn有大神知道怎么弄吗?最好贴代码。
AD域用户导入问题
AD服务器上有多个组,其中一个Dep组里都是正常账号,另一个Other组里是一些过期或停用的账号,在MOSS中配置用户导入的时候如何设置才能只导入Dep组里的正常账号呢?rn
c# 操作ad域用户
测试环境:win2008r2服务器 ad域服务器安装参考:https://www.cnblogs.com/cnjavahome/p/9029665.html 密码策略修改参考:https://blog.csdn.net/zouyujie1127/article/details/40857675 工作机dns设置为ad域服务器的ip using: using System.DirectoryServ...
AD域用户密码修改(SSL)
使用ssl keystore 证书修改AD域用户密码
AD域用户照片显示
首先,我们先来打开一个用户选项卡,看看各选项  里面没有任何设置照片的地方 接下来我们使用到一个工具,下载地址:http://www.dewdney.co.uk/adext/adext.zip 把它下载出来放到C盘(任意目录),执行命令如下图所示:   卸载命令只需在安装命令后跟一个-u选项...
AD域 批量增加用户
使用批处理方式增加域人员信息,方便实用,其中有邮件地址的增加。
java通过ldap访问AD
需要用域用户名和密码登陆项目,这个需要使用ladp访问AD进行验证,大概代码网上很多但没有试成。[code=java]public class Dmoe3 rn public static void main(String[] args) rn String userName = "test@xxx.com"; // 用户名称rn String password = "123123"; // 密码rn String host = "192.168.0.1"; // AD服务器rn String port = "389"; // 端口rn String url = new String("ldap://" + host + ":" + port);rn Hashtable env = new Hashtable();rn DirContext ctx;rn env.put(Context.SECURITY_AUTHENTICATION, "simple");rn env.put(Context.SECURITY_PRINCIPAL, userName);rn env.put(Context.SECURITY_CREDENTIALS, password);rn env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");rn env.put(Context.PROVIDER_URL, url);rn try rn ctx = new InitialDirContext(env);rn ctx.close();rn System.out.println("验证成功!");rn catch (NamingException err) rn err.printStackTrace();rn System.out.println("验证失败!");rn rn rn[/code]rn[code=java]public class Demo2 rn public LdapContext getConnectionFromFool() throws NamingException rn String keystore = "D:/soft02/JDK/jre/lib/security/cacerts";rn System.setProperty("javax.net.ssl.trustStore", keystore); rn Properties env = new Properties(); rn env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); rn env.put(Context.PROVIDER_URL, "ldap://192.168.0.1:389"); rn env.put(Context.SECURITY_AUTHENTICATION, "simple"); rn env.put(Context.SECURITY_PRINCIPAL,"cn=test@domain.com"); rn env.put(Context.SECURITY_PRINCIPAL,"cn=administrator,cn=Users,dc=all,dc=com"); rn env.put(Context.SECURITY_CREDENTIALS, "123123"); rn env.put(Context.SECURITY_PROTOCOL, "ssl"); rn env.put("com.sun.jndi.ldap.connect.pool", "true"); rn env.put("java.naming.referral", "follow"); rn InitialLdapContext dcx = null;rn dcx = new InitialLdapContext(env, null);rn return dcx;rn rn rn[/code]rnrn这两段代码都报javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1异常。我估计是证书不正确或env.put(Context.SECURITY_PRINCIPAL,"cn=administrator,cn=Users,dc=all,dc=com"); 这个写法不正确。不知道怎么弄了,谁做过的看看啊!
如何判断一个AD域的用户是不是AD域管理员?
谢谢
Java连接AD域
1. 获取连接,验证用户名和密码是否合法 /** * 使用java连接AD域 * @throws 异常说明 * @param host 连接AD域服务器的ip * @param post AD域服务器的端口 默认389 * @param username 用户名 需要带域,如:h3c\\x12355或x12355@h3c.huawei-3com.com * @param pa...
用JAVA刺穿LDAP (一)-- java添加AD用户
//建立LDAP服务器的连接 package com.prime.mypackage; import java.io.File; import java.io.FileInputStream; import java.util.Hashtable; import java.util.Properties; import javax.naming.Context...
怎么找不到域里的用户组
环境描述:rn 域(TM-domain)下的组(TMGroup)的一台电脑(Mili),win2000 server +sql2000标准版rn此域有Tmgroup组和TWGroup二个组rn其中tmgroup组有tm01,tm02,tm03...几个用户rnrn我用sa 进入服务器===>>安全===>>登录===>新增用户===>>浏览 却不见我所在组的组名或winnt下的用户名,只有我sql服务器下预设的用户.rn而我在我的电脑里共享文件夹时却又能看到winnt 下的用户名.rnrn请各位大侠赐教:rnrn
java ad域操作
java对ad域的一些操作,里面的一些ip要进行一些修改就能用
java通过ldap协议对ad域进行增删改查
物超所值,也是突然接了这么个东西,无文档,无经验,网上介绍也少。然后硬着头皮做了,包含组织的增删改,用户的增删改还有特定用户的查询。保证能用。报53代号的请确保自己的服务器设置正确。
Java Ldap管理AD域(添加用户时设置用户权限、修改密码)
[b]需求:[/b]用Java Ldap管理AD域(添加用户时设置用户权限、修改密码)rnrn[b]已解决问题:[/b]1、AD服务器部署在阿里云主机,外网可访问;rn 2、用389端口可添加用户,修改用户属性,删除用户,查找用户;rn 3、AD服务器SSL用Ldap admin客户端工具能连接上;rn rn[b]存在的问题:[/b]1、用389端口添加用户时,2个属性不能设值(userAccountControl和userPassword) ;rn 不管userAccountControl的值设置多少,都会直接报错;rn unicodePwd按照网上的例子,直接报错;rn [quote]String pwd = "\"" +password() + "\""; rn byte[] newUnicodePassword = pwd.getBytes("UTF-16LE");rn attr.put("unicodePwd" , newUnicodePassword.toString());[/quote]rnrn 2、用636端口添加用户时,直接报错。rn 已用Java工具把服务器导出来的cert文件导入Java环境(xxx:/Java/java8/jre/lib/security/cacerts)rn 错误信息: rn javax.naming.CommunicationException: simple bind failed: 192.168.0.199:636 [Root exception is javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.g: No trusted certificate found]rn[b]请做过或是了解的同胞救助,私信联系也可[/b](有报酬)。
LDAP怎样获取AD域中指定组的所有用户
public DataSet GetUsersForGroup(string GroupName)rn rn //if (GroupName.IndexOf(';') > 0)rn //rn // return GetUsersForGroup(GroupName.Split(new char[] ';' ));rn //rn if (GroupName == string.Empty) return null;rn tryrn rn DirectoryEntry dir = GetDirectoryObject();rn dir.RefreshCache();rn DirectorySearcher ds = new DirectorySearcher(dir);rn ds.Filter = "(&(objectClass=group)(cn=" + GroupName + "))";rn ds.PropertiesToLoad.Add("memberof");rn SearchResult results = ds.FindOne();rn DataSet dsUser = new DataSet();rn DataTable tbUser = dsUser.Tables.Add("Users");rn tbUser.Columns.Add("GroupName");rn tbUser.Columns.Add("samaccountname");rn tbUser.Columns.Add("UserName");rn tbUser.Columns.Add("DisplayName");rn tbUser.Columns.Add("EMailAddress");rn tbUser.Columns.Add("primaryGroupID");rn if (results != null)rn rn DirectoryEntry deGroup = new DirectoryEntry(results.Path, _ADUser, _ADPwd, AuthenticationTypes.Secure);rn System.DirectoryServices.PropertyCollection pcoll = deGroup.Properties; rn int n = pcoll["member"].Count;rn for (int i = 0; i < n; i++)rn rn DirectoryEntry deUser = new DirectoryEntry(_ADPath + "/" + pcoll["member"][i].ToString(), _ADUser, _ADPwd, AuthenticationTypes.Secure);rn tryrn rn DataRow rwUser = tbUser.NewRow();rn rwUser["GroupName"] = GroupName;rn rwUser["samaccountname"] = GetProperty(deUser, "samaccountname");rn rwUser["UserName"] = GetProperty(deUser, "cn");rn rwUser["DisplayName"] = GetProperty(deUser, "givenName") + " " + GetProperty(deUser, "sn");rn rwUser["EMailAddress"] = GetProperty(deUser, "mail");rn rwUser["primaryGroupID"] = GetProperty(deUser, "primaryGroupID");rn tbUser.Rows.Add(rwUser);rn deUser.Close();rnrnrn rn catch (System.Exception ex)rn rn throw ex;rn rn rn dir.Close();rn deGroup.Close();rn rn if (dsUser.Tables[0].Rows.Count <= 0)rn rn DataRow rwDefaultUser = tbUser.NewRow();rn rwDefaultUser["GroupName"] = GroupName;rn rwDefaultUser["samaccountname"] = "(Not Specified)";rn rwDefaultUser["UserName"] = "(Not Specified)";rn rwDefaultUser["DisplayName"] = "(Not Specified)";rn rwDefaultUser["EMailAddress"] = "(Not Specified)";rn rwDefaultUser["primaryGroupID"] = "(Not Specified)";rn tbUser.Rows.Add(rwDefaultUser);rnrn rn return dsUser;rn rn catch (System.Exception ex)rn rn throw ex;rn rnrn rnrn这段代码 我成功获得了此组中的用户,但不是所有的。rn假设a、b两个用户,admin、user两个组,我设置a、b都是这两个组的成员。a、b的主要组都是admin,搜索user组,2个用户都显示出来。rna的主要组为user,b为admin,搜索user组,只显示b用户。a、b主要组都为user,搜索user组,2个用户都不显示出来。rn也就是说,搜索X组,该组成员的主要组设置为X组,就不会显示出来。rn那我该怎么写,才能获得所有用户呢?
如何获取AD用户?
我的 PC 在一个域上,我能否读取这个域的所有用户列表并bind到GridView里?
如何获取AD用户
当前web程序是基于Form验证的rn现在要做一个功能,当客户端用户开机进入window时已经从域中登陆rn当用户访问web时判断是否域中用户,如果是,则直接进入web程序rn否则,跳到Form验证的登陆页rnrn要怎样实现上面功能,请高手详细说明rn现在问题是在Form验证的登陆页中获取不了客户端的当前用户window账号信息
相关热词 c# 线程结束时执行 c# kb mb 图片 c# 替换第几位字符 c#项目决定成败 c# 与matlab c# xml缩进 c#传感器基础 c#操作wps c# md5使用方法 c# 引用父窗口的组件