Drupal to Moodle SSO

We are often asked by clients if it would be possible to create a Single Sign-on between their CMS and Moodle or Totara. Since this question has come up a few times for us, I decided to build  us a custom adaptor to solve the problem.
I started off by building my own authentication method for Moodle/Totara that would allow pretty much any CMS to connect to it. I also build a small test template that allows me to simulate a CMS passing values to my authentication block. This allows me to test the authentication block on a new installation without needing a CMS present.
Once I had the auth block build, I defined the basic information I would need from a CMS, as well as the route the data would take during the SSO. If you understand this, SSO is not to tricky.
Below are a few steps showing how this was done from Drupal 7.2.x to Moodle 2.6
Steps taken:
  1. Install the ssso auth method to Moodle.
  2. Log into Moodle and make sure this auth method is enabled.
  3. Create a block in Drupal containing the necessary fields and URL to the Moodle site.
  4. Make sure the block is only available to authenticated users.
  5. I did not make it available to Administrators since I wanted the two sites to have unique administration access rights.
  6. Add custom fields to Drupal for – firstname, lastname, city and country.

Below are some screen shots showing the process in action.

Create custom fields for the user profile

Create custom fields for the user profile

Set up the display location for the block

Set up the display location for the block

Configure the block to only show when a user has logged in

Configure the block to only show when a user has logged in

Create a new Drupal user

Create a new Drupal user

User details completed in Drupal

User details completed in Drupal

Log into Drupal with the new user

Log into Drupal with the new user and click the Access Moodle button

Click the Access Moodle button and sign into the Moodle site

Access the Moodle site without re-authenticating

 

 

11 thoughts on “Drupal to Moodle SSO

    • It’s my pleasure. I believe there is a big opportunity to extend Moodles functionality through integration with other systems or extending the existing functionality.

  1. Thanks for the information.
    I want to follow your instruction.
    Where can I find “the ssso auth method” you describe?

    • Hi

      Sadly the client permitted us to share the screens but not the plugin. We hope they will allow us to make it public and then I’ll send you a complete guide on how to use it. Apologies for that.

  2. Pingback: Drupal to Moodle SSO | iLite's Weblog | Web 3.0...

  3. Pingback: Drupal to Moodle SSO | drupal nikki | Scoop.it

  4. Hi Sean, Really a great job. Struggling to have SSO feature from Drupal 7 to Moodle 2.8. Didn’t find any proper documentation. Everything done as per this blog. But ‘auth block build’ missed. Can you please help me. Thanks

  5. Hi Sean, Done a great job. Since last week struggling with Moodle SSO feature with Drupal 7. Install lot of Drupal contributed modules but no luck. Gone through this blog and followed the same. But stuck in button creation in block called ‘auth block’. Can you please guide me. Thanks a lot in advance.

    • Hi Lalitha
      I have not looked at the Drupal to Moodle SSO in a long time. I have a custom auth method in Moodle that I point to from Drupal. I have build this auth method in such a way that I can pretty much connect anything to Moodle using it. I am not sure if that’s what you are referring to above.

Leave a Reply

Your email address will not be published. Required fields are marked *