/**
   * Verifies the broker related app and AD-Authenticator in Account Manager ADAL directs call to
   * AccountManager if component is valid and present. It does not direct call if the caller is from
   * Authenticator itself.
   */
  @Override
  public boolean canSwitchToBroker() {
    String packageName = mContext.getPackageName();

    // ADAL switches broker for following conditions:
    // 1- app is not skipping the broker
    // 2- permissions are set in the manifest,
    // 3- if package is not broker itself for both company portal and azure
    // authenticator
    // 4- signature of the broker is valid
    // 5- account exists
    return !AuthenticationSettings.INSTANCE.getSkipBroker()
        && verifyManifestPermissions()
        && checkAccount(mAcctManager, "", "")
        && !packageName.equalsIgnoreCase(AuthenticationSettings.INSTANCE.getBrokerPackageName())
        && !packageName.equalsIgnoreCase(
            AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME)
        && verifyAuthenticator(mAcctManager);
  }