Extension:CentralAuth

CentralAuth allows global accounts shared between projects. This extension adds seven new special pages: Special:AutoLogin ( unlisted special page ), Special:CentralAuth, Special:GlobalGroupMembership, Special:GlobalGroupPermissions, Special:WikiSets, Special:GlobalUsers, Special:MergeAccount

It is recommended you download the version of CentralAuth that corresponds to your version of MediaWiki.

Installation
See the 1>#Setup|setup section below for prerequisites to using CentralAuth. Then follow these instructions when you are ready to activate CentralAuth:


 * 1) 1>Special:ExtensionDistributor/CentralAuth|Download the latest snapshot and extract it to your   directory.


 * 1) Pick a database and create the CentralAuth database tables. You can use an existing database or create a new one; the extension by default uses a database named   (see   below).   this database then run.
 * 2) * If you use  you'll need to create a global   table (to block new usernames that look similar to existing usernames in any wiki). One way to do this is dump the   table from the local wiki's database and import it into the new <tvar|2> </>.
 * 3) Add <tvar|1> </> to <tvar|2></> for each of your wikis, or in another PHP file that is included in <tvar|3> </> on each of your wikis.
 * 4) The extension should be now active.

Here are sample shell and SQL commands to create the <tvar|1> </> database, copy the <tvar|2> </> table to it, and migrate existing user data to it. Replace <tvar|1></> and <tvar|2></> with the values for your own wiki installation.

Create the new database (Remember this step is option, you can instead use one of your existing databases, in which case skip to the create tables step):

The following assumes your present working directory is your MediaWiki installation (not your CentralAuth directory). Create the central auth tables (Using <tvar|1> </> is preferred. If you do not have shell access, you can also import <tvar|1> </> via database administration tools like PHPMyAdmin):

If AntiSpoof is installed, create the table via (Alternatively, you can copy an existing AntiSpoof table if you want to keep previous entries):

Run the user migration scripts

1>Extension:CentralAuth/Walkthrough</>|Walkthrough is a more user-friendly setup than the instructions below.

Setup
First, you'll need to configure your 1>Special:MyLanguage/Manual:Wiki family</>|wiki family using <tvar|2></>, or CentralAuth can't be used for your wiki family. This includes setting <tvar|1></> and assigning it to <tvar|2> </>, and <tvar|3> </> (minimum is <tvar|4></>, <tvar|5></> and <tvar|6></>). Follow 1>Special:MyLanguage/Manual:$wgConf#Example</>|the examples carefully. Make sure that you put the configuration code after the <tvar|1></> line in <tvar|2> </>. If you are creating a new wiki family, bear in mind that it may be easier if the databases for the wikis in each group have the same suffix (e.g. hypothetical databases <tvar|1> </>, <tvar|2> </>, <tvar|3> </>, etc., pertaining to wikis belonging to the same group, all have the suffix "<tvar|4> </>").

After installing the extension, you have to gather some data in the CentralAuth database. In order to retroactively set up global accounts, you will have to run the <tvar|1></> and <tvar|2></> scripts. The first one stores information about your wikis in the CentralAuth database, while the second one uses automatic migration heuristics to generate global accounts. A user can merge their accounts manually via <tvar|1>Special:MergeAccount</>. Dry runs can be used for testing purposes.

To enable global groups, you will have to make an entry into the <tvar|1> </> table in your CentralAuth database, with <tvar|2> </> and (for access to the group management interface) <tvar|3> </>. A sample query that is recommended to use is:. Then, run <tvar|1> </> to promote local stewards to global steward status.

There are various settings you may wish to modify (e.g. whether to provide single sign-on across a whole domain) listed in <tvar|1></>. In particular, you will want to override the default value of $wgCentralAuthDatabase if your CentralAuth database is named something other than 'centralauth'. Make sure you put such settings after the wfLoadExtension line in LocalSettings.php, e.g.:

