AuthManager Architecture
TheAuthManager class (includes/Auth/AuthManager.php) is the single entry point for all authentication operations:
- Login —
beginAuthentication()/continueAuthentication() - Account creation —
beginAccountCreation()/continueAccountCreation() - Account linking —
beginAccountLink()/continueAccountLink() - Authentication data change —
allowsAuthenticationDataChange()/changeAuthenticationData()
Provider Types
PreAuthenticationProvider
Runs before primary authentication. Used for throttling, CAPTCHA, block checks. Example:
ThrottlePreAuthenticationProvider, CheckBlocksSecondaryAuthenticationProvider.PrimaryAuthenticationProvider
Actually authenticates the user — verifies the credential and maps it to a MediaWiki account. Examples:
LocalPasswordPrimaryAuthenticationProvider, TemporaryPasswordPrimaryAuthenticationProvider.SecondaryAuthenticationProvider
Runs after primary authentication succeeds. Used for 2FA, email verification, password change enforcement. Example:
ResetPasswordSecondaryAuthenticationProvider.Configuring Providers
Providers are configured via$wgAuthManagerConfig in LocalSettings.php:
Password Policies
Password policies are configured via$wgPasswordPolicy. Policies can be set globally or per-group.
Available Policy Checks
| Check | Description |
|---|---|
MinimalPasswordLength | Minimum password length (non-fatal; blocks password setting) |
MinimumPasswordLengthToLogin | Minimum length to allow login (fatal; locks out short passwords) |
MaximalPasswordLength | Maximum password length (fatal; prevents DoS on bcrypt/PBKDF2) |
PasswordCannotMatchUsername | Password may not equal the username |
PasswordCannotMatchBlacklist | Password may not be in a custom blocklist |
PasswordCannotBePopular | Password may not be in the N most common passwords |
Password Hashing Algorithms
MediaWiki supports multiple password hashing algorithms, configured via$wgPasswordDefault:
Bot Passwords
Bot passwords allow automated scripts and tools to authenticate without using the main account password. They support a granular grant system that limits what rights the bot session has. Users create bot passwords at Special:BotPasswords. Each bot password has:- A name (alphanumeric suffix)
- A set of grants (read, edit, create accounts, etc.)
- The actual password (shown once on creation)
Username@BotPasswordName:
Configuration
Two-Factor Authentication (2FA)
MediaWiki does not ship a 2FA provider in core, but the OATHAuth extension provides TOTP-based 2FA as aSecondaryAuthenticationProvider.
After installing OATHAuth:
OAuth Integration
The OAuth extension allows third-party applications to authenticate users and obtain scoped API access without sharing passwords.LDAP / SSO Integration
MediaWiki does not include LDAP support in core. Use one of the following extensions:| Extension | Protocol | Notes |
|---|---|---|
| LDAPAuthentication2 | LDAP/AD | Uses the AuthManager plugin system; recommended for new deployments |
| LDAPProvider | LDAP/AD | Shared LDAP infrastructure used by LDAPAuthentication2 and related extensions |
| SimpleSAMLphp | SAML 2.0 | For enterprise SSO via SAML; delegates authentication to a SAML IdP |
| PluggableAuth | Various | Generic authentication plugin framework |
