AuthPlugin Class Reference

Authentication plugin interface. More...

List of all members.

Public Member Functions

 userExists ($username)
 Check whether there exists a user account with the given name.
 authenticate ($username, $password)
 Check if a username+password pair is a valid login.
 modifyUITemplate (&$template, &$type)
 Modify options in the login template.
 setDomain ($domain)
 Set the domain this plugin is supposed to use when authenticating.
 validDomain ($domain)
 Check to see if the specific domain is a valid domain.
 updateUser (&$user)
 When a user logs in, optionally fill in preferences and such.
 autoCreate ()
 Return true if the wiki should create a new local account automatically when asked to login a user who doesn't exist locally but does in the external auth database.
 allowPropChange ($prop= '')
 Allow a property change? Properties are the same as preferences and use the same keys.
 allowPasswordChange ()
 Can users change their passwords?
 setPassword ($user, $password)
 Set the given password in the authentication database.
 updateExternalDB ($user)
 Update user information in the external authentication database.
 canCreateAccounts ()
 Check to see if external accounts can be created.
 addUser ($user, $password, $email='', $realname='')
 Add a user to the external authentication database.
 strict ()
 Return true to prevent logins that don't authenticate here from being checked against the local database's password fields.
 strictUserAuth ($username)
 Check if a user should authenticate locally if the global authentication fails.
 initUser (&$user, $autocreate=false)
 When creating a user account, optionally fill in preferences and such.
 getCanonicalName ($username)
 If you want to munge the case of an account name before the final check, now is your chance.
 getUserInstance (User &$user)
 Get an instance of a User object.


Detailed Description

Authentication plugin interface.

Instantiate a subclass of AuthPlugin and set $wgAuth to it to authenticate against some external tool.

The default behavior is not to do anything, and use the local user database for all authentication. A subclass can require that all accounts authenticate externally, or use it only as a fallback; also you can transparently create internal wiki accounts the first time someone logs in who can be authenticated externally.

Definition at line 32 of file AuthPlugin.php.


Member Function Documentation

AuthPlugin::addUser ( user,
password,
email = '',
realname = '' 
)

Add a user to the external authentication database.

Return true if successful.

Parameters:
$user User: only the name should be assumed valid at this point
$password String
$email String
$realname String
Returns:
Boolean

Definition at line 200 of file AuthPlugin.php.

AuthPlugin::allowPasswordChange (  ) 

Can users change their passwords?

Returns:
bool

Definition at line 150 of file AuthPlugin.php.

AuthPlugin::allowPropChange ( prop = ''  ) 

Allow a property change? Properties are the same as preferences and use the same keys.

'Realname' 'Emailaddress' and 'Nickname' all reference this.

Returns:
Boolean

Definition at line 133 of file AuthPlugin.php.

AuthPlugin::authenticate ( username,
password 
)

Check if a username+password pair is a valid login.

The name will be normalized to MediaWiki's requirements, so you might need to munge it (for instance, for lowercase initial letters).

Parameters:
$username String: username.
$password String: user password.
Returns:
bool

Definition at line 57 of file AuthPlugin.php.

AuthPlugin::autoCreate (  ) 

Return true if the wiki should create a new local account automatically when asked to login a user who doesn't exist locally but does in the external auth database.

If you don't automatically create accounts, you must still create accounts in some way. It's not possible to authenticate without a local account.

This is just a question, and shouldn't perform any actions.

Returns:
Boolean

Definition at line 122 of file AuthPlugin.php.

AuthPlugin::canCreateAccounts (  ) 

Check to see if external accounts can be created.

Return true if external accounts can be created.

Returns:
Boolean

Definition at line 186 of file AuthPlugin.php.

AuthPlugin::getCanonicalName ( username  ) 

If you want to munge the case of an account name before the final check, now is your chance.

Definition at line 247 of file AuthPlugin.php.

AuthPlugin::getUserInstance ( User &$  user  ) 

Get an instance of a User object.

Parameters:
$user User

Definition at line 256 of file AuthPlugin.php.

AuthPlugin::initUser ( &$  user,
autocreate = false 
)

When creating a user account, optionally fill in preferences and such.

For instance, you might pull the email address or real name from the external user database.

The User object is passed by reference so it can be modified; don't forget the & on your function declaration.

Parameters:
$user User object.
$autocreate Boolean: True if user is being autocreated on login

Definition at line 239 of file AuthPlugin.php.

AuthPlugin::modifyUITemplate ( &$  template,
&$  type 
)

Modify options in the login template.

Parameters:
$template UserLoginTemplate object.
$type String 'signup' or 'login'.

Definition at line 68 of file AuthPlugin.php.

AuthPlugin::setDomain ( domain  ) 

Set the domain this plugin is supposed to use when authenticating.

Parameters:
$domain String: authentication domain.

Definition at line 78 of file AuthPlugin.php.

AuthPlugin::setPassword ( user,
password 
)

Set the given password in the authentication database.

As a special case, the password may be set to null to request locking the password to an unusable value, with the expectation that it will be set later through a mail reset or other method.

Return true if successful.

Parameters:
$user User object.
$password String: password.
Returns:
bool

Definition at line 166 of file AuthPlugin.php.

AuthPlugin::strict (  ) 

Return true to prevent logins that don't authenticate here from being checked against the local database's password fields.

This is just a question, and shouldn't perform any actions.

Returns:
Boolean

Definition at line 213 of file AuthPlugin.php.

AuthPlugin::strictUserAuth ( username  ) 

Check if a user should authenticate locally if the global authentication fails.

If either this or strict() returns true, local authentication is not used.

Parameters:
$username String: username.
Returns:
Boolean

Definition at line 224 of file AuthPlugin.php.

AuthPlugin::updateExternalDB ( user  ) 

Update user information in the external authentication database.

Return true if successful.

Parameters:
$user User object.
Returns:
Boolean

Definition at line 177 of file AuthPlugin.php.

AuthPlugin::updateUser ( &$  user  ) 

When a user logs in, optionally fill in preferences and such.

For instance, you might pull the email address or real name from the external user database.

The User object is passed by reference so it can be modified; don't forget the & on your function declaration.

Parameters:
$user User object

Definition at line 103 of file AuthPlugin.php.

AuthPlugin::userExists ( username  ) 

Check whether there exists a user account with the given name.

The name will be normalized to MediaWiki's requirements, so you might need to munge it (for instance, for lowercase initial letters).

Parameters:
$username String: username.
Returns:
bool

Definition at line 42 of file AuthPlugin.php.

AuthPlugin::validDomain ( domain  ) 

Check to see if the specific domain is a valid domain.

Parameters:
$domain String: authentication domain.
Returns:
bool

Definition at line 88 of file AuthPlugin.php.


The documentation for this class was generated from the following file:

Generated on Sat Apr 30 22:57:33 2011 for MediaWiki by  doxygen 1.5.9