Add initial auth plugin class

This commit is contained in:
Dmitrii Metelkin 2016-08-16 14:46:33 +10:00
parent e128916e37
commit 3c8363d184

80
auth.php Normal file
View file

@ -0,0 +1,80 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* 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;
}
}