Pages

Wednesday, August 17, 2016

Edwiser Single Sign On (SSO) extension to access Moodle and WordPress

Two Doors by Stefan W.
Licensing: Creative Commons,
Attribution 2.0 Generic (CC BY 2.0)
http://goo.gl/sVgWXa
This is the second post in a series of five posts featuring the Edwiser Bridge and its four extensions. To re-cap, these WordPress plugins allow you to integrate Moodle with WordPress. In today's post I will focus on the Edwiser Single Sign On Extension which is a commercial plugin.

Image 1. The SSO extension icon.

This extension is an integral component in an e-Commerce system that comprises of Moodle, WordPress and WooCommerce. It works in tandem with the other compnents to create synergy in your system.


Section I. Overview

Image 2. The Big Picture. Where 
the SSO extension fits in.

What is the Single Sign On?
Single sign-on (SSO) is a session and user authentication service that allows a user to use a set of login details - name and password - to access two or more applications, in this case, WordPress and Moodle.

The Single Sign On extension allows you to enter your login credentials once in Wordpress, and to be logged into both WordPress and Moodle at the same time. So with this Edwiser extension, you will be able to, from within WordPress, launch directly into a Moodle site without having to go through the Moodle login page. This extension, used in tandem with Edwiser Bridge and the other three extensions, produce operational synergy for your website.



Installation Guide
As a purchaser of this extension, you would have received an E-mail that would allow you to download two key zip files – ‘edwiser-bridge-sso.zip’  and ‘wdmwpmoodle.zip’.


Section II. SSO Installation on WordPress


Steps 1 to 8 are in WordPress.

Install the ‘edwiser-bridge-sso.zip’ on your WordPress website.

Step 1. Go to the ‘Plugins’ menu from the dashboard.

Image 3. Add a new plugin.

Step 2. Click the ‘Add New’ button on this page.
Step 3. Click on the ‘Upload Plugin‘ button and upload the ‘edwiser-bridge-sso.zip’ file.

Image 4. Choose File.

Step 4. Click on ‘Install Now’ button once you have located and uploaded the plugin.
Step 5. On successful installation click the ‘Activate Plugin’ link to activate the plugin.

Image 5. Activate the plugin.

Step 6. Go to Edwiser Bridge | Settings | Licenses tab.
Step 7. Look for the label "Edwiser Bridge Single Sign On" and paste the license key into the edit box
Step 8. Click the "Activate License" button.

Image 6. Active the license.

Section III. SSO Installation on Moodle

Steps 9 to 13 are in Moodle.
Install wdmwpmoodle.zip on your Moodle website.

Step 9. In your Moodle site, go to Site administration | Plugins | Install plugins

Image 7. Install the wdmpmoodle plugin.

Step 10. Upload the wdmpmoodle.zip file by clicking on the "Choose a file" button. Navigate to the folder where the zip file is stored and select it.

Image 8. Pick the file.

Step 11. At the Plugin type drop down list, choose "Authentication method (auth)" and click the "Install plugin from the ZIP file" button to install the plugin.

Image 9. Installation settings.

Step 12. Go to Site administration | Plugins | Authentication|Manage authentications
Step 13. Enable the Edwiser Bridge SSO plugin by clicking the 'closed eye' icon.

Image 10. Authentication.

Section IV. Generating the Secret Key on WordPress and Moodle


Both websites need to communicate via a secret key.
Steps 14 to 16 are in WordPress.

Step 14. Go to Edwiser Bridge | Settings | General tab.
Step 15. At the Single Sign On Settings section, you will see the Secret Key edit box. Type in a secret key value
Step 16. Click the "Save Changes" button when finished.

Image 11. Add in the Secret Key.
Steps 17 to 19 are in Moodle.
Now we have to set the same secret key value on the Moodle site.

Step 17. Go to Site administration | Plugins | Authentication | Edwiser Bridge SSO
Step 18. Enter the exact same secret key that was entered at Step 16, in the "Secret key" edit box.

Image 12. Paste the same Secret Key value into Moodle.

Step 19. Click the "Save changes" button to save the setting.


Section V. Navigating and redirecting between WordPress and Moodle

It would be good to make a way for the user to jump from WordPress directly into Moodle. Likewise, the user should be able to jump back to WordPress once they have logged out of Moodle.

Steps 20 to 35 are in WordPress.

Let's now create a link on the WordPress site that will bring the user direct to Moodle.

Step 20. From your WordPress Dashboard, go to Pages | Add New.
Step 21. Enter the name of your page. For example, "Go to Moodle".
Step 22. Type the shortcode [wdm_generate_link].
Step 23. Click the "Update" button to save the page.

Image 13. Link to Moodle short code.

Next, you should add the page to your WordPress menu. To do this,

Step 23. At the Dashboard, go to Appearance | Menu.
Step 24. At the Menu Name, type "Header1".
Step 25. Click the "Create Menu" button.

Image 14. Adding the link to the WordPress header menu.

