Auth_Ldap: LDAP Authentication Library for CodeIgniter

 

This was first presented in my post LDAP Authentication with CodeIgniter.  This is just a simple library that wraps up the necessary LDAP calls to authenticate a user against LDAP and then set a session cookie that identifies the user as logged in.

Usage is relatively simple: unpack the archive and copy the files into the appropriate CodeIgniter libraries for your application.  This usually just means mirroring the directory structure in the zip file over to your CodeIgniter install.  The directory structure should look something like this:

The files controllers/auth.php, views/auth/login_form.php, and views/auth/logout_view.php are not necessary for the functionality of the library and are provided as an example of how to use AuthLDAP within your application.

Downloads:

AuthLDAP (1676)
 Posted by at 14:00:40 pm

  7 Responses to “Auth_Ldap: LDAP Authentication Library for CodeIgniter”

  1. Hi,

    Am getting the following error when configuring for Active Directory:

    Error looking up DN for coolvixs: Success

    My configs as follows:

    $config['ldap_uri'] = array(‘ldap://example.com:389/’);
    $config['use_tls'] = false; // Using SSL above, don’t use TLS with it
    $config['search_base'] = ‘DC=example,DC=com’;
    $config['user_search_base'] = ”;
    $config['group_search_base'] = ”;
    $config['user_object_class'] = ‘user’;
    $config['group_object_class'] = ‘group’;
    $config['user_search_filter'] = ”;
    $config['group_search_filter'] = ”;
    $config['login_attribute'] = ‘sAMAccountName’;
    $config['schema_type'] = ‘ad’; // Could also use rfc2307bis
    $config['proxy_user'] = ‘CN=Admin,CN=Users,DC=staff,DC=example,DC=com
    $config['proxy_pass'] = ‘xxxxxx’;
    $config['roles'] = array(1 => ‘User’,
    3 => ‘Power User’,
    5 => ‘Administrator’);
    $config['auditlog'] = ‘application/logs/audit.log’;

    Would be grateful if you could advise where am going wrong…

    Thanks in advance

  2. Hello.

    I would like to ask your help.

    can you write down step by step to install this in CI.

    TQ.

  3. Thanks a lot for this script ! I’ll test it ! :)

  4. Thanks for the great plugin. I have updated to the newer version and now I’m getting this error:

    Message: ldap_connect() [function.ldap-connect]: Could not create session handle: Bad parameter to an ldap routine

  5. im succes to login, but i want to know my uid_number and gid_number, can u help me

  6. libraries/AuthLDAP.php line 193 – uses ldapconn() as a function when it’s a variable; need to drop the ()

    controlllers/auth.php refers to ‘authldap.php’ when it should be ‘AuthLDAP.php’; I’m guessing you are using a case insensitive filesystem/OS.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">