"SUL2" behavior
In July 2013 WMF changed its approach to logging users into multiple wikis. When configured for this new approach, after successful login and account creation CentralAuth redirects to  on a "central login wiki", which sets cookies on that wiki and then redirects back to the logged-into wiki. It omits the "login/account creation success" page, instead redirecting back to the "returnto" page that the user was originally on. It places 1x1 pixel images in the footer of that page, in place of the icons formerly used on the "login/account creation success" page.

The settings for this are, roughly,

is the id (usually the database-name) of the wiki to which CentralAuth will redirect on login and create account.

means account creation will create a new global account (this parameter was deleted from MediaWiki 1.27).

Simulating SUL2 behavior on a single-instance development machine
You can simulate this new behavior on a single-instance development machine. You can set ) so CentralAuth makes its HTTP redirect requests to your same local wiki. This will not exercise central login properly, but will activate its "returnto" behavior. CentralAuth will still use its own 'centralauth' database to store global user names.

To determine the URL on the login wiki, CentralAuth uses WikiMap which assumes a wiki farm has been configured using. Configuration setup (in SiteConfiguration.php) is very flexible; one way to set up a dummy single-wiki  in LocalSettings.php is:

This is in addition to the settings in above.

Cache issues
For best results, it is recommended to use memcached. If you have only a single server, accelerator caches like APCu can also work, but do not use them if you have multiple servers. If you have no cache set up (i.e. CACHE_NONE) for, or are using  , then you need to make sure all your wikis use the same caching table.

By default, each wiki in your wikifarm will use the objectcache table in its own database (with its own db prefix) when $wgMainCacheType is set to CACHE_NONE or CACHE_DB.

To make this work with centralauth, we need to tell the wikis to use a central cache table.

If you want to make a central caching table in the centralauth database (And assuming one of your existing wikis has a database name of ), run code like the following to copy the table to your other database:

Then add the following config to all wikis to tell them to use the central table instead of their own table:

Use
Allows for a single-user login (SUL) system using MediaWiki's AuthPlugin system. User creation and login is done globally using one central user table across all wikis. Note that local user accounts are automatically created on account creation/login however.

This extension also implements global user groups, to which global accounts can belong to.

User rights
CentralAuth defines several new userrights:

Single-user login (SUL)
A user with an account on more than one wiki may use Special:MergeAccount to create their global user account, which can then be used on any wiki. Users with the centralauth-unmerge permission (given to stewards by default) can undo a merging of a global account, where the passwords are all reset back to the pre-merge setting. User accounts can now also be renamed globally.

Locking and hiding global users
A global account can be locked or hidden by a user with the centralauth-lock and centralauth-oversight permissions, respectively, given to the local group 'stewards' by default. A locked global account will be immediately logged out of any session on any wiki it is currently logged in to. A hidden global account's username is not visible in any logs except the global account log.

Wiki sets
A wiki set is a group of wikis specified by a user with the globalgrouppermissions right. Sets can be opt-in (wikis are not in it by default) or opt-out (wikis are in it unless opted out).

Global user groups
Once you have enabled global user groups as described in the installation section, a migrated steward can use the Special:GlobalGroupPermissions interface to configure global user groups, and their rights. A global user group is active on all wikis (the users in it have its rights on all the wikis) by default, unless the group has been specified to only be active on a specific wiki set (the users in the group only have the rights if they are on a wiki in the set). Global group permissions are not listed at Special:ListUsers, but instead Special:GlobalUsers. They are assigned by a user with the globalgroupmembership permission (by default the global group stewards), and give the specified rights to the user even if the local rights defined by do not do so.

Licensing and downloads
The extension is available under the GNU General Public License 2.0 or later, and can be downloaded from Git, or accessed via the.

The software is provided as-is. Updates will be made according to the needs of Wikimedia wikis; or where critical vulnerabilities are discovered.

API
See <tvar|1></>.