java 在基础中没有 OU 的 OpenLDAP 上的身份验证给出了无效的凭据
java authentication on OpenLDAP without OU in base gives invalid credentials
我的范围是仅使用
uid=用户,dc=ldap,dc=com。
有了这个基础,我得到以下错误
LDAPException(resultCode=49 (invalid credentials), errorMessage='invalid credentials
')
我可以通过 Java 应用程序成功验证到 OpenLDAP
具有以下基础:uid=User,ou=People,dc=ldap,dc=com。因此无需编写用户所属的多个组织单位。
我还能够在不同的环境中通过 uid=User,dc=com 对 ActiveDirectory 进行身份验证,但不能在 OpenLDAP
上进行身份验证。
- 我错过了
OpenLDAP
上的设置吗?
Java
中有什么东西可以用来解决问题吗?
我更喜欢 JNDI
. 的解决方案
在java中我用了JNDI
和UnboundID来测试。这些是 java 连接设置:
//JNDI Connection
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, url);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "uid=User,dc=com");
env.put(Context.SECURITY_CREDENTIALS, password);
//UnboundID connection
LDAPConnection ldapConnection = new LDAPConnection(ip, 389, "dc=ldap,dc=com", pswrd);
文件ldap.conf:
BASE dc=ldap,dc=com
文件slapd.conf:
suffix "dc=ldap,dc=com";
rootdn "cn=Manager,dc=ldap,dc=com"
Is there a setting on OpenLDAP that I missed?
没有
Is there something in Java that I can use for workaround?
没有。您必须提供完整的 DN。
您始终需要一个完全合格的专有名称。 (除了少数exceptions with Microsoft Active Directory)。
您最好为用户执行搜索 (Some examples )
-吉姆
我的范围是仅使用
uid=用户,dc=ldap,dc=com。
有了这个基础,我得到以下错误
LDAPException(resultCode=49 (invalid credentials), errorMessage='invalid credentials
')
我可以通过 Java 应用程序成功验证到 OpenLDAP
具有以下基础:uid=User,ou=People,dc=ldap,dc=com。因此无需编写用户所属的多个组织单位。
我还能够在不同的环境中通过 uid=User,dc=com 对 ActiveDirectory 进行身份验证,但不能在 OpenLDAP
上进行身份验证。
- 我错过了
OpenLDAP
上的设置吗? Java
中有什么东西可以用来解决问题吗? 我更喜欢JNDI
. 的解决方案
在java中我用了JNDI
和UnboundID来测试。这些是 java 连接设置:
//JNDI Connection
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, url);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "uid=User,dc=com");
env.put(Context.SECURITY_CREDENTIALS, password);
//UnboundID connection
LDAPConnection ldapConnection = new LDAPConnection(ip, 389, "dc=ldap,dc=com", pswrd);
文件ldap.conf:
BASE dc=ldap,dc=com
文件slapd.conf:
suffix "dc=ldap,dc=com";
rootdn "cn=Manager,dc=ldap,dc=com"
Is there a setting on OpenLDAP that I missed?
没有
Is there something in Java that I can use for workaround?
没有。您必须提供完整的 DN。
您始终需要一个完全合格的专有名称。 (除了少数exceptions with Microsoft Active Directory)。
您最好为用户执行搜索 (Some examples )
-吉姆