| 1 | <?php |
| 2 | |
| 3 | use MediaWiki\Extension\OATHAuth\OATHAuthModuleRegistry; |
| 4 | use MediaWiki\Extension\OATHAuth\OATHUserRepository; |
| 5 | use MediaWiki\Logger\LoggerFactory; |
| 6 | use MediaWiki\MediaWikiServices; |
| 7 | use MediaWiki\Registration\ExtensionRegistry; |
| 8 | use Wikimedia\ObjectCache\HashBagOStuff; |
| 9 | |
| 10 | return [ |
| 11 | 'OATHAuthModuleRegistry' => static function ( MediaWikiServices $services ): OATHAuthModuleRegistry { |
| 12 | return new OATHAuthModuleRegistry( |
| 13 | $services->getDBLoadBalancerFactory(), |
| 14 | $services->getObjectFactory(), |
| 15 | ExtensionRegistry::getInstance()->getAttribute( 'OATHAuthModules' ), |
| 16 | ); |
| 17 | }, |
| 18 | 'OATHUserRepository' => static function ( MediaWikiServices $services ): OATHUserRepository { |
| 19 | return new OATHUserRepository( |
| 20 | $services->getDBLoadBalancerFactory(), |
| 21 | new HashBagOStuff( [ |
| 22 | 'maxKey' => 5 |
| 23 | ] ), |
| 24 | $services->getService( 'OATHAuthModuleRegistry' ), |
| 25 | $services->getCentralIdLookupFactory(), |
| 26 | LoggerFactory::getInstance( 'authentication' ) |
| 27 | ); |
| 28 | } |
| 29 | ]; |