DirectoryTree / LdapRecord-Discussions

A place to ask questions, get help, or share what you've built with LdapRecord.
4 stars 1 forks source link

Connection without username or password. #7

Closed lucasbspimenta closed 4 years ago

lucasbspimenta commented 4 years ago

Hello, We used to connect do OpenLdap without Username and Password. It's like a readonly use, to check if the user logged exists and get extra infos. How to make it work on LdapRecord? On Adldap2 works. Thanks

stevebauman commented 4 years ago

Hi @lucasbspimenta,

Simply set the username and password to null and you're all set to anonymously bind to your server 👍

use LdapRecord\Connection;

$connection = new Connection([
     'hosts'    => ['192.168.1.1'],
     'port'     => 389,
     'username' => null,
     'password' => null,
]);