Support » Plugin: Active Directory Integration » [Plugin: Active Directory Integration] is auto authentication still on the horizon?

Viewing 6 replies - 1 through 6 (of 6 total)
  • What authentication method have you got set in IIS? The auto_login() function probably expects Integrated Windows Authentication only, might not work if you have anonymous enabled. It also seems to need 2 page refreshes to actually display the user as logged in, and of course there is no way to ever log out!

    I’ve also used the IIS Authentication Plugin occasionally to add some extra methods, seems to work ok but compatibility problems with Dynamic Widgets & Buddypress.

    I’d still like to see proper automatic AD authentication. The hack remains an unsatisfactory workaround in my book!

    Also, just noticed, here’s the ticket for auto-authentication on the developer’s bug tracker. Some useful comments on there.

    One thing to note is that get_userdatabylogin($user_login) is now depreciated, so change that bit of the code for get_user_by(‘login’, $user_login). New auto_login() function should look like this:

    function auto_login() {
    	if (!is_user_logged_in() && isset($_SERVER['LOGON_USER'])) {
    		$user_login = substr($_SERVER['LOGON_USER'], strrpos($_SERVER['LOGON_USER'],'\\')+1, strlen($_SERVER['LOGON_USER'])-strrpos($_SERVER['LOGON_USER'],'\\'));
    		$user = get_user_by('login', $user_login);
    		$user_id = $user->ID;
    		wp_set_current_user($user_id, $user_login);
    		do_action('wp_login', $user_login);
    add_action('init', 'auto_login');

    I finally got around to trying this and it totally worked.

    Using the modified code without the depreciated function, and fiddling with my IIS7 authentication setting solved the problem.

    I did not notice the 2 refreshes – it seems to work perfectly when I first load the page. I tested it as a few different users.

    Also, I don’t want users to be able to log out, so as long as there’s no hiccups, it’s perfect.

    Thank you!

    Ahhhh man – I spoke too soon.

    While it DOES work, it only works when the user has already been created within WordPress. So, the user would still have to visit wp-admin, and login with their AD credentials once, in order for the account to be created within WordPress, and then once the account was created, the desired behavior (of always automatically logging you into WordPress) is achieved.

    I tried (unsuccessfully) to modify the code in my ad-integration.php as suggested at, but also with alexnolan‘s code modification above.

    It simply killed my SSL authentication altogether. (For what it’s worth, my deployment is on a redundant 4-server web-farm running WinServer 2008 R2 and IIS7.5 with Windows Authentication.) Should I have disabled Anonymous Authentication when trying this? Is that why it didn’t work?

    RealDolmen – IIS Authentication Plugin

    Look up that plugin. I use it on my IIS envrio and it works AMAZINGLY.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Active Directory Integration] is auto authentication still on the horizon?’ is closed to new replies.