Extension:MS SQL Database Authentication

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
MS SQL Database Authentication
Release status: stable
SampleMsSqlDB.png
Implementation User identity
Description This MediaWiki extension authenticates users and transfers users data from external Microsoft SQL Server database
Author(s) Iaroslav Vassiliev (CodeMonktalk)
Latest version 1.09
 (2016-12-13)
MediaWiki MediaWiki 1.8 or higher
Database changes No
License GNU General Public License 2.0
Download
Translate the MS SQL Database Authentication extension if it is available at translatewiki.net
Check usage and version matrix.

This MediaWiki extension authenticates users and gets users data using external Microsoft SQL Server database. The extension is indispensable, if you need, for example, to grant access to your wiki only to some employees of your company, or to some students of your university listed in some SQL Server database table.

Installation & Configuration[edit]

This extension requires Microsoft Drivers for SQL Server for PHP to be pre-installed.

Download the extension. Unzip and save the files into MsSqlAuth subdirectory of your wiki's extensions directory.

All configuration settings must be specified in global variables in MediaWiki's LocalSettings.php file. Here are the settings and their description:


Use MS SQL database for authentication only, ignore users in MediaWiki database (true/false)

$wgMsSqlAuth_MsSqlAuthOnly = true;

MS SQL Server Host Name. IP address, domain or instance name can be specified, or localhost.

$wgMsSqlAuth_Host = 'EHOT\SQLEXPRESS2012';

MS SQL Server Username. Set this to null or empty value '' to use Windows Authentication to connect to SQL Server.

$wgMsSqlAuth_Username = 'SqlUser';

MS SQL Server Password. Set this to null or empty value '' in case of Windows Authentication.

$wgMsSqlAuth_Password = 'SqlPassword';

MS SQL Server Database Name

$wgMsSqlAuth_Database = 'Campus4';

MS SQL Server Database Table Containing Users Data. Schema can be specified if required, e.g. dbo.users

$wgMsSqlAuth_Table = 'users';

Username Field in the table. Note that MediaWiki automatically capitalizes the first letter of username. Maybe you should consider switching this table field to case-insensitive collation.

$wgMsSqlAuth_LoginField = 'login';

Password Field

$wgMsSqlAuth_PasswordField = 'password_hash';

Password Field Hashing Algorithm ('MD5'/'SHA1'/'SHA256'/'SHA512'/'RIPEMD160'/'None'), 'None' means password in plain text.

$wgMsSqlAuth_PasswordHashing = 'MD5';

User's Email Field

$wgMsSqlAuth_EmailField = 'email';

User's Real Name Field

$wgMsSqlAuth_RealNameField = 'name';

PHP Driver to connect to MS SQL Server ('sqlsrv'/'pdo_sqlsrv')

$wgMsSqlAuth_Driver = 'sqlsrv';

Path to extension's MsSqlAuth.php file, relative to MediaWiki installation

require_once("$IP/extensions/MsSqlAuth/MsSqlAuth.php");

The following last line must be unmodified, just copy it

$wgAuth = new MsSqlAuth();


Look at the screenshot of sample database which was created to suit settings specified above. Sample Campus4 database containing users table with users data.


That's it!

Feedback[edit]

If you would like to report a bug or request a feature, you can do it on discussion page or on SourceForge. By the way, if you need advanced bot functionality for your wiki project, take a look at free DotNetWikiBot Framework, that I maintain..

See also[edit]