Step 26. In the Pages panel on the left, go to the "Most Recent" tab and tick the two items named "Go to Moodle" and "User Account".
Step 27. Click the "Add to Menu" button to add both items to the "Header1" menu.

Image 15. Adding more links to the header menu.

Step 28. Let's also add a WordPress course link to the menu. Under the Pages section, click the "Custom Link" accordion.
Step 29. Type the Edwiser course link, i.e., "http://www.tornado2.com/ecomm/courses/mynewcourse/", inside the URL edit box.
Step 30. Type "Course" inside the "Link text" edit box.
Step 31. Click the "Add to Menu" button.

Image 16. Adding a link to the WordPress course in WordPress' header menu.

Step 32. Under the Menu Settings section, tick the "Primary Menu" checkbox.
Step 33. Click and drag the "Course" menu item so that it is above "Go to Moodle" and "User Account" items.
Step 34. Click the "Save Menu" button.

Image 17. Arranging the menu items.

Step 35. Open your WordPress website in a web browser. You should see the "Course" and "Go To Moodle" links at the top menu.

Image 18. Preview.

We're almost there! Let's now make it so that when a user logs off from Moodle, he or she will be redirected to WordPress.
Steps 36 to 42 are in Moodle.

To do this, you need to download and install the "Login/Logout user redirection" Moodle plugin.

Step 36. In your Moodle site, go to Site administration | Plugins | Install plugins
Step 37. Click the "Install plugins from the Moodle plugins directory" button.

Image 19. Install the Login/Logout plugin for Moodle.

Step 38. Log into Moodle.org (you must setup an account there first!)

Image 20. Go to Moodle.org (you will need an account, of course).

Step 39. Type "Login/Logout user redirection" inside the "Search plugins" search box.
Step 40. Click the "Search plugins" button. You should see the plugins page.
Step 41. Click the "Login/Logout user redirection" link.

Image 21. The Login/Logout User Redirection mod page.

Step 42. Click the "Versions" link.

Image 22. Access the correct version.

Depending on the version of Moodle that you are using, you may or may not be able to automatically install the plugin.

Image 23. Install or Download? Your choice.

For example, if you are using Moodle 3.1, they would have to click the "Download" button and manually install the plugin by using File Transfer Protocol.

To manually install the "Login/Logout user redirection" plugin, follow these instructions:
(1) FTP the loginlogoutredir folder to MOODLE_HOME/auth/.

Image 24. FTP with FileZilla.

(2) Add two entries to your MOODLE_HOME/config.php file:
$CFG->loginredir = "{$CFG->wwwroot}/plus/some/different/path"
$CFG->logoutredir = "Any URL you want"

For example,
$CFG->loginredir = "{$CFG->wwwroot}/course/view.php?id=3";
$CFG->logoutredir = 'http://www.tornado2.com/ecomm/';
where course/view.php?id=3 is the Moodle course that the user has just paid for.

(3) Login to Moodle with your admin account.
(4) Go to: Site Administration|Plugins|Authentication|Manage Authentication
(5) ENABLE "Login/Logout user redirection". This step is very important!
(6) Save changes


Section VI. Testing the navigation between WordPress and Moodle

Now the Single Sign On functionality between both the WordPress and Moodle sites will be seamless.
  Here's the proof:

You are logged out from both WordPress and Moodle.
As a user, you click on the "Buy Course" link at the header menu.

Image 25. Preview.

You are brought to the page for the MyNewCourse course. You click on the "TAKE THIS COURSE" button.
Image 26. Walkthrough.

You are presented with the login screen. You click on the "Don't have an account" link because you have never setup an account on this WordPress site.

Image 27. The first-time user will have to create an account.

You enter your login details and click the "REGISTER" button.

Image 28. Registration page. Normal.

You click the "TAKE THIS COURSE" button...

Image 29. Take the course.

...which, for a free course, changes into an "ACCESS COURSE" button because at the moment, there is no payment gateway setup for the course. You click on the "ACCESS COURSE" button.

Image 30. Access the course.

You are transported to the Moodle course that you 'bought' for free. After some time, you decide that you have had enough. So you click on the Logout link.

Image 31. Vola! You're in Moodle immediately. Moodle's login screen was bypassed.

When you click the "Logout" link, Moodle's "Login/Logout Redirection" plugin redirects you to the WordPress site. If you click on the "Go to Moodle"...
Image 32. Redirected back to WordPress.

You are brought back to the Moodle website which is http://www.tornado2.com/m31.

Image 33. Jumping back to Moodle from WordPress. That's how the flow goes.

Conclusion

This plugin gives you the convenience of access and seamless integration between WordPress and Moodle. A single username and password on the WordPress website gains your users access on WordPress as well as Moodle simultaneously.

The Edwiser Bridge's Single Sign On extension is a must-have for any serious web developer who wants to integrate WordPress and Moodle! For further information about this extension click here.

End of Post 2 of 5.

If you like this post or site
a small donation would be nice but would last only a day,
otherwise leaving a comment (or a compliment) below will last me a month!

Ratings and Recommendations by outbrain