Hi all,

I'm having some trouble with LDAP authentication at CakePHP... I've already
LADP auth working in a application without cakephp.

There I have this config:

define('AUTH_LDAP_SERVER','ldaps://server.s1.s2.s3');
define('AUTH_LDAP_PORT',636);
define('AUTH_LDAP_DEBUG',false);

require_once "Auth.php";

// Authentication Pear Auth - LDAP c/SSL
$auth = new Auth("LDAP", array(
   'host' => AUTH_LDAP_SERVER,
   'port' => AUTH_LDAP_PORT,
   'version' => 3,
   'basedn' => 'ou=users,dc=s1,dc=s2,dc=s3',
   'userattr' => 'uid',
   'bindpw' => 'password',
   'attributes' => array('cn','uid','ou','mail'),
   'debug' => AUTH_LDAP_DEBUG,
   ),null,false);

// Function to be called when login fails
$auth->setFailedLoginCallback(array('teacher', 'loginFalhado'));
// Function to be called when login is succesful
$auth->setLoginCallback(array('teacher', 'loginEfectuado'));
// Function to be called when user logout
$auth->setLogoutCallback(array('teacher', 'logoutEfectuado'));

// Starts authentication

$auth->start();


So I'm trying to do that at cakephp, and I've this:

class LdapUser extends AppModel
{
    var $name = 'LdapUser';
    var $useTable = false;

    var $host       = 'ldaps://ldap.fe.up.pt';
    var $port       = 636;
    var $baseDn = "ou=users,dc=s1,dc=s2,dc=s3";
    var $user       = 'uid=username,';
    var $pass       = 'password';

    var $ds;

function __construct()
{
    parent::__construct();
    $this->ds = ldap_connect($this->host, $this->port);
    ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($this->ds, LDAP_OPT_REFERRALS, 0);
    ldap_bind($this->ds, $this->user . $this->baseDn, $this->pass);
}

function __destruct()
{
    ldap_close($this->ds);
}
}


I'm testing it at console and I can connect annonimously, but when trying
with user/pass like above, it keeps saying that "Unable to bind to server:
Invalid credentials".
I'm absolutly sure that i'm putting the right ones. Is there some parameter
or anything that Auth.php sets in order to make that auth work?

Any idea?

Thanks in advance.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to