PHP를 활성 디렉토리에 연결하고 사용자 인증을 수행하려면 어떻게해야합니까? 나는 WAMP를 사용하여 로컬에서 LDAP를 시도했지만 지금까지 성공하지 못했을 것이다. 내 Active Directory 도메인 "davidecuriosidade.onmicrosoft.com"도메인을 변경Microsoft Azure 액티브 디렉토리를 사용하는 PHP 사용자 인증
$link = ldap_connect('domain.com'); // Your domain or domain server
if(! $link)
{
// Could not connect to server - handle error appropriately
}
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3); // Recommended for AD
// Now try to authenticate with credentials provided by user
if (! ldap_bind($link, '[email protected]', 'SomeSecret'))
{
// Invalid credentials! Handle error appropriately
}
// Bind was successful - continue
,하지만 난 더 성공 말했다과 같이
나는이 시도. 내 활성 디렉토리에 구성이 있습니까?
어떻게 수정할 수 있습니까? $ user = sAMAccountName = myuser, ou = GroupAllowed, dc = domain, dc = com과 같은 것입니까? – DavideBar
문자열을 연결해야합니다. 내 조언은 다음과 같습니다 : – Danoweb
$ bind = 'sAMAccountname ='. $ username. ', ou ='. $ 그룹. ', dc = 도메인, dc = com'; 또는 해결책 : $ bind = 'sAMAccountname ='같이 갈 수도 있습니다. $ 사용자 이름; $ bind. = ', ou ='. $ 그룹; $ bind. = ', dc = domain, dc = com'; 그러면 다음과 같이됩니다 : ldap_bind ($ link, $ bind, 'SomeSecret') – Danoweb