Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [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: 413 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.

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

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.

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

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

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

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

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

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

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

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

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