- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
<分区>
下面的代码工作正常:
public static void main(String[] args) {
String userName = "admin";
String password = "s3cret";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://192.168.10.45:389/dc=softwaredev,dc=local");
//env.put(Context.SECURITY_PROTOCOL, "ssl");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, new String("softwaredev" + "\\" + userName));
env.put(Context.SECURITY_CREDENTIALS, password);
DirContext ctx = null;
NamingEnumeration results = null;
try {
ctx = new InitialDirContext(env);
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
results = ctx.search("", "(objectclass=person)", controls);
while (results.hasMore()) {
SearchResult searchResult = (SearchResult) results.next();
Attributes attributes = searchResult.getAttributes();
System.out.println(" Person Common Name = " + attributes.get("cn"));
System.out.println(" Person Display Name = " + attributes.get("displayName"));
System.out.println(" Person logonhours = " + attributes.get("logonhours"));
System.out.println(" Person MemberOf = " + attributes.get("memberOf"));
}
} catch (Throwable e) {
e.printStackTrace();
} finally {
if (results != null) {
try {
results.close();
} catch (Exception e) {
}
}
if (ctx != null) {
try {
ctx.close();
} catch (Exception e) {
}
}
}
}
如果我取消注释以下行:env.put(Context.SECURITY_PROTOCOL, "ssl");
启用 SSL 连接并使用此 URL:
ldaps://192.168.10.45:636
然后程序失败,错误是关于证书的。
*javax.naming.CommunicationException: simple bind failed: 192.168.10.45:636 [Root exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]
at com.sun.jndi.ldap.LdapClient.authenticate(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.connect(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.<init>(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(Unknown Source)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at javax.naming.directory.InitialDirContext.<init>(Unknown Source)
at asd.LdapBasicExample.main(LdapBasicExample.java:25)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at sun.security.ssl.AppInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.sun.jndi.ldap.Connection.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
at sun.security.validator.Validator.validate(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
... 13 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
at java.security.cert.CertPathBuilder.build(Unknown Source)*
那么,我该怎么做才能解决这个问题呢?
我们正在构建一个新的库,它需要对我们的主要身份管理 LDAP 系统进行读/写。 我们正在考虑使用 Spring LDAP ( http://projects.spring.io/spring-ldap
在 LDAP 身份验证的情况下, 是什么?参数 一般用于身份验证 .我想对于通过 ldap 登录的用户来说,使用 DN 会很头疼,因为它太大而无法记住。 使用 uid 或 sAMAccountName
我知道 LDAP 用于提供一些信息并帮助促进授权。 但是 LDAP 的其他用途是什么? 最佳答案 我将重点讨论为什么使用 LDAP,而不是 LDAP 是什么。 使用模型类似于人们使用借书卡或电话簿的方
我正在尝试查询 LDAP 服务器以获取使用 ruby 的 net-ldap 库的任何组的详细信息 require 'rubygems' require 'net/ldap' username =
在使用 spring ldap 模板的 Ldap 搜索中,我返回一个 User 对象,该对象具有保存另一个用户的 dn 的属性之一。并且,User 对象有一些属性需要使用其他用户的 ldap 条目获取
我正在尝试使用例如search_s函数根据对象的完整可分辨名称搜索对象,但我觉得这并不方便。例如, search_s('DC=example, DC=com', ldap.SCOPE_SUBTREE,
LDAP 查询如何工作:-(我)。 Windows Powershell(二). Java JNDI(三)。 SpringLDAP 上述 3 种方法中的 LDAP 筛选器查询是否仅搜索前 1000 条
我们正在使用 spring security 在我们的应用程序中对来自 LDAP 的用户进行身份验证。认证部分工作正常,但授权部分不工作。 我们无法从 LDAP 中检索用户的角色。 来自本书 《 Sp
这个问题在这里已经有了答案: Does the LDAP protocol limit the length of a DN (3 个回答) 关闭8年前。 DN 是否有最大长度?如果我想将它们存储在数
我知道我的谷歌搜索技能让我失望了,因为那里有 必须是这样的:一个简单、易于使用的远程托管目录服务(更好的是,通过几个不同的接口(interface)和 SSO 公开用户目录)。 你知道一个和/或有一个
我有一个使用 JSF 2.1 和 JEE 6 设置的 Web 应用程序,该应用程序在 WebLogic 12.1.2 服务器上运行,并带有用于身份验证的 openLDAP。我一直注意到在应用程序中加载
我的应用程序每天执行一次 LDAP 查询并获取给定容器中的所有用户和组。获取后,我的应用程序将遍历组的用户列表,仅将新用户添加到我的应用程序数据库中(它仅添加用户名)。 如果有 50,000 个用户,
我正在尝试解决一个问题,即尝试通过 LDAP 设置用户密码失败,因为访问被拒绝错误 - 即使我正在使用管理员用户对 AD 进行身份验证。 在 stackoverflow 中找到的答案说,要么我必须以管
我有一个我没有完全权限的 LDAP 服务器和一个我是 root 的具有 LDAP 身份验证的 ubuntu 系统。是否可以将 LDAP 用户添加到本地组? (我不知道我的表述是否正确,但我想要的只是在
我有一个属性(groupIDNumber),我想让它作为自动递增数字工作? 我们如何定义该属性? 感谢您的帮助, -纳米 最佳答案 这不是 LDAP 协议(protocol)的一部分,也不是标准的做法
对“uid”属性执行不区分大小写匹配的语法是什么?如果属性定义很重要,那么它将如何更改?特别是我将 ApacheDS 用于我的 LDAP 存储。 最佳答案 (uid=miXedCaseUSer)将匹配
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
我需要有关 LDAP 搜索过滤器的信息来提取嵌套组成员资格。基本上,我的想法是,例如,一个用户属于 5 个组 [A、B、C、D、E]我可以编写单个 LDAP 搜索查询来获取组 [A、B、C、D、E]
我关注了 installing ldap on centos 在我的服务器上设置 LDAP 服务器的指南,完成所有安装步骤后,我执行了 ldapsearch -x -b "dc=test,dc=com
我想编写一个 LDAP 查询来测试用户 (sAMAccountName) 是否是特定组的成员。是否可以这样做以便我获得 0 或 1 个结果记录? 我想我可以获取用户的所有组并测试每个组是否匹配,但我想
我是一名优秀的程序员,十分优秀!