问题标签 [spring-ldap]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2627 浏览

spring-ldap - Spring嵌入式LDAP得到错误:“服务器没有返回模式信息,使用默认模式”

我使用 spring-security-ldap 的 ApacheDSContainer 类启动了一个嵌入式 LDAP 服务器,在导入 LDIF 后,我尝试使用 Apache Directory Studio 连接 LDAP 服务器。然后会弹出一个错误:

如果我忽略错误,所有功能都可以正常工作

0 投票
1 回答
423 浏览

openldap - 跟踪 LDAP 中已删除的记录

我们使用 OpenLDAP 2.3 来存储联系人。

我们使用 Spring LDAP 构建了一个 java 项目来每周导出联系人。在导出文件中,我们标记是否新添加了联系人或修改了现有联系人。这工作正常。问题是在 LDAP 中删除联系人时。删除联系人时,会在 LDAP 中删除整个记录。

LDAP 中有没有办法跟踪已删除的记录?

0 投票
2 回答
5986 浏览

java - 区分 InvalidAttributeValueException 的原因

我试图通过InvalidAttributeValueException实例确定 LDAP 错误代码 19(密码策略错误)的原因是什么,因此我将能够在 UI 中显示信息性错误消息。

我正在使用的当前 LDAP 服务是 openLDAP(作为应用程序中的嵌入式 LDAP),它提供了一个非常有用的信息,足以显示(即"[LDAP: error code 19 - Password fails quality checking policy]"& "[LDAP: error code 19 - Password is in history of old passwords]"

但是现在我想支持 Active Directory 和其他 LDAP 提供程序(这将是外部的),并且从我在 rfc2251 和其他各种来源中看到的内容来看——每个实现都有自己的异常消息,唯一的标准是错误代码 19映射到InvalidAttributeValueException 而不是特定问题。

是否有解决方案(甚至是部分解决方案)来区分错误代码 19 的不同原因?给定一个InvalidAttributeValueException实例,有没有办法查询 LDAP 以获取该问题的答案?

谢谢

0 投票
1 回答
2279 浏览

ldap - Spring LDAP ODM - 条目类应声明为最终警告

我有一个Entry使用 Spring LDAP ODM 的映射(“实体”)。当我使用这个类运行单元测试时,我会在初始化时在控制台中收到警告:

映射的类如下所示:

我无法通过 Google 搜索找到与此警告相关的任何内容。这是记录它的 Spring 代码:

任何见解将不胜感激。我知道将一个类声明为 final 意味着它不能被扩展,但是 Spring ODM 为什么会关心呢?

0 投票
3 回答
7253 浏览

spring - Spring Security LDAP 和 MD5 哈希密码

我正在尝试使用 LDAP 访问我的项目。它成功提示输入用户名和密码,但将正确的凭据放入其中会再次导致提示弹出(似乎凭据错误,但事实并非如此)。

这是我的 security-context.xml:

密码存储为 {MD5}hash... 我使用的是 jsr 250 api。

编辑:@TobyHobson 这导致org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 38; cvc-complex-type.2.4.a: Invalid content was found starting with element 'password-encoder'. One of '{"http://www.springframework.org/schema/security":password-compare}' is expected.

EDIT2:@TobyHobson似乎可以编译,但它仍然拒绝我的正确凭据password-comparepassword-encoder

EDIT3:这里是必要的日志:

EDIT4:我想这与 jsr 250 api 和组/角色有关。这是我的ldif:

@RolesAllowed({ Role.ROLE_ADMIN, Role.ROLE_MANAGER, Role.ROLE_VIEWER })在我的控制器中使用,这是我的抽象角色类:

0 投票
2 回答
10863 浏览

java - Can I change myself Active Directory password from LDAP (without administrative account)

I don't (and will not) have administators account. I want to change myself (user) password in Active Directory from java. How can I do this?

Using code from web:

here is the contextSource

I got:

if I change userDn to "cn=smith" I got:

LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error

Maybe my problem is that I do not understand how is LDAP working? Is it possible (change user password by using user-account) or not? And, if it is possible, can I check account locked / expires with same privileges?

UPDATE / RESOLVE

thank you very match for your help. That was very helpful too me.

for future searchers:

NO_OBJECT - means that ACtive Directory cannot find object (my cn=Users,cn=Smith) To find fully qualified canonical path to user catalogue you can use user attribute "distinguishedName" (in my, worstest case it is "cn=John\, Smith",ou=Contractors,ou=User Accounts,ou=Accounts")

then I got:

WILL_NOT_PERFORM - this can mean different type of things. In my case there was wrong object type, but, possible other cases, as described below - not SSL connection (not ldaps://), and others.

then:

INSUFF_ACCESS_RIGHTS - user (not administrator doesn't have right to REPLACE-password attribute), to change password he must enter old password and new password, and then REMOVE old and ADD new.

problem 1005 (CONSTRAINT_ATT_TYPE) - if old password wrong

btw

javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name '/' - when searching person/user global (for example, in authenticate-method) ldapTemplate.setIgnorePartialResultException(true); can fix it

0 投票
2 回答
24253 浏览

java - Spring 3.1 LDAP 身份验证过程:凭据良好时的“错误凭据”消息

春天 3.1 雄猫 6.*

我正在制作一个 Spring 3.1 webapp,使用 LDAP 进行身份验证。

我使用我编写的 JNDI 风格的 Java 程序(引用如下)测试了 LDAP 凭据(用户名、密码、ldap URL、搜索模式)。该程序有效,转储了所有用户属性,包括密码,这似乎是在 LDAP 服务器上加密的。

当我尝试在 Spring 3.1 中使用相同的凭据登录时,我收到错误消息“Bad Credentials”。

我在日志中收到此消息:

在我的 *-security.xml 中,我尝试使用标签进行密码比较和编码,但没有帮助。我尝试使用 md4,md5,plaintext,sha,sha-256,{ssha},{sha} 无济于事。

我的网络小组是一个庞大、缓慢、官僚主义的组织。有没有一种方法可以告诉他们使用什么编码(如果有的话),而无需联系他们?

关于我可以检查的事情的任何想法?

这是我上次尝试时的 *-security.xml 以及我能够连接的 java LDAP 演示

谢谢。

我的 *-security.xml 文件:

这是使用相同凭据工作的 JNDI 样式 LDAP Java 程序:


解决方案


Luke Taylor 的这条评论帮助我让我的配置正常工作:

您的配置错误,因为您在 LDAP 服务器 URL 中有“o=acme.com”,并且还在用户 DN 模式中使用了“o=acme.com”。

我从 DN 模式中去掉了“o=acme.com”,并且 LDAP 起作用了。我最初在 LDAP URL 和 DN 模式中都添加了“o=acme.com”,因为我是 Spring 3.1 和 LDAP 的新手,这类似于 Java JNDI 版本的 LDAP我根据要替换的遗留代码编写的演示。

这是我的 *-security.xml 的最终工作版本

我将探讨他的其他评论,看看我是否可以重新输入密码编码或是否需要。

0 投票
1 回答
1321 浏览

spring-ldap - Tomcat 上自定义 LdapContextSource 实现的 javax.naming.NotContextException

我正在使用 Spring-ldap 连接池和 contextSource 的自定义实现,以使用 Oracle Internet Directory API 进行连接。这在 Eclipse 上独立测试时有效。但是,当部署在 tomcat 上时,它会因“不是 DirContext 的实例”而失败。如果我使用 Spring 中的 LdapContextSource,它工作正常 [但我的一些操作失败并使用 OID API 的上下文] 感谢任何帮助。下面是配置和代码

0 投票
1 回答
1001 浏览

spring-mvc - LDAP CRUD 与 Spring Roo

目前正在使用 Spring Roo 构建系统。可以使用带有 Spring Security 的 LDAP 服务器登录。但无法理解如何使用 Spring Roo 配置 LDAP CRUD。

Roo 自动生成 MVC。从这里开始,我想得修改contoller,applicationContext.xml,Entity classes roo 自动生成。如果有人知道,请告诉我。

谢谢,

0 投票
2 回答
1124 浏览

java - Spring LDAP 事务管理器

关于 Spring 的事务回滚,我有一个令人困惑的场景。

我成功地创建了一个新用户,将其添加到一个组并分配了一个角色,但是当我尝试测试事务回滚以查找“用户已存在”等异常时,我遇到了我的问题。

因此,当我尝试创建现有用户时,Spring 触发了一个异常并启动了回滚操作,但是没有任何反应,并且该用户仍保留在用户列表中。

我的问题是,我应该创建回滚方法,还是应该由 spring 代表我处理。

我在文档中花了很多时间,但我有点挣扎,因为我有点像 Spring / LDAP 新手

提前致谢

伊恩