SimpleSAML Integration between Moodle and WordPress

Below steps detail Moodle as IDP (Identity Provider) and WordPress as consumer of the service (i.e WordPress login through moodle system). I have started installation from the  moodle link however find some steps are highlevel so in this post i have detail these steps so that this will help others.

We need 3 components to work this installation 1)  SimpleSAMLphp local installation 2) Moodle plugin SAML Identity Provider 3) WordPress WP SAML Auth plugin.

Step 1: Download simplesamlphp from https://simplesamlphp.org/download and copy to your server /tmp folder. unzip the file using below command

 sudo tar -xvf simplesamlphp-1.18.8.tar.gz

Copy extracted folder to /var/simplesamlphp 

 we need to enable /var/simplesamlphp/www folder access from web to perform the singlesignon. Make below changes to /etc/apache2/sites-available/default-ssl.conf file add below after the existing document directory.

Alias “/simplesamlphp” “/var/simplesamlphp/www”

add below in /etc/apache2/apache2.conf after “all directory permission granted”

#Allow simple saml allow for login and logout

<Directory /var/simplesamlphp/www/>

AllowOverride None

Require all granted

</Directory>

Restart apache2 : sudo service apache2 restart

lastly modify /var/simplesamlphp/config/config.php following:

‘baseurlpath’ => ‘simplesamlphp/’

check www.example.com/saml is working.. if you can see something below then you are good to proceed with next level modifications.

modify /var/simplesamlphp/config/config.php following

‘baseurlpath’ => ‘simplesamlphp/’,
‘secretsalt’ => ‘Generate Secreat Salt using command given on the file’,
‘auth.adminpassword’ => ‘Change it’,
‘store.type’ => ‘sql’,
‘store.sql.dsn’ => ‘mysql:dbname=dbname;host=localhost’,
‘store.sql.username’ => ‘db user name‘,
‘store.sql.password’ => ‘db password‘,
‘store.sql.prefix’ => ‘prefix‘,

‘technicalcontact_name’ => ‘Domain Admin’,
‘technicalcontact_email’ => ‘Domain Email contact’,
‘timezone’ => ‘update as per your timezone’,

‘enable.saml20-idp’ => true,

cert path change it to where your domain certificate available. Make sure you have server.crt and server.pem file in this directory. If you are using LetsEncrypt then change server.pem to server.key.

Create DB for SimpleSAML keep all the session information.

sudo mysql -u mysqladm -p

create database dbname;

create user ‘db user id‘@’localhost’ IDENTIFIED BY ‘db password‘;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON dbname.* TO ‘db user id‘@’localhost’;
FLUSH PRIVILEGES;

modify /var/simplesamlphp/config/authsources.php following

// This authentication source serves as an example of integration with an
// external authentication engine. Take a look at the comment in the beginning
// of modules/exampleauth/lib/Auth/Source/External.php for a description of
// how to adjust it to your own site.
‘moodle-userpass’ => [
‘moodle:External’,
‘moodle_coderoot’ => ‘moodle installation root‘,
‘logout_url’ => ‘https://www.example.com/moodle/auth/samlidp/logout.php’, // plugin’s logout page
‘login_url’ => ‘https://www.example.com/moodle/login/index.php’, // standard Moodle login page
‘cookie_name’ => ‘MoodleSAMLIDPSessionID’,
],

modify /var/simplesamlphp/metadata/saml20-idp-hosted.php following

‘auth’ => ‘moodle-userpass’,

Login to moodle system and Install SAML Identity Provider plugin. provide following as input SimpleSAMLphp installation directory: /var/simplesamlphp
Auth source: moodle-userpass 

Navigate to Site administration->Plugins->Manage authentication->SAML Authentication

and enable the module by clicking eye icon.

Verify Moodle authentication is working by below steps: Go to https://www.example.com/saml and click tab “Authentication” and click “Test authentication sources” and click “moodle-userpass” and you will routed to moodle loginpage. Once you authenticated in moodle and you will redirected to saml page with the attribute that are available for consumer.

see the wordpress consumer integration in my next post.

 

30 thoughts on “SimpleSAML Integration between Moodle and WordPress

  1. Every weekend i used to pay a quick visit this web site, for the reason that i want enjoyment, for the reason that this this web page conations really good funny material too.| Beatrice Nefen Merideth

  2. Hello. This article was extremely fascinating, particularly since I was looking for thoughts on this matter last Wednesday. Deny Isaak Dam

  3. When someone writes an post he/she retains the image of a user in his/her mind that how a user can be aware of it.
    Therefore that’s why this article is great. Thanks!

    Stop by my homepage :: Quiz

  4. Greetings! I know this is somewhat off topic but I was wondering if you knew
    where I could locate a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having trouble finding
    one? Thanks a lot!

  5. I am really loving the theme/design of your site. Do you ever
    run into any internet browser compatibility problems? A few
    of my blog audience have complained about my blog not working correctly in Explorer
    but looks great in Chrome. Do you have any advice to help fix this
    issue?

    Check out my web blog … 스포츠토토

  6. Hi there, just became aware of your blog through Google, and found that it is truly informative.
    I’m going to watch out for brussels. I will appreciate if
    you continue this in future. Lots of people will be
    benefited from your writing. Cheers!

  7. Very nice post. I just stumbled upon your blog and wished to say that I’ve
    really loved surfing around your weblog posts. In any case I will be subscribing on your feed and I
    am hoping you write once more soon!

    Here is my blog post :: Belle

  8. Have you ever thought about publishing
    an ebook or guest authoring on other sites?
    I have a blog based on the same subjects you discuss and
    would love
    to have you share some stories/information. I know my readers
    would value your work.
    If you are even remotely interested, feel free to send me an
    e mail.

  9. Hello there! I could have sworn I’ve been to
    this web site before but after browsing through some of the posts I realized it’s new to me.
    Anyhow, I’m definitely delighted I found it and I’ll be bookmarking it and checking back often!

    Feel free to surf to my web page … jasa foto jakarta

Leave a Reply to Douglas Cancel reply

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