Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

Authentication Plugin: Shibboleth Authentication Authentication using Shibboleth. Distributed under GPL (c)Markus Hagman 2004-2006

Author: Martin Dougiamas
Author: Lukas Haemmerle
License: http://www.gnu.org/copyleft/gpl.html GNU Public License
File Size: 409 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes


Class: auth_plugin_shibboleth  - X-Ref

Shibboleth authentication plugin.

__construct()   X-Ref
Constructor.


auth_plugin_shibboleth()   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

user_login($username, $password)   X-Ref
Returns true if the username and password work and false if they are
wrong or don't exist.

return: bool Authentication success or failure.
param: string $username The username (with system magic quotes)
param: string $password The password (with system magic quotes)

get_userinfo($username)   X-Ref
Returns the user information for 'external' users. In this case the
attributes provided by Shibboleth

return: array $result Associative array of user data

get_attributes()   X-Ref
Returns array containg attribute mappings between Moodle and Shibboleth.

return: array

prevent_local_passwords()   X-Ref
No description

is_internal()   X-Ref
Returns true if this authentication plugin is 'internal'.

return: bool

can_change_password()   X-Ref
Whether shibboleth users can change their password or not.

Shibboleth auth requires password to be changed on shibboleth server directly.
So it is required to have  password change url set.

return: bool true if there's a password url or false otherwise.

change_password_url()   X-Ref
Get password change url.

return: moodle_url|null Returns URL to change password or null otherwise.

loginpage_hook()   X-Ref
Hook for login page


logoutpage_hook()   X-Ref
Hook for logout page


get_first_string($string)   X-Ref
Cleans and returns first of potential many values (multi-valued attributes)

param: string $string Possibly multi-valued attribute from Shibboleth

test_settings()   X-Ref
Test if settings are correct, print info to output.


loginpage_idp_list($wantsurl)   X-Ref
Return a list of identity providers to display on the login page.

return: array List of arrays with keys url, iconurl and name.
param: string $wantsurl The requested URL.

set_saml_cookie($selectedIDP)   X-Ref
Sets the standard SAML domain cookie that is also used to preselect
the right entry on the local way

param: string $selectedIDP IDP identifier

get_idp_list($organization_selection)   X-Ref
Generate array of IdPs from Moodle Shibboleth settings

return: array Identifier of IdPs and their name/session initiator
param: string Text containing tuble/triple of IdP entityId, name and (optionally) session initiator

generate_cookie_array($value)   X-Ref
Generates an array of IDPs using the cookie value

return: array Identifiers of IdPs
param: string Value of SAML domain cookie

generate_cookie_value($CookieArray)   X-Ref
Generate the value that is stored in the cookie using the list of IDPs

return: string SAML domain cookie value
param: array IdP identifiers

appendCookieValue($value, $CookieArray)   X-Ref
Append a value to the array of IDPs

return: array IdP identifiers with appended IdP
param: string IdP identifier
param: array IdP identifiers