From 3c8363d1841f9ddac615572cda1bf9d051ac41dc Mon Sep 17 00:00:00 2001 From: Dmitrii Metelkin Date: Tue, 16 Aug 2016 14:46:33 +1000 Subject: [PATCH] Add initial auth plugin class --- auth.php | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 auth.php diff --git a/auth.php b/auth.php new file mode 100644 index 0000000..9901adf --- /dev/null +++ b/auth.php @@ -0,0 +1,80 @@ +. + +/** + * User key auth method. + * + * @package auth_userkey + * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->libdir.'/authlib.php'); + +/** + * Shibboleth authentication plugin. + */ +class auth_plugin_userkey extends auth_plugin_base { + + /** + * Constructor. + */ + public function __construct() { + $this->authtype = 'userkey'; + $this->config = get_config('auth/userkey'); + } + + /** + * Don't allow login using login form. + * + * @param string $username The username (with system magic quotes) + * @param string $password The password (with system magic quotes) + * + * @return bool Authentication success or failure. + */ + public function user_login($username, $password) { + return false; + } + + /** + * Don't store local passwords. + * + * @return bool True. + */ + public function prevent_local_passwords() { + return true; + } + + /** + * Returns true if this authentication plugin is external. + * + * @return bool False. + */ + public function is_internal() { + return false; + } + + /** + * The plugin can't change the user's password. + * + * @return bool False. + */ + public function can_change_password() { + return false; + } +}