Tag: active directory

我可以从LDAP更改自己的Active Directory密码(没有管理帐户)

我不(也不会)拥有管理员帐户。 我想从java更改Active Directory中的自己(用户)密码。 我怎样才能做到这一点? 使用来自网络的代码: private void changePass() throws Exception { String oldpass = this.encodePassword(“oldpass!”); String newpass = this.encodePassword(“newpass!”); Attribute oldattr = new BasicAttribute(“unicodePwd”, oldpass); Attribute newattr = new BasicAttribute(“unicodePwd”, newpass); ModificationItem olditem = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, oldattr); ModificationItem newitem = new ModificationItem(DirContext.ADD_ATTRIBUTE, newattr); ModificationItem repitem = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, newattr); ModificationItem[] mods = new ModificationItem[2]; mods[0] […]

如何在JBoss中配置SQL Server数据源以使用特定的Active Directory用户进行连接?

JBoss作为Active Directory用户ABC\appuser 。 我想以AD用户ABC\dbuser连接到MS SQL Server 8.0数据库。 使用参数integratedSecurity=true ,除非我在连接URL上指定user=ABC\dbuser;password=dbpass ,否则系统将尝试连接为服务AD用户ABC\appuser 。 根据这个问题 ,我已经确认通过使用以下url,当以ABC\appuser运行应用程序时,我可以作为ABC\dbuser连接到数据库: jdbc:sqlserver://MYHOSTNAME:1433;DatabaseName=MyDatabaseName;integratedSecurity=true;user=ABC\dbuser;password=dbpass 不幸的是,当我在JBoss配置xml( JBoss\jboss-eap-6.1.0\standalone\configuration\standalone.xml )中设置数据源的url时,如下所示: jdbc:sqlserver://MYHOSTNAME:1433;DatabaseName=MyDatabaseName;integratedSecurity=true;user=ABC\dbuser;password=dbpass sqlserver 1 10 true 我无法使用此警告创建池资源: WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: javax.resource.ResourceException: Could not create connection 设置user-name和password XML条目的值会创建类似的故障警告。 我目前的解决方案选项似乎是以下任何一种: 扩展JBoss用于创建此数据源的任何类,将其替换为按预期应用connection-url值的自定义类或 将JBoss改为ABC\dbuser或 通过直接访问或将其添加到具有访问权限的AD组,为JBoss服务用户ABC\appuser数据库访问提供访问权限。 这些变通办法都不是优选的; 必须有一个更优雅,被接受的解决方案。 我该如何解决这个问题?

带有Active Directory的JNDI PartialResultException

我基本上是在Active Directory中走LDAP树。 在每个级别,我查询”(objectClass=*)” 。 当我在根上执行此操作,例如”dc=example,dc=com”我会得到以下exception。 这适用于我们的其他LDAP实例。 出于某种原因,仅在我们的Active Directory服务器上,我得到此exception。 在Active Directory服务器上使用JXplorer时,我也会遇到相同的exception。 从网上阅读我发现有人说你应该打开以下,不知道这意味着什么…所以在我通过查询传递的控件对象( javax.naming.directory.SearchControls )我调用searchControls.setDerefLinkFlag(true) 。 我也尝试将其设置为false ,结果相同。 关于还有什么可能导致这个问题的任何建议? 也许我怎么能解决它? 注意:在这篇文章中,我将baseDn从dc=更改为我公司隐私的示例。 javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name ‘dc=example,dc=com’ at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2820) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2794) at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1826) at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1749) at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:338) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:321) at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:248) at com.motio.pi.gui.panels.useraccess.ldap.LDAPConnector.query(LDAPConnector.java:262) at com.motio.pi.gui.selector.directory.CognosDirectoryBrowserController.expandCognosTreeNode(CognosDirectoryBrowserController.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) […]

使用JNDI / Java中的当前用户在LDAP上进行身份validation

我以为我会发现更多关于这个话题,但我没有。 我必须编写一个java应用程序来检查特定用户是哪个用户。 但是要对服务器进行身份validation,我不能要求输入用户名和密码,也不能将其存储在源(或其他文件)中。 有没有办法让JNDI和Java与当前登录的用户进行身份validation?

Java LDAP – 将组添加到用户问题 – 错误代码53 – WILL_NOT_PERFORM

