Active Directory (LDAP) Authentication in WordPress Multi-Site

As many of you know, I led the team that launched the College of Education at UGA’s new website (http://www.coe.uga.edu/) which is driven by WordPress Multi-Site. The first phase is complete, and the second phase has started up. Part of their second phase is to allow a custodian from each department to edit content on their own departmental site. UGA uses Active Directory campus wide, so I thought it would be best to incorporate the WordPress authentication mechanism into UGA’s current AD implementation.

When I first researched this there weren’t many plugins for WordPress Multi-Site that handled AD/LDAP authentication. I was planning on writing one myself, but I found one yesterday by Clifton Griffin called Simple LDAP Login. I installed in on a development website, put in the necessary information and BAM it worked… but it wasn’t really designed for WordPress Multi-Site. What I needed was every site to use the Active Directory authentication, without having to set each site up individually. So I paired down the code a bit (to just what I needed) and stuck the files in the mu-plugins dir.

Clifton used the opensource PHP LDAP Class in his plugin, which works great. So, in my version, I stripped out everything I didn’t need/want like auto account creation, non-AD functionality, etc. Basically, I just needed to authenticate users via Active Directory.

So I stuck this code into a file in my mu-plugins folder. Now whenever anyone tries to authenticate it, uses Active Directory instead of WordPress’ user table:

Comments

  1. Glad it was useful to you.

    I put together this plugin because I got so sick of all of the non-functioning overly complicated ones available.

    I intend to make it more Multi Site friendly eventually, but haven’t really worked out what that should entail. I suppose just some global settings but it will take some thought.

    Thanks for sharing.

  2. Clifton,

    Thanks for writing it… it was definitely some of the cleanest code I’ve seen in this area. WPMS is a bit under-developed, it would be awesome if there was a wpmu_options table that this plugin could apply to, but that’s probably too much overhead for WordPress.

    You may consider just releasing a WPMS only plugin that requires people to edit a file for the global settings.

    Thanks again.
    Lew