mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
synced 2024-11-11 17:01:13 +00:00
a6c3d2a16d
This is a common pattern for serivce wiring functions Change-Id: I4b4fad8ac28108e53300231b3812426e82ccf84f
27 lines
837 B
PHP
27 lines
837 B
PHP
<?php
|
|
|
|
use MediaWiki\Extension\OATHAuth\OATHAuthModuleRegistry;
|
|
use MediaWiki\Extension\OATHAuth\OATHUserRepository;
|
|
use MediaWiki\Logger\LoggerFactory;
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
return [
|
|
'OATHAuthModuleRegistry' => static function ( MediaWikiServices $services ): OATHAuthModuleRegistry {
|
|
return new OATHAuthModuleRegistry(
|
|
$services->getDBLoadBalancerFactory(),
|
|
ExtensionRegistry::getInstance()->getAttribute( 'OATHAuthModules' ),
|
|
);
|
|
},
|
|
'OATHUserRepository' => static function ( MediaWikiServices $services ): OATHUserRepository {
|
|
return new OATHUserRepository(
|
|
$services->getDBLoadBalancerFactory(),
|
|
new HashBagOStuff( [
|
|
'maxKey' => 5
|
|
] ),
|
|
$services->getService( 'OATHAuthModuleRegistry' ),
|
|
$services->getCentralIdLookupFactory(),
|
|
LoggerFactory::getInstance( 'authentication' )
|
|
);
|
|
}
|
|
];
|