mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
synced 2024-11-14 19:31:17 +00:00
e3d07eb0ae
Add a simple service to access the central database to decrease code repetition. Change-Id: Ib33000f4d44d77da31cc375e374cb595ad23bcbd
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Config\ServiceOptions;
|
|
use MediaWiki\Extension\OATHAuth\OATHAuthDatabase;
|
|
use MediaWiki\Extension\OATHAuth\OATHAuthModuleRegistry;
|
|
use MediaWiki\Extension\OATHAuth\OATHUserRepository;
|
|
use MediaWiki\Logger\LoggerFactory;
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
return [
|
|
'OATHAuthDatabase' => static function ( MediaWikiServices $services ) {
|
|
return new OATHAuthDatabase(
|
|
new ServiceOptions(
|
|
OATHAuthDatabase::CONSTRUCTOR_OPTIONS,
|
|
$services->getMainConfig(),
|
|
),
|
|
$services->getDBLoadBalancerFactory(),
|
|
);
|
|
},
|
|
'OATHAuthModuleRegistry' => static function ( MediaWikiServices $services ) {
|
|
return new OATHAuthModuleRegistry();
|
|
},
|
|
'OATHUserRepository' => static function ( MediaWikiServices $services ) {
|
|
return new OATHUserRepository(
|
|
new ServiceOptions(
|
|
OATHUserRepository::CONSTRUCTOR_OPTIONS,
|
|
$services->getMainConfig(),
|
|
),
|
|
$services->getService( 'OATHAuthDatabase' ),
|
|
new HashBagOStuff( [
|
|
'maxKey' => 5
|
|
] ),
|
|
$services->getService( 'OATHAuthModuleRegistry' ),
|
|
$services->getCentralIdLookupFactory(),
|
|
LoggerFactory::getInstance( 'authentication' )
|
|
);
|
|
}
|
|
];
|