Added detectProviderFromSegments() function,
with tests.
Refactored detectAuthDriver() accordingly.
Goal: Refactor detectAuthDriver() till its easy to test.