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.

Web service auth plugin, reserves username, prevents normal login. TODO: add IP restrictions and some other features - MDL-17135

Copyright: 2008 Petr Skoda (http://skodak.org)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 149 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

auth_plugin_webservice:: (2 methods):
  __construct()
  auth_plugin_webservice()

name:: (8 methods):
  user_login()
  user_login_webservice()
  user_update_password()
  is_internal()
  can_change_password()
  change_password_url()
  can_reset_password()
  user_confirm()


Class: auth_plugin_webservice  - X-Ref

Web service auth plugin.

__construct()   X-Ref
Constructor.


auth_plugin_webservice()   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.

user_login_webservice($username, $password)   X-Ref
Custom auth hook for web services.

param: string $username
param: string $password
return: bool success

user_update_password($user, $newpassword)   X-Ref
Updates the user's password.

called when the user password is updated.

param: object  $user        User table object  (with system magic quotes)
param: string  $newpassword Plaintext password (with system magic quotes)
return: boolean result

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

Webserice auth doesn't use password fields, it uses only tokens.

return: bool

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

return: bool

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

can_reset_password()   X-Ref
Returns true if plugin allows resetting of internal password.

return: bool

user_confirm($username, $confirmsecret = null)   X-Ref
Confirm the new user as registered. This should normally not be used,
but it may be necessary if the user auth_method is changed to manual
before the user is confirmed.