There are two somewhat distinct applications of dependency injection that should be considered:
- Injecting the providers into AuthManager (and making it a service instead of a singleton). Right now the AuthManager class and the configuration logic deciding what providers to use are strongly coupled. It should be possible to create other AuthManager instances with different sets of providers. This would be helpful for extensions which do programmatic account creation (such as TranslateSandbox) and right now have to hope that no provider is registered which would interfere with the non-interactive account creation projects.
- Injecting dependencies into each provider, either by making them into separate services, or by providing a dedicated ServiceContainer for AuthManager in which the providers can be items. The main use case for this is extension configuration: providers defined by extensions need two Config instances, one for core and one for the extension. Currently the core config is supplied via setter injection and the extension one via ugly hacks.