We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    I can't get modActiveDirectory to authenticate, I've tested the user credentials against the AD with an LDAP browser & can authenticate like that, however, I get these errors in the modx logs:

    [2014-02-10 16:49:47] (WARN @ /modx/index.php) Could not load package metadata for package activedirectory.
    [2014-02-10 16:49:47] (INFO @ /modx/index.php) [ActiveDirectory] Could not authenticate user: "user@domain" with password "password".
    [2014-02-10 16:49:50] (WARN @ /modx/connectors/system/errorlog.php) Could not load package metadata for package activedirectory.


    I'm not sure what the problem is, or how to even troubleshoot it...

    - Do the active directory users have to exist in modx before authentication, or will the modActiveDirectory extra create them?
    - If I create the user with the same credentials, I don't get the "could not authenticate" error.
    - but then is the user authenticating against modx or the active directory??
      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 39404
      • 175 Posts
      stalemate resolution associate Reply #2, 12 years, 7 months ago
      Hi Sean,

      I haven't used modActiveDirectory yet, but I know I will be at some point in the future, so I took a look at your post.

      When you set it up, did you set up the two settings "activedirectory.account_suffix" and "activedirectory.domain_controllers"?

      By the look of the error, it looks like it is using defaults.

      Quote from: sean69 at Feb 10, 2014, 03:56 PM

      - Do the active directory users have to exist in modx before authentication, or will the modActiveDirectory extra create them?
      - If I create the user with the same credentials, I don't get the "could not authenticate" error.
      - but then is the user authenticating against modx or the active directory??

      Based on the documentation http://rtfm.modx.com/extras/revo/modactivedirectory#modActiveDirectory-Installation, you set up groups in MODX which match the AD groups, and from there, MODX will create the users for you, but this is based on me quickly scanning the documentation.

      Regards,
      Tom
        • 26503
        • 620 Posts
        Well after digging through some code: it's definitely supposed to create a user that is not found in modx:

        core/components/activedirectory/elements/events/onusernotfound.php:
        /* authenticate the user */
        if ($madDriver->authenticate($username,$scriptProperties['password'])) {
        	$modx->log(modX::LOG_LEVEL_INFO,'[ActiveDirectory] Attempting to authenticate user');
        
            $user =& $scriptProperties['user'];
            $user = $modx->getObject('modActiveDirectoryUser',array('username' => $username));
            if (empty($user)) {
                $user = $modx->newObject('modActiveDirectoryUser');
                $user->set('username', $username);
                $user->set('active',true);
                $user->save();
                $profile = $modx->newObject('modUserProfile');
                $profile->set('internalKey',$user->get('id'));
                $profile->save();
                $user->Profile =& $profile;
            } else {
                $user->getOne('Profile');
            }
            $modx->event->_output = $user;
            $modx->event->stopPropagation();
            return;
        }
        $modx->log(modX::LOG_LEVEL_INFO,'[ActiveDirectory] Could not authenticate that user: "'.$username.'" with password "'.$scriptProperties['password'].'".');



        Some other digging shows that it is supposed to update a user from the AD as well, if I create the user then it complains about the user not being a member of modActiveDirectoryUser group - even if I create the group and add the user.


        Looks like a long night ahead sad



          *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

          Sean Kimball CLP, CLS.
          Technical Director / Sr. Developer | BigBlock Studios
          ._______________________________________________.
          Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
          27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
          phone/fax: 905-426-5525
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          From the looks of those error messages, MODX isn't able to properly load activedirectory in the first place, so the rest of the script can't work.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 39404
            • 175 Posts
            stalemate resolution associate Reply #5, 12 years, 7 months ago
            Sean,

            Did you set these settings? See attachment.

            Regards,
            Tom
              • 26503
              • 620 Posts
              This was a stupid mistake on my part. [well not completely me] Something was bugging me while looking at the 'Could not authenticate user: "user@domain" with password "password".' error. The user name - they gave me the user name as user@domain- no one logs in like that, after removing the @domain everything works just fine. Silly mistake.
                *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                Sean Kimball CLP, CLS.
                Technical Director / Sr. Developer | BigBlock Studios
                ._______________________________________________.
                Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                phone/fax: 905-426-5525
                • 26503
                • 620 Posts
                I see the "Could not load package metadata" errors frequently in most modx sites - one of these days I'll track it down [prolly permissions or something] - works anyway.

                Quote from: sottwell at Feb 10, 2014, 10:17 PM
                From the looks of those error messages, MODX isn't able to properly load activedirectory in the first place, so the rest of the script can't work.
                  *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                  Sean Kimball CLP, CLS.
                  Technical Director / Sr. Developer | BigBlock Studios
                  ._______________________________________________.
                  Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                  27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                  phone/fax: 905-426-5525
                  • 39404
                  • 175 Posts
                  stalemate resolution associate Reply #8, 12 years, 7 months ago
                  Hi Sean,

                  Thanks for letting us know how it turned out.

                  Regards,
                  Tom