note 105269 added to function.ldap-sasl-bind
| From: | CalebCallaway at osu1 dot php dot net | Date: | Sat, 06 Aug 2011 04:18:10 +0000 |
| Subject: | note 105269 added to function.ldap-sasl-bind | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182275@lists.php.net to get a copy of this message | ||
Code snippet demonstrating how to establish a TLS-encrypted connection to an OpenLDAP server from an
Apache webserver and authenticate using a user's Kerberos credentials. Credentials MUST be
delegated to the web server for this method to work.
<?php
putenv("KRB5CCNAME={$_SERVER['KRB5CCNAME']}");
$resource = ldap_connect("ldap.example.com")
or die("Failed to connect to LDAP server.");
echo "Connected to LDAP server.<br />";
//these options may not be necessary in all environments
ldap_set_option($resource, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($resource, LDAP_OPT_REFERRALS, 0);
$result = ldap_start_tls($resource)
or die("Failed to start TLS");
echo "Started TLS.<br />";
$result = ldap_sasl_bind($resource, NULL, '', 'GSSAPI', 'EXAMPLE.COM',
'', '')
or die("Failed to GSSAPI bind.<br />");
echo "GSSAPI bound.";
?>
See also: http://left.subtree.org/2007/06/26/phpldapadmin-and-kerberos/
----
Server IP: 69.147.83.197
Probable Submitter: 75.48.19.127
----
Manual Page -- http://www.php.net/manual/en/function.ldap-sasl-bind.php
Edit -- https://master.php.net/note/edit/105269
Del: integrated -- https://master.php.net/note/delete/105269/integrated
Del: useless -- https://master.php.net/note/delete/105269/useless
Del: bad code -- https://master.php.net/note/delete/105269/bad+code
Del: spam -- https://master.php.net/note/delete/105269/spam
Del: non-english -- https://master.php.net/note/delete/105269/non-english
Del: in docs -- https://master.php.net/note/delete/105269/in+docs
Del: other reasons-- https://master.php.net/note/delete/105269
Reject -- https://master.php.net/note/reject/105269
Search -- https://master.php.net/manage/user-notes.php