Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
/auth/cas/ -> auth.php (source)

Differences Between: [Versions 39 and 310]

Authentication Plugin: CAS Authentication Authentication using CAS (Central Authentication Server).

Author: Martin Dougiamas
Author: Jerome GUTIERREZ
Author: IƱaki Arenaza
License: http://www.gnu.org/copyleft/gpl.html GNU Public License
File Size: 400 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

auth_plugin_cas:: (2 methods):
  __construct()
  auth_plugin_cas()

name:: (13 methods):
  prevent_local_passwords()
  user_login()
  is_internal()
  can_change_password()
  loginpage_hook()
  connectCAS()
  change_password_url()
  iscreator()
  get_userinfo()
  sync_users()
  logoutpage_hook()
  postlogout_hook()
  loginpage_idp_list()


Class: auth_plugin_cas  - X-Ref

CAS authentication plugin.

__construct()   X-Ref
Constructor.


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


Class: name  - X-Ref

prevent_local_passwords()   X-Ref
No description

user_login($username, $password)   X-Ref
Authenticates user against CAS
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.

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

return: bool

can_change_password()   X-Ref
Returns true if this authentication plugin can change the user's
password.

return: bool

loginpage_hook()   X-Ref
Authentication choice (CAS or other)
Redirection to the CAS form or to login/index.php
for other authentication


connectCAS()   X-Ref
Connect to the CAS (clientcas connection or proxycas connection)


change_password_url()   X-Ref
Returns the URL for changing the user's pw, or empty if the default can
be used.

return: moodle_url

iscreator($username)   X-Ref
Returns true if user should be coursecreator.

param: mixed $username    username (without system magic quotes)
return: boolean result

get_userinfo($username)   X-Ref
Reads user information from LDAP and returns it as array()

If no LDAP servers are configured, user information has to be
provided via other methods (CSV file, manually, etc.). Return
an empty array so existing user info is not lost. Otherwise,
calls parent class method to get user info.

param: string $username username
return: mixed array with no magic quotes or false on error

sync_users($do_updates=true)   X-Ref
Syncronizes users from LDAP server to moodle user table.

If no LDAP servers are configured, simply return. Otherwise,
call parent class method to do the work.

param: bool $do_updates will do pull in data updates from LDAP if relevant
return: nothing

logoutpage_hook()   X-Ref
Hook for logout page


postlogout_hook($user)   X-Ref
Post logout hook.

Note: this method replace the prelogout_hook method to avoid redirect to CAS logout
before the event userlogout being triggered.

param: stdClass $user clone of USER object object before the user session was terminated

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

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