Search in sources :

Example 1 with BrowserDescriptor

use of com.microsoft.identity.common.internal.ui.browser.BrowserDescriptor in project microsoft-authentication-library-common-for-android by AzureAD.

the class BrowserSelectorTest method testSelect_versionNotSupportedBrowser.

@Test
public void testSelect_versionNotSupportedBrowser() throws NameNotFoundException {
    setBrowserList(CHROME, FIREFOX);
    when(mContext.getPackageManager().resolveActivity(BROWSER_INTENT, 0)).thenReturn(CHROME.mResolveInfo);
    List<BrowserDescriptor> browserSafelist = new ArrayList<>();
    browserSafelist.add(new BrowserDescriptor("com.android.chrome", "ChromeSignature", "51", null));
    try {
        BrowserSelector.select(mContext, browserSafelist);
    } catch (final ClientException exception) {
        assertNotNull(exception);
        assert (exception.getErrorCode().equalsIgnoreCase(ErrorStrings.NO_AVAILABLE_BROWSER_FOUND));
    }
}
Also used : ArrayList(java.util.ArrayList) BrowserDescriptor(com.microsoft.identity.common.internal.ui.browser.BrowserDescriptor) ClientException(com.microsoft.identity.common.exception.ClientException) Test(org.junit.Test)

Example 2 with BrowserDescriptor

use of com.microsoft.identity.common.internal.ui.browser.BrowserDescriptor in project microsoft-authentication-library-common-for-android by AzureAD.

the class MsalBrokerRequestAdapter method getBrowserSafeListForBroker.

/**
 * List of System Browsers which can be used from broker, currently only Chrome is supported.
 * This information here is populated from the default browser safelist in MSAL.
 *
 * @return
 */
public static List<BrowserDescriptor> getBrowserSafeListForBroker() {
    List<BrowserDescriptor> browserDescriptors = new ArrayList<>();
    final HashSet<String> signatureHashes = new HashSet<String>();
    signatureHashes.add("7fmduHKTdHHrlMvldlEqAIlSfii1tl35bxj1OXN5Ve8c4lU6URVu4xtSHc3BVZxS6WWJnxMDhIfQN0N0K2NDJg==");
    final BrowserDescriptor chrome = new BrowserDescriptor("com.android.chrome", signatureHashes, null, null);
    browserDescriptors.add(chrome);
    return browserDescriptors;
}
Also used : ArrayList(java.util.ArrayList) BrowserDescriptor(com.microsoft.identity.common.internal.ui.browser.BrowserDescriptor) GzipUtil.compressString(com.microsoft.identity.common.internal.util.GzipUtil.compressString) GzipUtil.decompressBytesToString(com.microsoft.identity.common.internal.util.GzipUtil.decompressBytesToString) HashSet(java.util.HashSet)

Aggregations

BrowserDescriptor (com.microsoft.identity.common.internal.ui.browser.BrowserDescriptor)2 ArrayList (java.util.ArrayList)2 ClientException (com.microsoft.identity.common.exception.ClientException)1 GzipUtil.compressString (com.microsoft.identity.common.internal.util.GzipUtil.compressString)1 GzipUtil.decompressBytesToString (com.microsoft.identity.common.internal.util.GzipUtil.decompressBytesToString)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1