ldap 0.2.0
LDAP client library using winldap on windows and openldap on other platforms
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
ldap
Cross platform Microsoft Active Directory client using LDAP (winldap on windows, openldap otherwise).
Openldap implementation based off dopenldap
import std.stdio;
int proto_version;
auto ldap = LDAPConnection("127.0.0.1:389"); // normal ldap connection
auto auther = LDAPAuthenticationEngine("127.0.0.1:389"); // ldap connection with fast binding and no encryption support on windows (used for password authentication)
ldap.getOption(LDAP_OPT_PROTOCOL_VERSION, &proto_version);
if (proto_version == 2)
{
proto_version = 3;
ldap.setOption(LDAP_OPT_PROTOCOL_VERSION, &proto_version);
writeln("Switched to protocol version 3");
}
ldap.bind("admin@localhost", "");
auto arr = ldap.search("OU=data,DC=data,DC=local",
LDAP_SCOPE_SUBTREE, "(|(objectClass=contact)(objectClass=user))", ["l"]); // find all users & contacts
writefln("Found %s results", arr.length);
foreach (r; arr)
{
writeln(r.distinguishedName); // print path of contact
foreach (k, v; r.attributes)
{
writef("%s = %s", k, v); // prints location of contacts (because of ["l"] argument above)
}
}
writeln("Done");
assert(!auther.check("non valid user", "non valid password"));
assert(auther.check("admin", ""));
- Registered by WebFreak
- 0.2.0 released 6 years ago
- WebFreak001/ldap
- MIT
- Dependencies:
- none
- System dependencies:
- On Windows you need to compile your program with --arch=x86_64 or --arch=x86_mscoff for linking to work.
- Versions:
-
0.4.0 2023-Mar-27 0.3.0 2021-Mar-15 0.2.0 2018-Jun-15 0.1.0 2017-Mar-16 ~master 2023-Mar-27 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
90 downloads total
-
- Score:
- 0.7
- Short URL:
- ldap.dub.pm