我想过滤CN不等于sAMAccountName的所有LDAP对象.因此,我编写了以下查询,遗憾的是,它既不起作用也不符合RFC:
(!(cn=sAMAccountName))
有人知道如何实现所需的功能吗?
最好的问候托马斯
我写了一些代码,但没有工作,它抛出异常"发生了一个操作错误." 代码--->
DirectoryEntry dirEntry = new DirectoryEntry("LDAP path", "admin-username", "admin-password");
dirEntry.Properties["member"].Remove("username-delete");
dirEntry.CommitChanges();
dirEntry.Close();
Run Code Online (Sandbox Code Playgroud)
给我一些想法摆脱这些事情..
问题说明了一切.当我打印属性时,它是:
cn: WF-008-DAM-PS
Run Code Online (Sandbox Code Playgroud)
代码段是:
private void searchGroup() throws NamingException {
NamingEnumeration<SearchResult> searchResults = getLdapDirContext().search(groupDN, "(objectclass=groupOfUniqueNames)", getSearchControls());
String searchGroupCn = getCNForBrand(m_binder.getLocal("brandId"), m_binder.getLocal("brandName"));
Log.info(searchGroupCn);
while (searchResults.hasMore()) {
SearchResult searchResult = searchResults.next();
Attributes attributes = searchResult.getAttributes();
Attribute groupCn = attributes.get("cn");
if(groupCn != null) {
Log.info(groupCn.toString());
}
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到的值是:WF-008-DAM-PS没有关键部分?问候.
以下代码工作了3个月,没有任何问题.从今天起我收到以下错误; "调用目标引发了异常"和内部异常; "访问被拒绝.(HRESULT异常:0x80070005(E_ACCESSDENIED)"
验证功能有效.这是我的功能;
public bool Authenticate(string strUserName, string strPassword)
{
bool authenticated = false;
using (
var entry = new DirectoryEntry("LDAP://myldapserver", strUserName + "@domain", strPassword,
AuthenticationTypes.Secure))
{
try
{
object nativeObject = entry.NativeObject;
authenticated = true;
}
catch (DirectoryServicesCOMException ex)
{
return false;
}
}
return authenticated;
}
Run Code Online (Sandbox Code Playgroud)
和ChangePassword方法;
public bool ChangePassword(string strUserName, string strOldPassword, string strNewPassword)
{
const long ADS_OPTION_PASSWORD_PORTNUMBER = 6;
const long ADS_OPTION_PASSWORD_METHOD = 7;
const int ADS_PASSWORD_ENCODE_REQUIRE_SSL = 0;
const int ADS_PASSWORD_ENCODE_CLEAR = 1;
string …Run Code Online (Sandbox Code Playgroud) 我在本地计算机(Windows Server 2008 R2盒)上为新应用程序设置了ADLDS实例,并且已经敲除了一些.Net代码来访问它.这是我正在测试的功能之一,因为你可以看到它相当简单的东西.
Dim MyLdapUri As New Uri(searchRoot)
Using MyContext As New PrincipalContext(ContextType.ApplicationDirectory,
MyLdapUri.Authority,
MyLdapUri.LocalPath.Substring(1), ContextOptions.SimpleBind,
strUsername, strPassword)
Return UserPrincipal.FindByIdentity(MyContext, IdentityType.Name, username)
End Using
Run Code Online (Sandbox Code Playgroud)
我反复发现的一件事是我第一次调用此函数或任何其他函数从测试床应用程序访问实例时出现约18秒的延迟.对AD LDS实例的后续调用大约为40ms.一旦你离开实例几分钟,那么第一次通话后回拨18秒.
我在事件日志中找不到任何不好的东西.我也试过以不同的方式连接到实例(简单绑定到上面实例中定义的用户,使用本地和域Windows帐户),并且第一次命中的这18秒额外延迟总是发生.任何人都可以给我指出导致这种情况的原因和/或我如何诊断/修复它吗?
我在将ASP.NET Web服务与Active Directory设置集成时遇到问题,并使用它来验证用户并检查他们是AD组的成员,以及他们是否有权使用我的自定义应用程序.
我的自定义应用程序具有自己的权限,管理员配置允许使用自定义应用程序的Active Directory组.
我遇到的问题是,来自不同Trusted AD林的用户(具有完全双向信任)尝试登录时,我无法从我的ASP.NET Web服务与之通信的AD服务器中获取他的组列表.ASP.NET Web服务只能访问AD服务器(AD Main),而不能访问信任AD控制器(AD Secondary).
用户是(AD辅助)域的成员,我可以针对(AD Main)域对该用户进行身份验证,但是当用户位于(AD Main)域时,我无法从(AD Main)域获取组列表(AD Secondary)域名.
我试过这段代码.
StringCollection groupids = new StringCollection();
try
{
DirectoryLibrary dirLib = new DirectoryLibrary();
DirectoryEntry directoryEntry = new DirectoryEntry("LDAP://" + domain,username, password);
if (directoryEntry != null)
{
//Enum the properties so we can see what is in them
foreach (string propname in directoryEntry.Properties.PropertyNames)
{
Debug.WriteLine(propname);
}
object obGroups = directoryEntry.Invoke("Groups");
foreach (object ob in (IEnumerable)obGroups)
{
// Create object for each group.
DirectoryEntry obGpEntry = …Run Code Online (Sandbox Code Playgroud) 是否有一种完全自动化的方式来验证使用IE8 +与Apache 的用户,而无需用户输入任何形式的凭据?即使我正在运行Windows,运行IIS也不是一个真正的选择.
我发现了一些基于Perl的解决方案应该可以工作,但我只能在*Nix上使用大量的模糊测试.
我目前正在使用authnz_ldap_module,它工作得很好,但是用户真的很烦人,因为必须为他们打开的每个新会话输入用户ID和密码而烦恼.
有任何想法吗?
我是LDAP/Active Directory环境的新手.
我正在尝试使用SSL支持连接LDAP/Active Directory.
要连接LDAP/Active Directory,需要SSL证书才能建立连接.
我一直在谷歌搜索,大部分结果是"使用Microsoft CA(证书颁发机构)创建证书".这是为LDAP/Active Directory生成证书的唯一方法吗?
如何获得LDAP/Active Directory的SSL证书?有没有其他方法可以获得LDAP/Active Directory的SSL证书?
在LDAP身份验证的情况下,通常用于身份验证的参数是什么.我想使用DN对于通过ldap登录的用户来说会很头疼,因为它太大而无法记住.如何使用uid或sAMAccountName进行身份验证的选项在我的实现中,我检索相应的uid或sAMAccountName的dn并继续进行身份验证.
我走的正确吗?
我在LDAP身份验证上遇到了一个奇怪的行为,我需要这个用他们的AD凭据来验证用户,这就是我所拥有的:
session_start();
$adServer = "MY IP";
$ldapconn = ldap_connect($adServer) or $this->msg = "Could not connect to LDAP server.";
$ldaprdn = "DOMAIN\\" . $_POST["username"];
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $_POST["password"]);
if ($ldapbind) {
//$msg = "Successfully Authenticated";
$_SESSION['loggedin'] = 1;
$_SESSION['username'] = $username;
header("Location: ../main.php");
} else {
header("Location: ../index.php?login_failed=1");
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的不同行为:
我发现这很难集中,如果没有使用密码字段,所有用户都会被验证.但是,如果我使用密码字段,它只会使用正确的凭据对用户进行身份验证.
我在这里做错了什么,还是应该开始唠叨IT人员?
ldap ×5
c# ×3
adam ×1
apache ×1
asp.net ×1
attributes ×1
comparison ×1
java ×1
jndi ×1
php ×1
ssl ×1
web-services ×1
windows ×1
wpf ×1