unofficial serendipity_event_externalauth alteration
Posted: Fri Apr 11, 2008 8:32 pm
In the places I've used LDAP to check authentication, there's a setup not possible with the current code. The LDAP servers I use allow anonymous access but uses a distinguished name which cannot be guessed beforehand so you have to do a search, etc to get the DN before using ldap_bind to actually authenticate.
On your config page, it would look similar to this:
Authentication String: "o=MyCompany, c=US";
Query to Find User: "uid=%1"
LDAP DN name used to connect: _blank_
Password for LDAP DN used to connect: _blank_
In this codeblock:
We're ignoring the option of a non-standard/messy schema LDAP that allows anon access.
My proposed solution is to either handle the protected access binding prior to this code block:
Alternatively, you can alter the 'else' block by removing the
conditional and rewriting it as :
If any of you find yourself in this particular scenario, I hope this helps if it doesn't make it into the official release of the plugin.
On your config page, it would look similar to this:
Authentication String: "o=MyCompany, c=US";
Query to Find User: "uid=%1"
LDAP DN name used to connect: _blank_
Password for LDAP DN used to connect: _blank_
In this codeblock:
Code: Select all
if ($this->get_config('auth_query') == '') { // standard LDAP with anon access
/* .. snip .. */
} else { // LDAP with protected access and messy schema
/* .. snip .. */
}
My proposed solution is to either handle the protected access binding prior to this code block:
Code: Select all
if (the config is set with the LDAP DN used to connect parameters) {
/* .. bind to restricted access LDAP server .. */
}
if ($this->get_config('auth_query') == '') { // standard LDAP
/* .. snip .. */
} else { // LDAP with messy schema
/* .. snip .. */
}
Code: Select all
if ($r = @ldap_search($ds, $this->get_config('rdn'), $auth_query)) {Code: Select all
if (the config is set with the LDAP DN used to connect parameters) {
/* .. bind to restricted access LDAP server .. */
}If any of you find yourself in this particular scenario, I hope this helps if it doesn't make it into the official release of the plugin.