我正在尝试将用户添加到Active Directory中。 记住: 使用SSL 证书好 密码工作正常 使用组关联,可以正确创建用户。 当我尝试将用户关联到组时,我收到以下错误: javax.naming.OperationNotSupportedException:[LDAP:错误代码53 – 0000209A:SvcErr:DSID-031A1021,问题5003(WILL_NOT_PERFORM),数据0 我使用了DN和NAME组属性,但都没有用。 我的代码是: ctx = getContext(); ctx.createSubcontext(entryDN,entry); // it works fine Attribute memberOf1 = new BasicAttribute(“memberOf”,”NAME_OF_THE_GROUP”); Attributes atts = new BasicAttributes(); atts.put(memberOf1); ctx.modifyAttributes(entryDN, LdapContext.ADD_ATTRIBUTE, atts); // ## it doesn’t work 我尝试了LdapContext.ADD_ATTRIBUTE和LdapContext.REPLACE_ATTRIBUTE。 此外,我尝试添加具有其他属性的组,但所有情况都给了我相同的错误。 有谁知道发生了什么事? 干杯!

使用Spnego解密kerberos票

我正在使用spnego( http://spnego.sourceforge.net )在JBoss下进行kerberos身份validation。 我需要解密kerberos票证才能访问包含PAC数据的授权数据。 需要PAC数据来决定将哪些角色授予用户。 如何访问和解密kerberos票? 我搜索网上的例子,但没有努力。

用户解锁后,Windows机器上的Kerberos缓存票证无法重新生成

我有一个java服务器和客户端应用程序。 这些应用程序正在使用Windows机器。 客户端使用kerberos身份validation登录服务器。 它是使用jgssapi实现的。 首先,客户端从系统检索存储的缓存tgt票证以从kdc生成令牌。 问题是 – 在Windows中锁定用户会话(锁定屏幕或更改用户)后,系统中没有缓存的tgt票证(由C:\ Windows \ System32 \ klist.exe检查)。 据我所知,我可以通过注销/登录计算机上的用户来获取它们。 在客户机器上发生了这个问题。 锁定后,会有空的缓存票据列表。 它没有在我的办公室复制(客户端使用Windows 7,win server 2008上的活动目录服务器)。 锁定后,我总是在机器上有新的REGENERATED缓存tgt票证(在锁定之前不是从工作开始,但是在解锁后它们再次生成)。 没有为此行为设置特殊GPO(有关使用先前用户会话使用缓存票证的问题,使用Windows锁定屏幕后删除Kerboros缓存票证 )。 所以我不明白为什么系统在解锁后不重新生成缓存的tgt? 怎么做? 我在这里找到了类似的问题https://social.technet.microsoft.com/Forums/ie/en-US/be5ebc3b-d915-4acb-a9ae-67c61ee03b97/service-tickets-kerberos-purged-on-ctrlaltdel?forum= winserverDS&prof = required其中一个答案是“首先看看你对klist有什么,然后锁定并解锁你的屏幕。如果你有一个连接到DC的你将获得一张服务票给你的本地主机和KDC和TGT,如果你没有连接,你将什么都没有。“ 与AD的连接成功。 我可以ping它。 我可以使用AD-explorer获取信息。 或者与DC的连接不一样? 谢谢。

通过Java执行ADS相关的Powershell命令在使用2种不同方式时不会产生2种不同的错误

我一直试图通过java在PowerShell会话中执行一组命令,但没有运气。 我的目标是使用domain =“domain.com”在AD中搜索计算机对象。 我从一个命令开始。 不幸的是,以下命令在我的powershell提示符中成功运行: Get-ADComputer -Filter { Name -like “hostname” } –Server abcd:3268 -SearchBase ‘DC=domain,DC=com’ | FT DNSHostName # hostname is actual hostname provided by user and accepted in argument of Java methods # abcd is the IP-Address of my domain controller, and I’m trying to search a computer object in AD with the […]

无法从Java获得与AD的连接

我正在尝试从MS AD中检索一些信息:特定分支的成员,部门名称,职位等 。 我使用了很多例子,包括Apache Directory LDAP API和UnboundID ,但是我无法与AD建立连接。 RDN的: C:\Users\Aleksey> whoami /fqdn CN=my common name here, OU=my organization unit here, OU=organization unit 2 here, OU=organization unit 1 here, OU=main organization unit here, DC=.my domain here, DC=domain 2 here, DC=main domain here 对于搜索,我使用以下filter: public class LdapRetriever { public static void main (String[] args) { Hashtable env […]

使用LDAP / Java启用Active Directory用户

我正在尝试使用LDAP和Java(1.4)在Active Directory中启用用户。 但是我一直收到以下错误: com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapCtx.java:1432)中的com.un.jndi.toolkit.ctx.ComponentDirContext.p_modifyAttributes(ComponentDir Context.java:255)中的java.lang.NullPointerException位于javax.naming.directory.InitialDirContext.modifyAttributes的com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(Partial CompositeDirContext.java:161)中的.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(Partial CompositeDirContext.java:172) (InitialDirContext。java:146)at.ideal.LDAP.newuser.main(newuser.java:61)线程“main”中的exception 我已经确认我的用户有密码,我似乎无法将其状态更改为活动状态 我的代码: public static void main(String[] args) { String userName = “cn=Albert Einstein,ou=Accounts,DC=PORTAL,DC=COMPANY,DC=BE”; String groupName = “cn=Administrators,cn=Roles,DC=PORTAL,DC=COMPANY,DC=BE”; boolean isDisabled = false; try { System.out.println(“Creating initial directory context…”); LdapContext ctx = new InitialLdapContext(X_Ldap.getEnvironment(), null); Attributes attrs = new BasicAttributes(true); attrs.put(“objectClass”, “user”); attrs.put(“cn”, “Albert Einstein”); String newQuotedPassword = “\”Pass123\””; […]