Extension:StubUserWikiAuth

The StubUserWikiAuth extension authenticates an account against a remote wiki, when the user row is a stub.

It's only used for users that have an empty password field on the database (the  field of the user table is empty).

The purpose is to allow users to log in after importing a wiki dump from another site (mainly with Manual:Grabbers), without having database access, providing they're the legitimate owners of that account.

After importing the dump, you should run the maintenance script  located in the maintenance directory, to populate the user table with user names fetched from the page histories and logs.

This extension was based on an early version of Extension:MediaWikiAuth.

Configuration
Add the following in LocalSettings.php:

Things you should change/review:


 * apiUrl: URL to the remote api.php endpoint
 * prefsUrl: URL to the Special:Preferences page (may be needed in some setups)

Things you can configure:


 * promptPasswordChange: Prompt the user to change their password on first successful login. The user can skip it, however. (default: true)
 * fetchUserOptions: Fetch user preferences from the remote wiki. (default:false) You can set it to an array of preferences that won't be imported

Logging
You can set up a log for diagnostic purposes, to see what external requests have been made. The logs don't contain private information like passwords, only the user name and if the login and import was successful, or if not what was the response from the remote api.

Example:

Features not supported

 * It doesn't write any on-wiki log to see what users were successfully logged-in and imported. You can, however, set up a log as described above.
 * Also, there's no public flag or indication about a user being imported. Nobody can know (unless looking at the database or server logs) if a user was imported unless the user make edits on their account.
 * It doesn't import the watchlist. Large watchlists may be problematic, and it's easy for an user to edit his/her watchlist in raw on both wikis to copy & paste it on the new wiki.
 * It needs to support the actor table in the future.