Swiftpack.co - Package - PerfectExamples/Perfect-LDAP-Demo

Perfect-LDAP-Demo 简体中文

Get Involed with Perfect!

Star Perfect On Github Stack Overflow Follow Perfect on Twitter Join the Perfect Slack

Swift 3.0 Platforms OS X | Linux License Apache PerfectlySoft Twitter Slack Status

This project demonstrates a minimal usage of Perfect-LDAP library by connecting to a Windows 2000 Domain Controller and searching for domain users.

Linux Build Note

Please make sure the following libraries were installed on Ubuntu 16.04:

$ sudo apt-get -y install libsasl2-dev libldap2-dev

Quick Start

  • Check out or download the project:
$ git clone https://github.com/PerfectExamples/Perfect-LDAP-Demo.git

Configure Login

Once download, please modify login information to fit to your server configuration in main.swift:

// equivalent to ldapsearch -D
let dn = "CN=judy,CN=Users,DC=perfect,DC=com"

// equivalent to -w
let password = "0penLDAP"

// equivalent to -H
let url = "ldap://"

// equivalent to -b
let base = "CN=Users,DC=perfect,DC=com"

// equivalent to -s sub
let scope: LDAP.Scope = .SUBTREE

NOTE These parameters are equivalent to:

$ ldapsearch -D "CN=judy,CN=Users,DC=perfect,DC=com" -w "0penLDAP" -H "ldap://" -b "CN=Users,DC=perfect,DC=com" -s sub -x


  • In terminal, navigate to the directory and execute
$ cd Perfect-LDAP-Demo
$ swift build

Once done, you could try ./.build/debug/PerfectLDAPDemo to see the searching result. If nothing wrong, it should return a dictionary with all users details on the server.


We are transitioning to using JIRA for all bugs and support related issues, therefore the GitHub issues has been disabled.

If you find a mistake, bug, or any other helpful suggestion you'd like to make on the docs please head over to http://jira.perfect.org:8080/servicedesk/customer/portal/1 and raise it.

A comprehensive list of open issues can be found at http://jira.perfect.org:8080/projects/ISS/issues

Further Information

For more information on the Perfect project, please visit perfect.org.


Stars: 4

Used By

Total: 0


First Commit - 2017-02-01 15:05:14