00001 <?php 00004 # Copyright (C) 2004 Brion Vibber <brion@pobox.com> 00005 # http://www.mediawiki.org/ 00006 # 00007 # This program is free software; you can redistribute it and/or modify 00008 # it under the terms of the GNU General Public License as published by 00009 # the Free Software Foundation; either version 2 of the License, or 00010 # (at your option) any later version. 00011 # 00012 # This program is distributed in the hope that it will be useful, 00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 # GNU General Public License for more details. 00016 # 00017 # You should have received a copy of the GNU General Public License along 00018 # with this program; if not, write to the Free Software Foundation, Inc., 00019 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 # http://www.gnu.org/copyleft/gpl.html 00021 00032 class AuthPlugin { 00042 public function userExists( $username ) { 00043 # Override this! 00044 return false; 00045 } 00046 00057 public function authenticate( $username, $password ) { 00058 # Override this! 00059 return false; 00060 } 00061 00067 public function modifyUITemplate( &$template ) { 00068 # Override this! 00069 $template->set( 'usedomain', false ); 00070 } 00071 00077 public function setDomain( $domain ) { 00078 $this->domain = $domain; 00079 } 00080 00087 public function validDomain( $domain ) { 00088 # Override this! 00089 return true; 00090 } 00091 00102 public function updateUser( &$user ) { 00103 # Override this and do something 00104 return true; 00105 } 00106 00107 00121 public function autoCreate() { 00122 return false; 00123 } 00124 00130 public function allowPasswordChange() { 00131 return true; 00132 } 00133 00146 public function setPassword( $user, $password ) { 00147 return true; 00148 } 00149 00157 public function updateExternalDB( $user ) { 00158 return true; 00159 } 00160 00166 public function canCreateAccounts() { 00167 return false; 00168 } 00169 00180 public function addUser( $user, $password, $email='', $realname='' ) { 00181 return true; 00182 } 00183 00184 00193 public function strict() { 00194 return false; 00195 } 00196 00204 public function strictUserAuth( $username ) { 00205 return false; 00206 } 00207 00219 public function initUser( &$user, $autocreate=false ) { 00220 # Override this to do something. 00221 } 00222 00227 public function getCanonicalName( $username ) { 00228 return $username; 00229 } 00230 00237 public function getUserInstance( User &$user ) { 00238 return new AuthPluginUser( $user ); 00239 } 00240 } 00241 00242 class AuthPluginUser { 00243 function __construct( $user ) { 00244 # Override this! 00245 } 00246 00247 public function getId() { 00248 # Override this! 00249 return -1; 00250 } 00251 00252 public function isLocked() { 00253 # Override this! 00254 return false; 00255 } 00256 00257 public function isHidden() { 00258 # Override this! 00259 return false; 00260 } 00261 00262 public function resetAuthToken() { 00263 # Override this! 00264 return true; 00265 } 00266 }