Need help on LiveUser with LDAP / PEAR::Auth
[email protected] (Stephanas Francis) Tue, 17 Feb 2015 14:19:14 -0400
| Newsgroups | php.pear.general |
|---|---|
| Message-ID | <CAMxBZg3Bf+Ev5VfDn1R+0_JBekVWNsKVufGE8O+MKHZL18vZOA@mail.gmail.com> |
Hi, We have been using LiveUser with authentication / permission information in MDB2 tables. We are now trying to test LiveUser with LDAP through PEAR::Auth class. We would like to have authentication done using LDAP, and permission using the MDB2 tables. I have attached below the LiveUser configuration with MDB2 and LDAP. The authentication seems to be going through using LDAP, but a permission check done later on using $LU->checkRight(..) is failing. Can anyone throw some light on the following 3 questions: 1. Can PEAR::Auth/LDAP be used for auth container, and MDB2 (as in original config) be used for perm container? 2. What is wrong in my LU Config using LDAP so that permission check using MDB2 is failing? 3. I examined the readUserData() function in LiveUser/Auth/PEARAuth.php. It seems to be: - duplicating username into handle as well as auth_user_id - Perhaps only username and password are used from LDAP and set up in LiveUser fields? How can I get customized fields (application specific) from LDAP into LiveUser. E.g., app_id as shown in the LU Config using MDB2. How do I get LU to set auth_user_id from, say, another LDAP attribute? Regards, Stephanas
LiveUser_Config_MDB2.php
(application/x-httpd-php, 2.2 KB)
$dsn ='mysql://' . $db_user . ':' . $db_password . '@' . $db_server . '/' . $db_database;
$conf = array(
'cache_perm' => true,
'login' => array(
'force' => true,
'regenid' => true,
),
'logout' => array(
'destroy' => true,
),
'authContainers' => array(
'cs' => array(
'type' => 'MDB2',
'expireTime' => 0,
'idleTime' => 1800,
'allowDuplicateHandles' => 0,
'allowEmptyPasswords' => 1,
'passwordEncryptionMode'=> 'MD5',
'storage' => array(
'dsn' => $dsn,
'alias' => array(
'auth_user_id' => 'authUserId',
'lastlogin' => 'lastLogin',
'is_active' => 'isActive',
'owner_user_id' => 'owner_user_id',
'owner_group_id' => 'owner_group_id',
'users' => 'current',
'app_id' => 'app_id'
),
'fields' => array(
'lastlogin' => 'timestamp',
'is_active' => 'boolean',
'owner_user_id' => 'integer',
'owner_group_id' => 'integer',
'app_id' => 'integer'
),
'tables' => array(
'users' => array(
'fields' => array(
'lastlogin' => false,
'is_active' => false,
'owner_user_id' => false,
'owner_group_id' => false,
'app_id' => false
),
),
),
),
),
),
'permContainer' => array(
'type' => 'Complex',
'storage' => array(
'MDB2' => array(
'dsn' => $dsn,
'prefix' => 'liveuser_',
'alias' => array(
'perm_users' => 'perm_peoples',
'groupusers' => 'groupusers_cs_v'
),
)
),
),
);
LiveUser_Config_LDAP.php
(application/x-httpd-php, 2.5 KB)
$dsn ='mysql://' . $db_user . ':' . $db_password . '@' . $db_server . '/' . $db_database;
$params = array(
'url' => 'ldap://192.168.1.50:389',
'version' => 3,
'basedn' => 'dc=uog,dc=edu,dc=gy',
'userattr' => 'uid',
'debug' => true,
'pearAuthContainer' => 'AuthLDAP',
);
$conf = array(
'cache_perm' => true,
'login' => array(
'force' => true,
'regenid' => true,
),
'logout' => array(
'destroy' => true,
),
'authContainers' => array(
'AuthLDAP' => array(
'type' => 'PEARAuth',
'container' => 'LDAP',
'options' => $params,
'expireTime' => 0,
'idleTime' => 1800,
'allowDuplicateHandles' => 0,
'allowEmptyPasswords' => 1,
'passwordEncryptionMode'=> 'MD5',
'storage' => array(
'dsn' => $dsn,
'alias' => array(
'auth_user_id' => 'authUserId',
'lastlogin' => 'lastLogin',
'is_active' => 'isActive',
'owner_user_id' => 'owner_user_id',
'owner_group_id' => 'owner_group_id',
'users' => 'current',
'app_id' => 'app_id'
),
'fields' => array(
'lastlogin' => 'timestamp',
'is_active' => 'boolean',
'owner_user_id' => 'integer',
'owner_group_id' => 'integer',
'app_id' => 'integer'
),
'tables' => array(
'users' => array(
'fields' => array(
'lastlogin' => false,
'is_active' => false,
'owner_user_id' => false,
'owner_group_id' => false,
'app_id' => false
),
),
),
),
),
),
'permContainer' => array(
'type' => 'Complex',
'storage' => array(
'MDB2' => array(
'dsn' => $dsn,
'prefix' => 'liveuser_',
'alias' => array(
'perm_users' => 'perm_peoples',
'groupusers' => 'groupusers_cs_v'
),
)
),
),
);