예제 #1
0
파일: auth.py 프로젝트: TonisPiip/lino
    def __init__(self):
        from activedirectory import Client, Creds
        from activedirectory.core.exception import Error

        server_spec = settings.SITE.ldap_auth_server
        if isinstance(server_spec, six.string_types):
            server_spec = server_spec.split()

        self.domain = server_spec[0]
        self.server = server_spec[1]

        self.creds = Creds(domain)
예제 #2
0
from __future__ import print_function
from activedirectory import Client, Creds, activate

domain = 'freeadi.org'

creds = Creds(domain)
creds.load()
activate(creds)

client = Client(domain)
users = client.search('(objectClass=user)', scheme='gc')
for dn, attrs in users:
    name = attrs['sAMAccountName'][0]
    domain = client.domain_name_from_dn(dn)
    print('-> %s (%s)' % (name, domain))