MediaWiki  1.23.2
AuthPlugin.php
Go to the documentation of this file.
1 <?php
36 class AuthPlugin {
40  protected $domain;
41 
51  public function userExists( $username ) {
52  # Override this!
53  return false;
54  }
55 
66  public function authenticate( $username, $password ) {
67  # Override this!
68  return false;
69  }
70 
77  public function modifyUITemplate( &$template, &$type ) {
78  # Override this!
79  $template->set( 'usedomain', false );
80  }
81 
87  public function setDomain( $domain ) {
88  $this->domain = $domain;
89  }
90 
96  public function getDomain() {
97  if ( isset( $this->domain ) ) {
98  return $this->domain;
99  } else {
100  return 'invaliddomain';
101  }
102  }
103 
110  public function validDomain( $domain ) {
111  # Override this!
112  return true;
113  }
114 
126  public function updateUser( &$user ) {
127  # Override this and do something
128  return true;
129  }
130 
144  public function autoCreate() {
145  return false;
146  }
147 
157  public function allowPropChange( $prop = '' ) {
158  if ( $prop == 'realname' && is_callable( array( $this, 'allowRealNameChange' ) ) ) {
159  return $this->allowRealNameChange();
160  } elseif ( $prop == 'emailaddress' && is_callable( array( $this, 'allowEmailChange' ) ) ) {
161  return $this->allowEmailChange();
162  } elseif ( $prop == 'nickname' && is_callable( array( $this, 'allowNickChange' ) ) ) {
163  return $this->allowNickChange();
164  } else {
165  return true;
166  }
167  }
168 
174  public function allowPasswordChange() {
175  return true;
176  }
177 
183  public function allowSetLocalPassword() {
184  return true;
185  }
186 
199  public function setPassword( $user, $password ) {
200  return true;
201  }
202 
210  public function updateExternalDB( $user ) {
211  return true;
212  }
213 
223  public function updateExternalDBGroups( $user, $addgroups, $delgroups = array() ) {
224  return true;
225  }
226 
232  public function canCreateAccounts() {
233  return false;
234  }
235 
246  public function addUser( $user, $password, $email = '', $realname = '' ) {
247  return true;
248  }
249 
258  public function strict() {
259  return false;
260  }
261 
269  public function strictUserAuth( $username ) {
270  return false;
271  }
272 
284  public function initUser( &$user, $autocreate = false ) {
285  # Override this to do something.
286  }
287 
294  public function getCanonicalName( $username ) {
295  return $username;
296  }
297 
305  public function getUserInstance( User &$user ) {
306  return new AuthPluginUser( $user );
307  }
308 
314  public function domainList() {
315  return array();
316  }
317 }
318 
320  function __construct( $user ) {
321  # Override this!
322  }
323 
324  public function getId() {
325  # Override this!
326  return -1;
327  }
328 
329  public function isLocked() {
330  # Override this!
331  return false;
332  }
333 
334  public function isHidden() {
335  # Override this!
336  return false;
337  }
338 
339  public function resetAuthToken() {
340  # Override this!
341  return true;
342  }
343 }
AuthPlugin\$domain
string $domain
Definition: AuthPlugin.php:39
AuthPlugin\allowSetLocalPassword
allowSetLocalPassword()
Should MediaWiki store passwords in its local database?
Definition: AuthPlugin.php:182
AuthPlugin\getDomain
getDomain()
Get the user's domain.
Definition: AuthPlugin.php:95
AuthPluginUser\resetAuthToken
resetAuthToken()
Definition: AuthPlugin.php:338
AuthPluginUser\isHidden
isHidden()
Definition: AuthPlugin.php:333
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
AuthPlugin\setDomain
setDomain( $domain)
Set the domain this plugin is supposed to use when authenticating.
Definition: AuthPlugin.php:86
AuthPluginUser\__construct
__construct( $user)
Definition: AuthPlugin.php:319
AuthPlugin\allowPropChange
allowPropChange( $prop='')
Allow a property change? Properties are the same as preferences and use the same keys.
Definition: AuthPlugin.php:156
AuthPlugin\authenticate
authenticate( $username, $password)
Check if a username+password pair is a valid login.
Definition: AuthPlugin.php:65
AuthPlugin\addUser
addUser( $user, $password, $email='', $realname='')
Add a user to the external authentication database.
Definition: AuthPlugin.php:245
AuthPlugin\getCanonicalName
getCanonicalName( $username)
If you want to munge the case of an account name before the final check, now is your chance.
Definition: AuthPlugin.php:293
AuthPlugin\getUserInstance
getUserInstance(User &$user)
Get an instance of a User object.
Definition: AuthPlugin.php:304
AuthPlugin\updateExternalDBGroups
updateExternalDBGroups( $user, $addgroups, $delgroups=array())
Update user groups in the external authentication database.
Definition: AuthPlugin.php:222
AuthPlugin\allowPasswordChange
allowPasswordChange()
Can users change their passwords?
Definition: AuthPlugin.php:173
AuthPlugin\updateUser
updateUser(&$user)
When a user logs in, optionally fill in preferences and such.
Definition: AuthPlugin.php:125
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
AuthPlugin\canCreateAccounts
canCreateAccounts()
Check to see if external accounts can be created.
Definition: AuthPlugin.php:231
AuthPlugin\updateExternalDB
updateExternalDB( $user)
Update user information in the external authentication database.
Definition: AuthPlugin.php:209
AuthPlugin\strictUserAuth
strictUserAuth( $username)
Check if a user should authenticate locally if the global authentication fails.
Definition: AuthPlugin.php:268
AuthPlugin\initUser
initUser(&$user, $autocreate=false)
When creating a user account, optionally fill in preferences and such.
Definition: AuthPlugin.php:283
AuthPlugin\userExists
userExists( $username)
Check whether there exists a user account with the given name.
Definition: AuthPlugin.php:50
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
AuthPlugin\autoCreate
autoCreate()
Return true if the wiki should create a new local account automatically when asked to login a user wh...
Definition: AuthPlugin.php:143
AuthPluginUser
Definition: AuthPlugin.php:318
$password
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks this Boolean value will be checked to determine if the password was valid return false to implement your own hashing method & $password
Definition: hooks.txt:2697
AuthPlugin\strict
strict()
Return true to prevent logins that don't authenticate here from being checked against the local datab...
Definition: AuthPlugin.php:257
AuthPluginUser\getId
getId()
Definition: AuthPlugin.php:323
AuthPlugin\domainList
domainList()
Get a list of domains (in HTMLForm options format) used.
Definition: AuthPlugin.php:313
AuthPlugin\setPassword
setPassword( $user, $password)
Set the given password in the authentication database.
Definition: AuthPlugin.php:198
AuthPlugin\modifyUITemplate
modifyUITemplate(&$template, &$type)
Modify options in the login template.
Definition: AuthPlugin.php:76
AuthPlugin\validDomain
validDomain( $domain)
Check to see if the specific domain is a valid domain.
Definition: AuthPlugin.php:109
AuthPluginUser\isLocked
isLocked()
Definition: AuthPlugin.php:328
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:59
AuthPlugin
Authentication plugin interface.
Definition: AuthPlugin.php:36
$type
$type
Definition: testCompression.php:46