Refactor AuthProviderRegistry code