Adldap2 / Adldap2-Laravel

LDAP Authentication & Management for Laravel
MIT License
911 stars 185 forks source link

ldap_search(): Search: Server is unwilling to perform - Laravel 5.2 #97

Closed petr-hybler closed 8 years ago

petr-hybler commented 8 years ago

Hello, I would like to ask you for help ... I love your extension (or at least how it should work :) ) but I am not able to make it work ... I've followed your tutorial https://github.com/Adldap2/Adldap2-Laravel for [https://github.com/Adldap2/Adldap2-Laravel#auth-driver](LDAP auth) but I am still not able to make it work.. I love the feature Login Fallback ...

I did what you wrote (my local fallback is set up to true) but i am not able to log in even with my local account ...

I am still getting the error:

ErrorException in Ldap.php line 229:
ldap_search(): Search: Server is unwilling to perform

When I switch back my proveder to users (from adldap) it works ok again .. but for sure, only with local accounts...

Can you advice me what to do? What am I missing? Should you be needing any additional info let me know.. will provide you as much info as I can :) thank you so much

PS: I am using 2.0 version of your class

stevebauman commented 8 years ago

Hi @cdr666, I'd be glad to help :).

Are you using OpenLDAP at the moment?

petr-hybler commented 8 years ago

it should be OpenAM... the strange thing is, when I try to connect via simple php (at the beginning of route.php)

/****     TEST LDAP CONNECTION  - SAMPLE DATA FOR THIS SERVER ONLY    *****/    
$ldappass = '****';
$ldapUser = '****';
$dn = 'uid='.$ldapUser.',ou=people,dc=company,dc=data'; 
echo "Testing \n";
$ldapconn = ldap_connect('1.2.3.4',389) or die("Could not connect to LDAP server\n");

if ($ldapconn) {
    $ldapbind =ldap_bind($ldapconn, $dn, $ldappass);

    if ($ldapbind) {
        echo "<h1>Login was successful</h1>";
        $sr = ldap_search($ldapconn, 'dc=company,dc=data', "uid=".$ldapUser) or die("could not search for entries\n");
            $info = ldap_get_entries($ldapconn, $sr) or die("could not get entries\n"); 
        echo '<pre>';
        var_dump($info);  
        echo '</pre>';

    } else {
       echo "<h1>Login failed</h1>";
    }
}

dd(Adldap::getDefaultProvider()->auth()->attempt($ldapUser, $ldappass)); // this gives me FALSE

die("Test end\n");

/**********************************************************************************/

this works like a chram ... i get the INFO array with full data for given user/password.. so I am probably wrong in my (your) conf file .. but I can't find what am I doing wrong :(

what should I use in here?

'base_dn' => '',

this one -> 'base_dn' => 'ou=people,dc=company,dc=data' OR this one: 'base_dn' => 'dc=company,dc=data'

stevebauman commented 8 years ago

yes ... the strange thing is, when I try to connect via simple php (at the beginning of route.php)

Unfortunately Adldap2 doesn't support OpenLDAP, but I want to work towards it's compatibility.

what should I use in here?

'base_dn' => '',

this one -> 'base_dn' => 'ou=people,dc=company,dc=data' OR this one: 'base_dn' => 'dc=company,dc=data'

Both of these DN's are valid base DN's, but the second one covers a larger scope outside of the 'People' OU.

petr-hybler commented 8 years ago

hmm thanks.. I had to do a workaround for it a do it manually by myself, since your plugin didn't want to work :)

stevebauman commented 8 years ago

I do accept pull requests if you're willing to test OpenLDAP support.