Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requested: more examples #9

Open
nblom opened this issue Sep 30, 2021 · 2 comments
Open

Requested: more examples #9

nblom opened this issue Sep 30, 2021 · 2 comments

Comments

@nblom
Copy link

nblom commented Sep 30, 2021

Trying to get this working, but xcode compains about all kinds of stuff, line two "No exact matches in call to instance method 'login'", and "Invalid redeclaration of 'connection()'"

`
let connection = try? LDAP(url: "ldaps://perfect.com")
let credential = LDAP.login(binddn: "CN=judy,CN=Users,DC=perfect,DC=com", password: "0penLDAP")

     connection.login(info: credential) { err in

    do {
        try connection.search(base: "CN=Users,DC=perfect,DC=com", filter:"(objectclass=*)") {
            
            print(res)
        }
    }catch (let err) {
        // failed for some reason
    }
    }`

Could anyone get a complete working example of a login and asynchronous search?
Preferably for swift 5.5

@najk
Copy link

najk commented Feb 17, 2022

Login
`
let credential = LDAP.Login(binddn: "user@domain", password: "ss")
do {
let connection = try LDAP(url: "ldaps://domain")
connection.login(info: credential) { err in
if (err == nil) {
connection.search(base: "DC=base,DC=example,DC=com", filter: "(sAMAccountName=testuser)") { res in
print(res)

`

just gives [:] as result.

@najk
Copy link

najk commented Feb 17, 2022

Seems to only allow searches when specifying an OU, without OU i get no results.

let res = try connection.search(base: "OU=Users,DC=test,DC=example,DC=com", filter: "(&(objectclass=person)(sAMAccountName=test))", scope: .SUBTREE, attributes: ["memberOf"])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants