Authentication: SAML2 Single sign on

Maintained by Picture of Catalyst IT Catalyst IT, Picture of Brendan Heywood Brendan Heywood, Picture of Adam Riddell Adam Riddell, Picture of Daniel Thee Roperto Daniel Thee Roperto, Picture of Rossco Hellmans Rossco Hellmans, Picture of Kristian Ringer Kristian Ringer
SAML done 100% in moodle, fast, simple, secure
834 sites
44 fans

What is this?

This plugin does authentication, user auto creation with field mapping.

Why is it better?

  • 100% configured in the Moodle GUI - no installation of a whole separate app, and no touching of config files or generating certificates.
  • Minimal configuration needed, in most cases just copy the IdP metadata in and then give the SP metadata to your IdP admin and that's it.
  • Fast! - 3 redirects instead of 7
  • Supports back channel Single Logout which most big organisations require (unlike OneLogin)

How does it work?

It completely embeds a SimpleSamlPHP instance as an internal dependancy which is dynamically configured the way it should be and inherits almost all of it's configuration from Moodle configuration. In the future we should be able to swap to a different internal SAML implementation and the plugin GUI shouldn't need to change at all.


  • Dual login VS forced login for all as an option, with ?saml=off on the login page for manual accounts, and ?saml=on supported everywhere to deep link and force login via saml if dual auth is on.
  • SAML attributes to Moodle user field mapping
  • Automatic certificate creation
  • Optionally auto create users

Features not yet implemented:

  • Enrolment - this should be an enrol plugin and not in an auth plugin
  • Role mapping - not yet implemented


1) Install the plugin the same as any standard moodle plugin either via the Moodle plugin directory, or you can use git to clone it into your source:

git clone auth/saml2

2) Then run the Moodle upgrade 3) If your IdP has a publicly available XML descriptor, copy this url into the SAML2 auth config settings page 4) If your IdP requires whitelisting each SP then in the settings page is links to download the XML, or you can provide that url to your IdP administrator.

For most simple setups this is enough to get authentication working, there are many more settings to define how to handle new accounts, dual authentication, and to easily debug the plugin if things are not working.

If you have issues please log them in github here:

Or if you want paid support please contact Catalyst IT Australia:


This plugin has been tested against:

  • SimpleSamlPHP set up as an IdP
  • An AAF instance of Shibboleth

Other SAML plugins

The diversity and variable quality and features of SAML Moodle plugins is a reflection of a great need for a solid SAML plugin, but the neglect to do it properly in core. SAML2 is by far the most robust and supported protocol across the internet and should be fully integrated into moodle core as both a Service Provider and as an Identity Provider, and without any external dependencies to manage.

Here is a quick run down of the alternatives:


  • /auth/shibboleth - This requires a separately installed and configured Shibbolleth install

One big issue with this, and the category below, is as there is a whole extra application between moodle and the IdP, so the login and logout processes have more latency due to extra redirects. Latency on potentially slow mobile networks is by far the biggest bottle neck for login speed and the biggest complaint by end users in our experience.

Plugins that require SimpleSamlPHP

These are all forks of each other, and unfortunately have diverged quite early or have no common git history making it difficult to cross port features or fixes between them.

Plugins which embed a SAML client lib:

These are generally much easier to manage and configure as they are standalone.

  • - This one uses it's own embedded saml library which is great and promising, however it doesn't support 'back channel logout' which is critical for security in any large organisation.

  • This plugin, with an embedded and dynamically configured SimpleSamlPHP instance under the hood

Warm thanks

Thanks to the various authors and contributors to the other plugins above.

Thanks to LaTrobe university in Melbourne for sponsoring the initial creation of this plugin:


Thanks to Centre de gestion informatique de l’éducation in Luxembourg for sponsoring the user autocreation and field mapping work:


This plugin was developed by Catalyst IT Australia:

Catalyst IT


Screenshot #0


Picture of Catalyst IT
Catalyst IT (Lead maintainer)
Picture of Adam Riddell
Adam Riddell: Developer
Picture of Daniel Thee Roperto
Daniel Thee Roperto: Developer
Picture of Rossco Hellmans
Rossco Hellmans: Developer
Picture of Kristian Ringer
Kristian Ringer: Developer
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Jignesh Patel
    Tue, 31 Jul 2018, 10:00 PM
    I Have Moodle 3.4 /3.5 Installed on PHP + IIS + MSSQL environment. Moodle installation completed successfully. Installed SAML2 SSO plug in which installed successfully too but i'm unable to see SAML SSO login button in Moodle login page. not sure what missing and there was not any error. Need Help.
  • Wazza
    Mon, 13 Aug 2018, 6:57 PM
    There seems to be something wrong with the zip-file (Moodle 3.5). When trying to install this plugin (among many others) I get this error (only with the SAML plugin)

    Fatal error: Maximum execution time of 30 seconds exceeded in /moodle/filestorage/zip_archive.php on line 253

    It seems Moodle can not unpack the zip-file from this plugin.
  • Wazza
    Wed, 19 Sep 2018, 9:41 PM
    After installing the latest version I'm getting the following errors:

    Exception - [ARRAY]: The option 'Format' is not a valid string value.

    More information about this error

    ×Debug info:
    Error code: generalexceptionmessage
    ×Stack trace:
    line 197 of /auth/saml2/extlib/simplesamlphp/lib/SimpleSAML/Auth/Source.php: SimpleSAML_Error_UnserializableException thrown
    line 161 of /auth/saml2/extlib/simplesamlphp/lib/SimpleSAML/Auth/Simple.php: call to SimpleSAML_Auth_Source->initLogin()
    line 103 of /auth/saml2/extlib/simplesamlphp/lib/SimpleSAML/Auth/Simple.php: call to SimpleSAML\Auth\Simple->login()
    line 474 of /auth/saml2/auth.php: call to SimpleSAML\Auth\Simple->requireAuth()
    line 324 of /auth/saml2/auth.php: call to auth_plugin_saml2->saml_login()
    line 308 of /auth/saml2/auth.php: call to auth_plugin_saml2->loginpage_hook()
    line 2622 of /lib/moodlelib.php: call to auth_plugin_saml2->pre_loginpage_hook()
    line 12 of /admin/upgradesettings.php: call to require_login()
  • Picture of Colin G
    Thu, 18 Oct 2018, 8:47 AM
    Hi. I am new to windows adfs/saml2 auth and I am trying to setup auth to our domain controller. I have setup the plugin but when I try to login via SAML2 I get this error:

    You have logged in succesfully but we could not find your 'uid' attribute to associate you to an account in Moodle.

    when I run moodle/auth/saml2/test.php all I see is:


    array(0) {

    Can anyone give me help here or know what I am missing ??
  • Picture of marc marc
    Thu, 18 Oct 2018, 10:27 PM
    Hello, Is it possible to map two fields in one doing a concatenation in the data mapping? like data mapping (study) : "$programme.$semester" or something like this? i tried a lot of combination but nothing worked. may be it's not possible, but i would like your confirmation smile Thank you.
  • Picture of Mohammed Abdul Azeem
    Wed, 2 Jan 2019, 5:01 PM
    Hi team,

    Am new to sso, Can anyone help me , am trying to do sso to my moodle to Edx using this plugin , if i give the xml url of Edx , it's showing settings not changed due to the error (The IdP XML has no entityID) , kindly help me
  • Picture of Mohammed Abdul Azeem
    Thu, 24 Jan 2019, 2:58 PM
    Can anyone help me for the error , please this is urgent
  • Picture of Mohammed Abdul Azeem
    Thu, 24 Jan 2019, 4:15 PM
    Can anyone help me for the error , please this is urgent
  • Picture of Adam Riddell
    Fri, 25 Jan 2019, 6:36 AM
    Hi Mohammed,

    It sounds like the IdP metadata link that you're using from Edx isn't right. You may be able to visit the XML URL in your browser and check the XML yourself. Usually the entityID will be one of the first elements you see on the page - it would look something like: the other thing to keep in mind is that if you're using a URL it must be accessible from the host that is serving Moodle. If the IdP is only accessible from within a private network that can't be reached from Moodle you may be able to copy the XML metadata and upload that, but in this case only users that can access the IdP from within this private network will be able to authenticate via SAML.
  • Picture of Adam Riddell
    Fri, 25 Jan 2019, 6:41 AM
    Hi Marc,

    No unfortunately the plugin doesn't support combining two fields for one mapping at the moment. I'd say your best bet would be to look into getting the IdP to expose the two concatenated fields as an additional field.
  • Picture of Adam Riddell
    Fri, 25 Jan 2019, 6:50 AM
    Hi Colin,

    I'd recommend you double check the "Mapping IdP" field that you've configured in the SAML2 plugin - it sounds like this might be empty or doesn't match any fields exposed by your IdP.
  • Picture of Mohammed Abdul Azeem
    Fri, 25 Jan 2019, 2:45 PM
    Hi Adam, this is the Edx meta data url , i hope this has Entity id , but am getting error as IDP xml has no entity id , could you please check and help me
  • Picture of ilun leem
    Thu, 14 Feb 2019, 5:10 PM
    Hi, team? can this plugin work in idp initiated mode, if then how to do? Thanks
  • Picture of Susan Mangan
    Thu, 7 Mar 2019, 9:41 AM
    Hi! I need help/info!!

    I am JUST in the process of upgrading our Moodle to 3.6 and just found out we will be looking to use saml for sso in the near future. It looks like your plug-in is by far the best supported so I am hoping it is supported with 3.6 and that perhaps the plug-in directory page is just not updated smile

    If it is not yet tested and supported for 3.6 we will likely upgrade to 3.5 instead.

    Thanks in advance!!
  • Picture of Neil Stapleton
    Fri, 15 Mar 2019, 9:48 PM
    Hi All

    Can this plugin be used to Authenticate against Office365?

    Does anyone have a guide on how to do it, both what's required on the O365 end as well as the Moodle end.

    I found this, but am not able to connect the dots...

1 2 3 4 5 6 7 8 9 10 11
Please login to post comments