We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30625
    • 19 Posts
    Hi folks,

    i installed Modx severall weeks ago. Meanwhile i think it’s usable for my needs.
    I use modx with Oracle, MySQL and MSSQL. Mixedup use is no problem
    it is installed on a sun server. the DB’s are on different machines (except the modx db)

    I tried to read a lot of messages but it is too much to find all smiley

    First i added templatechunk from wendy (great work).
    Then i needed Single Sign On and information from the LDAP.
    I read a lot in the forum, but nobody seems to have it work.
    Wel i do

    there are 2 ways to get the windows login data, i used the header based one. allthough i tested with the apache version and also works fine.

    Before i do my best to make it a nice looking snippet i want to know if this is still interesting for some.
    I can imagine to put this in core, because the usage is simple.

    My versions works like this:
    1) i added a plugin and trigger this on several points.
    2) i modified weblogin.processor.inc.php
    3) our network engineer add all groups in AD as i wanted them. (create them in modx first). Modified all users (250) with groups and language
    4) i added a module which connect with ldap and get all web userinformation like language (we have 4, durch, english, german and polish) and groups fitting to modx.
    5) users will be blocked if they are not in AD (or blocked), groups will be deleted and add new from AD. First i checked the changed stadium. but it then the source is several rows longer and result and executiontime same.
    so first i delete all groups for every user and add them new. i update language.
    This module can be used by clicking, but i also use it as a cronjob.

    From now on, all users who come on the intranet page will be recognized (with username and computername) en get the rights from modx as wanted.

    because the source i made still is spagheti ( grin) i need valueble time to make it shareble and therefor let me know the interest.
      no mail. no icq, no aim, no msn, no yim, no sms, no phone, no fax, no telex, no satellite.... just yell smiley
      • 25663 MODX Staff
      • 12,272 Posts
      I can say without question this would be an awesome contribution. Please share!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 30223
        • 1,010 Posts
        I second that!
          • 7231
          • 4,205 Posts
          I third that shocked This sounds very interesting.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 30625
            • 19 Posts
            wel i am still not THAT familiar with the modx code. still searching and approving.
            so i will try to make the code more modx-way and transmit.
            i will need couple of days.

              no mail. no icq, no aim, no msn, no yim, no sms, no phone, no fax, no telex, no satellite.... just yell smiley
              • 29298
              • 6 Posts
              this would be amazing!
              if you can share your work (even not yet modx-friendly), i or the community could help to speed up the dev process wink

              lot of SSO interests here smiley
                • 17883
                • 1,039 Posts
                Would be awesome!
                  • 30625
                  • 19 Posts
                  Fellows, this is my first attempt to share my knowledge with others.
                  If you have tips (even to straighten the spaghetti up) i will be very pleased

                  Syntax:
                  on every pagestart weblogin will force the plug in ntlm.
                  It will send a header to IE end return. Then it will read the header. The name, domain en Machine will be in there.
                  In order to cooperate with the network administrator, he needs access to a LDAP Module.
                  Every user will be created in LDAP. Every day the administrator can use the LDAP Module to import the userdata from LDAP.
                  NB. I decided NOT to update, but DELETE ALLE DATA and import again. i find some trouble with update.
                  `
                  Installation:
                  Following steps have to be done
                  1) modify weblogin snippet
                  2) modify weblogin.processor.inc.php
                  3) create plug-in ntlm
                  4) create LDAP Module.

                  Weblogin Snippet:
                  # ADD these lines for SSO
                  # We simulate a login screen and fill a $_POST['username'].
                  # By doing this, we do not have to major modify weblogin snippet and
                  # changes we have to do as we update modx is minimum*/
                  $_POST['username'] = check_user();
                  	if(!$modx->getLoginUserID()){
                  	  $_POST['cmdweblogin'] = 'Login';
                  	}
                  # End SSO


                  Standard configuration:
                  add "&sso=SSO;string;true"
                  Empty string to disable sso

                  weblogin.processor.inc.php
                  change line 192: if(!$sso) $givenPassword = $modx->db->escape($_POST[’password’]);
                  change line 218: if(!$sso) $dbasePassword = $row[’password’];

                  create a plug-in ntlm
                  Name: NTLM
                  Description: <strong>1.0</strong> - Provide the system of the headers
                  System configuration:
                  OnLoadWebDocument On
                  OnParseDocument On
                  OnWebAuthentication On
                  Put in the code from plugin.ntlm.php

                  create a Module LDAP
                  Name: LDAP
                  Description: <strong>1.0</strong>- Import and Change Userdata from LDAP
                  Put in the code from module.ldap.php
                  Modify the module as you needed. Please do not forget the check the groupname.
                  In my example i use "grp-intranet-" on line 105, 126, 166, 188
                  You can make a variable, but i decided not to, because every line is called different.
                  i just use same name in my example

                  In order to let the networkadministrators do the user job i wrote a module to read the usernames out of LDAP
                  LDAP works like this:
                  i create webusergroups on modx.
                  For example: planning
                  On LDAP we also make a group, but we name this grp-intranet-planning
                  grp-intranet- is made to keep all the groups conform
                  in this example we nee to be sure planning is spelled the same.

                  After running the module, all new users are imported and the groups and languages will be assigned to the users.

                  i hope it will help you all. id did for me.
                  i will modify code for better usage. if you have tips to clean the code up. let me know.

                  Problem/Todo:
                  Using SSO, manager login will not work with IE.
                  For Manager login use FireFox or Chrome
                    no mail. no icq, no aim, no msn, no yim, no sms, no phone, no fax, no telex, no satellite.... just yell smiley
                    • 309
                    • 24 Posts
                    Can this also work with WebloginPE?
                      • 30625
                      • 19 Posts
                      i never build it with weblofinPE but it should also be working because you manipulate the posting from a form to the auth class.

                      check in WebloginPE what it needs as POST data. For examplei found in the WebLoginPE-class:

                      $this->Username = $modx->db->escape(strip_tags($_POST[’username’]));
                      $this->Password = $modx->db->escape(strip_tags($_POST[’password’]));

                      with SSO disable password. you do not need password check at all, because windows checked for you.
                      change username line with $_POST[’username’] = check_user();
                      Make sure check_user can be called (from plugin ntlm)

                      Be careful, for autologin (within webloginPE class) you need password. So just disable with login function. The class will make a cookie en session, no need to change all of it.

                      good luck

                      ps. functionality with IE is bad (all others is ok) therefor i desided to change module NTLM in order to use the NTLM mod from apache. now it works with all browsers.
                        no mail. no icq, no aim, no msn, no yim, no sms, no phone, no fax, no telex, no satellite.... just yell smiley