I’m trying to hijack the authentication to use LDAP/AD. I’ve found the login_authenticate_start hook, and I’m trying to use that, but I’m having no luck. Is there something I can return that says, “Yay, this user is authenticated” or do I have to rewrite the whole authentication function?
Also, is it possible to access the Login class methods from my extension? eg:
$Login->login_form()
Any help gratefully received
Hi stickmus,
This question comes up a lot; you may want to search the forums for other perspectives.
Our needs are very simple; all we want is to validate the password against Active Directory given a username that already exists in ExpressionEngine’s database. Everything else will use the existing code. We want to minimize the impact of our hack to make things easier to upgrade as EllisLab releases new versions.
We’re probably going to address this by deleting the code between the “Check password” and “Invalid password” comments in cp.login.php (this is lines 208-229 in version 1.6.3) and replacing it with a custom hook. The bulk of the code is based on an existing authentication library we’ve written, which we’ll modify into an EE extension.
Sorry, I don’t expect that my employer will allow me to release the source code for this, but I will be sure to ask in a couple months when I get to this part of the project.
Jesse,
Thanks for this detailed info. I’m going to start looking into something similar for us with internal ldap auth functions.
For anyone that’s interested, has the PHP know how and time, Knowledgtree’s community version has an LDAP auth module that works great both with openLDAP and AD. The source for their LDAP functions is in there ‘xxx…baseauthentication…xxx’.php files. I would think it could be similarly ported over for EE, but per the conditions, I’m not a php guru, but would be willing to help someone who is, in trying to work out such an extension.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.