AzureAD / microsoft-authentication-library-common-for-android

Common code used by both the Active Directory Authentication Library (ADAL) and the Microsoft Authentication Library (MSAL)
MIT License
41 stars 35 forks source link

Clear active broker cache if the (cached) active broker app doesn't support ipc mechanism #2331

Closed rpdome closed 8 months ago

rpdome commented 8 months ago

Scenario

  1. Install LTW broker with feature flag enabled.
  2. Launch MSAL Test App, trigger broker discovery (now it thinks that LTW is the active broker)
  3. Uninstall LTW, and reinstall LTW without the broker code.

In this scenario, MSALTestApp's active broker cache should be wiped.

How?

I moved isSupportedByTargetedBroker() from AbstractIpcStrategyWithServiceValidation to IIpcStrategy

In BrokerDiscoveryClient, invoke that method as we read value from cache.

This is a breaking change (to broker) because IIpcStrategy is being used in multiple places - especially in tests.

Validation

  1. Added a unit test
  2. Manual test with the following step.
    1. Install MockCP
    2. Go to Broker API page, force set Prod LTW as the active broker
    3. Install Prod LTW
    4. Trigger Broker API's getAccounts(). No error should be returned.

Related PR: MSAL (update tests) https://github.com/AzureAD/microsoft-authentication-library-for-android/pull/2047