Apache VCL logo Apache Software Foundation logo
Apache current event

Adding LDAP Authentication

Prerequisites for your LDAP server:

Prerequisites for your VCL web server:

Adding LDAP Authentication to the Web Code

and replace them with

    $affilValFunc = array();
    $affilValFuncArgs = array();
    $addUserFunc = array();
    $addUserFuncArgs = array();
    $updateUserFunc = array();
    $updateUserFuncArgs = array();
    foreach($authMechs as $key => $item) {
       if($item['type'] == 'ldap') {
          $affilValFunc[$item['affiliationid']] = 'validateLDAPUser';
          $affilValFuncArgs[$item['affiliationid']] = $key;
          $addUserFunc[$item['affiliationid']] = 'addLDAPUser';
          $addUserFuncArgs[$item['affiliationid']] = $key;
          $updateUserFunc[$item['affiliationid']] = 'updateLDAPUser';
          $updateUserFuncArgs[$item['affiliationid']] = $key;
       }
       elseif($item['type'] == 'local') {
          $affilValFunc[$item['affiliationid']] = create_function('', 'return 0;');
          $addUserFunc[$item['affiliationid']] = create_function('', 'return 0;');
          $updateUserFunc[$item['affiliationid']] = create_function('', 'return 0;');
       }
    }

Tweak if your LDAP server has users in multiple containers

If your LDAP server has users in multiple containers, then the full DN for each user must be looked up before doing a bind to the LDAP server to authenticate the user. In this case, you’ll need to modify authentication.php.