PEAR-Auth Issues
| From: | Mike Tuller | Date: | Thu, 22 Jan 2009 15:38:16 +0000 |
| Subject: | PEAR-Auth Issues | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-29627@lists.php.net to get a copy of this message | ||
I am attempting to use PEAR-Auth for LDAP authentication, but I can seem to get ti to work and need some advice. I am able to bind and search with a script I created in PHP, but I thought I would try this so that I don't have to write a whole authentication script. Now, one thing that may be a problem is that the dn we have does not contain the uid. I also tried to add debug, but I didn't get any information back.
<?php
require_once "Auth.php";
$options = array(
'host' => 'ldaps://ldap.mycompany.com',
'port' => 636,
'version' => 3,
'basedn' => 'ou=People,o=mycompany,c=US',
'userattr' => 'uid',
'binddn' => 'cn=me,ou=People,o=mycompany,c=US',
'bindpw' => 'password'
);
function auth_ldap()
{
?>
<form method="post" action="<?php $_SERVER['PHP_SELF'] ?>">
Name: <input name="username" type="text"><br />
Password: <input name="password" type="password"><br />
<input type="submit" value="Sign In">
</form>
<?php
}
$auth = new Auth('LDAP',$options, 'auth_ldap');
$auth->start();
$options['userattr'] == $_POST['username'];
if ($auth->getAuth())
{
print 'Welcome member! Nice to see you again.';
}
else
{
print 'Welcome guest. First time viewing.';
}
?>