Posted by chrisyates on April 30, 2009 at 7:28pm
| Project: | HTTP authentication |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
I found that because the ldap_integration module (ldapauth) bypasses the Drupal authentication system to do its dirty work, httpauth wouldn't work with LDAP users.
Here's a patch that lets it work by calling ldapauth_login_validate. It's hackish and applied to httpauth rather than the source of the problem, but httpauth is much less complex and brittle.
// Allow authentication via LDAP
if (function_exists('ldapauth_login_validate')) {
require_once('includes/common.inc');
require_once('includes/unicode.inc');
require_once('modules/user/user.module');
require_once(drupal_get_path('module', 'ldapauth') .'/ldap_integration/LDAPInterface.php');
$form_state = array('values' => array('name' => $name, 'pass' => $pass));
ldapauth_login_validate(NULL, $form_state);
}-c
--
Christian Yates
Mars Space Flight Facility
Arizona State University / NASA
| Attachment | Size |
|---|---|
| ldap_integration.patch | 1.01 KB |
Comments
#1
Here's an updated patch for the latest ldap_integration (6.x-1.0-beta1) module:
// Allow authentication via LDAPdrupal_load('module', 'ldapauth');
if (function_exists('ldapauth_authenticate')) {
require_once('includes/common.inc');
require_once('includes/unicode.inc');
require_once('includes/form.inc');
drupal_load('module', 'user');
require_once(drupal_get_path('module', 'ldapauth') .'/includes/LDAPInterface.inc');
$form_state = array('values' => array('name' => $name, 'pass' => $pass));
ldapauth_authenticate($form_state['values']);
}
#2
Very interesting, I'll test this week and report.
#3
So, it's working really well indeed. No issues in two weeks of use / testing (10,000 logins) :)
I do get an error in the log, but it does not seem to be critical:
call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, 'httpauth_callback' was given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\includes\menu.inc on line 348.Going to have a look into it later.
#4