Github mirror of MediaWiki extension LDAPProvider - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
转到文件
libraryupgrader a71308f29a build: Updating grunt-banana-checker to 0.12.0
Change-Id: I8218536094220459ac1c54414c628d9512e8a48d
2024-05-10 14:01:28 +00:00
.phan Add phan and fix the problems it found 2021-01-05 17:57:39 -05:00
docs Switch to WMF CI 2018-12-02 12:08:00 +01:00
i18n Localisation updates from https://translatewiki.net. 2023-11-08 13:07:44 +01:00
maintenance Fix output for ShowUserInfo maintenance script 2023-04-06 11:31:09 +00:00
schema Added DB tables and TestClient 2017-10-06 16:19:22 +02:00
src Add debug logger 2024-04-08 11:01:55 +00:00
tests/phpunit build: Updating mediawiki/mediawiki-codesniffer to 43.0.0 2024-03-17 20:09:45 +00:00
.editorconfig Throw more catch-able ConfigException instead of MWException 2021-04-06 20:20:36 -04:00
.eslintrc.json build: Updating eslint-config-wikimedia to 0.19.0 2021-03-14 00:17:08 +00:00
.gitignore build: Replace jsonlint with eslint 2021-02-20 16:29:38 +01:00
.gitreview Add .gitreview 2018-11-20 10:29:56 +01:00
.phpcs.xml build: Swap deprecated @codingStandardsIgnore to exclude in .phpcs.xml 2021-04-04 20:22:33 +02:00
Gruntfile.js build: Replace jsonlint with eslint 2021-02-20 16:29:38 +01:00
README.mediawiki Fix typos 2020-06-18 21:41:51 +01:00
composer.json build: Updating composer dependencies 2024-05-05 21:22:33 +00:00
extension.json Raise requirements and bump version 2023-06-14 11:57:54 +02:00
package-lock.json build: Updating grunt-banana-checker to 0.12.0 2024-05-10 14:01:28 +00:00
package.json build: Updating grunt-banana-checker to 0.12.0 2024-05-10 14:01:28 +00:00
psalm-autoload.php Throw more catch-able ConfigException instead of MWException 2021-04-06 20:20:36 -04:00
psalm.xml Throw more catch-able ConfigException instead of MWException 2021-04-06 20:20:36 -04:00

README.mediawiki

== Extension:LDAPProvider ==

This extension provides a common infrastructure to connect to a LDAP resource
and run queries against it.

=== Installation ===

This extension can be installed by creating a composer.local.json file in your MediaWiki's installation directory containing the following (or merging this into your current composer.local.json):

<source lang="json">
{
	"require": {
		"mediawiki/ldap-provider": "dev-master"
	},
	"config": {
		"prefer": "source"
	}
}
</source>

Note that <code>"prefer": "source"</code> causes composer to use a clone of the git repository if it can.

=== Configuration ===

In the simplest case where you have a single LDAP server to query, you need to simply specify your LDAP server and the json file. By default LDAPProvider looks for this file in /etc/mediawiki/ldapprovider.json.  If LDAProvider is installed, but cannot find it configuration file, it will fail with an error message.

LDAPProvider contains a sample configuration file that points to the [http://www.forumsys.com/ Forum Systems] [http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/ online ldap test server] in the included <code>ldapprovider.json</code>.  This file and the server (if it is accessible on your network) will allow you to test the extension without affecting production systems or configuring your own LDAP server.

The contents of <code>ldapprovider.json</code> demonstrates a minimal configuration:

<source lang="json">
{
	"LDAP Demo": {
		"connection": {
				"server": "10.5.5.1",
				"user": "cn=read-only-admin,dc=example,dc=com",
				"pass": "password",
				"basedn": "dc=example,dc=com",
				"searchstring": "uid=USER-NAME,dc=example,dc=com"
		}
	}
</source>

Other configurations are possible.

If you just want to try out the sample configuration, adding the following to your LocalSettings.php should be all that is needed:

<source lang="php">
$LDAPProviderDomainConfigs = "$IP/extensions/LDAPProvider/ldapprovider.json";
</source>

==== Alternative configuration via PHP ====

In <code>LocalSettings.php</code> add
<syntaxhighlight lang="php">
$LDAPProviderDomainConfigProvider = function( $ldapConfig ) {
	return new \MediaWiki\Extension\LDAPProvider\DomainConfigProvider\InlinePHPArray( [
		//Domain name
		'LDAP' => [
			'connection' => [
					'server' => '10.5.5.1',
					'user' => 'cn=read-only-admin,dc=example,dc=com',
					'pass' => 'password',
					'basedn' => 'dc=example,dc=com',
					'searchstring' => 'uid=USER-NAME,dc=example,dc=com'
				]
			]
	] );
};
</syntaxhighlight>

=== Testing ===

Tests are provided.  These can be run using the following in your MediaWiki's installation directory:

	$ ./tests/phpunit/phpunit.php extensions/LDAPProvider