Created
September 25, 2018 06:59
-
-
Save stefanorossiti/5492046820b41d9698a5d92751d6cf0e to your computer and use it in GitHub Desktop.
LDAP/AD user validation chech example with PHP LDAP plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ldaphost = "localhost"; | |
$ldabindDN = "cn=admin,dc=local,dc=test"; | |
$ldapassw = "edpplc"; | |
$ldapport = 389; | |
$ldap = ldap_connect($ldaphost, $ldapport) or die("Could not connect to $ldaphost"); | |
echo 'Connecting to ' . $ldaphost . '...'; | |
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3) or die("Cannot connect to $ldaphost"); | |
$bind = ldap_bind($ldap, $ldabindDN, $ldapassw); | |
echo 'Done'; | |
ldap_unbind($ldap); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LDAP Container for testing:
github.com/osixia/docker-openldap
Container created:
docker run -p localhost:389:389 --name openldap-local-test -d -e LDAP_ORGANISATION=BBC -e LDAP_DOMAIN=local.test -e LDAP_ADMIN_PASSWORD=edpplc --rm osixia/openldap:1.2.2