Answer the question
In order to leave comments, you need to log in
Authentication through Active Directory?
Hello. Such a question:
I use laravel 5.6 with the adLDAP package (at the moment I enter the login and password in the form, then when the button is pressed, it checks for the presence of an entry in the Active Directory and if such an entry exists, I log in) I
use Internet Explorer and when I display $ _SERVER I have filled the REMOTE_USER parameter, how can I do authentication without entering a password, just at the entrance to take REMOTE_USER and send it to AD ???
<?php
$domain = '###_##01.####.###-##.##';
$port = 389;
$ad = ldap_connect($domain, $port) or die('Could not connect to LDAP server.');
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
if($ad){
$user = "#########";
$filter = "(sAMAccountName=$user)";
$dn = 'dc=####,dc=###-##,dc=##';
$attr = array('givenName', 'sn');
$result = ldap_search($ad, $dn, $filter, $attr) or exit('Unable to search LDAP server');
}
?>
Answer the question
In order to leave comments, you need to log in
I have not tried to connect to LDAP from PHP yet, but I think that ldap_bind is missing after ldap_connect:
php.net/manual/en/function.ldap-bind.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question