mediawiki-extensions-OATHAuth/ServiceWiring.php
Taavi Väänänen f3382dd3d1
OATHUserRepository: rely less on global state
Inject more stuff into OATHUserRepository properly. Also done other misc
cleanup on that class.

Change-Id: I194345974146517c8216a81330cd930534d655e4
2023-01-01 01:59:22 +02:00

32 lines
838 B
PHP

<?php
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Extension\OATHAuth\OATHAuth;
use MediaWiki\Extension\OATHAuth\OATHUserRepository;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
return [
'OATHAuth' => static function ( MediaWikiServices $services ) {
return new OATHAuth(
$services->getMainConfig(),
$services->getDBLoadBalancerFactory()
);
},
'OATHUserRepository' => static function ( MediaWikiServices $services ) {
return new OATHUserRepository(
new ServiceOptions(
OATHUserRepository::CONSTRUCTOR_OPTIONS,
$services->getMainConfig(),
),
$services->getDBLoadBalancerFactory(),
new HashBagOStuff( [
'maxKey' => 5
] ),
$services->getService( 'OATHAuth' ),
$services->getCentralIdLookupFactory(),
LoggerFactory::getInstance( 'authentication' )
);
}
];