From 4ca1da961ace5692cca92321b08e75ec0f4f36ce Mon Sep 17 00:00:00 2001 From: shahzaibj Date: Tue, 22 Sep 2020 16:14:27 -0700 Subject: [PATCH] Fix automation errors caused by squash merges --- .../AbstractAcquireTokenNetworkTest.java | 66 ------ .../AbstractAcquireTokenTest.java | 189 ------------------ .../AbstractPublicClientApplicationTest.java | 66 ------ .../IAcquireTokenNetworkTest.java | 47 ----- .../msal/automationapp/IAcquireTokenTest.java | 62 ------ .../IPublicClientApplicationTest.java | 28 --- .../testpass/broker/TestCase769049.java | 17 +- .../testpass/local/BrokerLessMsalTest.java | 34 ---- .../testpass/usgov/TestCase938365.java | 120 ----------- .../testpass/usgov/TestCase938367.java | 122 ----------- .../testpass/usgov/TestCase938368.java | 122 ----------- .../testpass/usgov/TestCase938384.java | 121 ----------- 12 files changed, 8 insertions(+), 986 deletions(-) delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractAcquireTokenNetworkTest.java delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractAcquireTokenTest.java delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractPublicClientApplicationTest.java delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IAcquireTokenNetworkTest.java delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IAcquireTokenTest.java delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IPublicClientApplicationTest.java delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/local/BrokerLessMsalTest.java delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938365.java delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938367.java delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938368.java delete mode 100644 msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938384.java diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractAcquireTokenNetworkTest.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractAcquireTokenNetworkTest.java deleted file mode 100644 index 8e1f95608..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractAcquireTokenNetworkTest.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp; - -import com.microsoft.identity.client.ui.automation.app.IApp; -import com.microsoft.identity.client.ui.automation.browser.BrowserChrome; -import com.microsoft.identity.internal.testutils.labutils.LabUserHelper; -import com.microsoft.identity.internal.testutils.labutils.LabUserQuery; - -import org.junit.Before; - -public abstract class AbstractAcquireTokenNetworkTest extends AbstractAcquireTokenTest implements IAcquireTokenNetworkTest { - - protected String mLoginHint; - - public static final int TEMP_USER_WAIT_TIME = 15000; - - @Before - public void setup() { - final LabUserQuery query = getLabUserQuery(); - final String tempUserType = getTempUserType(); - - if (query != null) { - mLoginHint = LabUserHelper.loadUserForTest(query); - } else if (tempUserType != null) { - mLoginHint = LabUserHelper.loadTempUser(tempUserType); - try { - // temp user takes some time to actually being created even though it may be - // returned by the LAB API. Adding a wait here before we proceed with the test. - Thread.sleep(TEMP_USER_WAIT_TIME); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } else { - throw new IllegalArgumentException("Both Lab User query and temp user type were null."); - } - - super.setup(); - } - - @Override - public IApp getBrowser() { - return new BrowserChrome(); - } - -} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractAcquireTokenTest.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractAcquireTokenTest.java deleted file mode 100644 index 1b4c0f542..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractAcquireTokenTest.java +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp; - -import com.microsoft.identity.client.AuthenticationCallback; -import com.microsoft.identity.client.IAccount; -import com.microsoft.identity.client.IAuthenticationResult; -import com.microsoft.identity.client.SilentAuthenticationCallback; -import com.microsoft.identity.client.exception.MsalException; -import com.microsoft.identity.client.ui.automation.app.IApp; -import com.microsoft.identity.client.ui.automation.broker.ITestBroker; -import com.microsoft.identity.client.ui.automation.utils.AdbShellUtils; -import com.microsoft.identity.common.internal.util.StringUtil; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; - -import java.util.concurrent.CountDownLatch; - -import static com.microsoft.identity.common.adal.internal.AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME; -import static com.microsoft.identity.common.adal.internal.AuthenticationConstants.Broker.COMPANY_PORTAL_APP_PACKAGE_NAME; -import static junit.framework.Assert.fail; - -public abstract class AbstractAcquireTokenTest extends AbstractPublicClientApplicationTest implements IAcquireTokenTest { - - private static final String TAG = AbstractAcquireTokenTest.class.getSimpleName(); - - protected String[] mScopes; - protected ITestBroker mBroker; - protected IAccount mAccount; - protected IApp mBrowser; - - protected IAccount getAccount() { - return mAccount; - } - - @Before - public void setup() { - mScopes = getScopes(); - mBroker = getBroker(); - mBrowser = getBrowser(); - - // clear all cookies in the browser - mBrowser.clear(); - - // remove existing authenticator and company portal apps - AdbShellUtils.removePackage(AZURE_AUTHENTICATOR_APP_PACKAGE_NAME); - AdbShellUtils.removePackage(COMPANY_PORTAL_APP_PACKAGE_NAME); - - if (mBroker != null) { - // do a fresh install of broker - mBroker.install(); - } - - super.setup(); - } - - @After - public void cleanup() { - mAccount = null; - } - - /** - * A callback that can be used to perform assertions on completion of an interactive request - * (success case) test. - * - * @param latch the latch associated to this request - * @return an {@link AuthenticationCallback} object - */ - protected AuthenticationCallback successfulInteractiveCallback(final CountDownLatch latch) { - return new AuthenticationCallback() { - @Override - public void onSuccess(IAuthenticationResult authenticationResult) { - Assert.assertFalse(StringUtil.isEmpty(authenticationResult.getAccessToken())); - mAccount = authenticationResult.getAccount(); - latch.countDown(); - } - - @Override - public void onError(MsalException exception) { - fail(exception.getMessage()); - latch.countDown(); - } - - @Override - public void onCancel() { - fail("User cancelled flow"); - latch.countDown(); - } - }; - } - - /** - * A callback that can be used to perform assertions on completion of an silent request - * (success case) test. - * - * @param latch the latch associated to this request - * @return an {@link AuthenticationCallback} object - */ - protected SilentAuthenticationCallback successfulSilentCallback(final CountDownLatch latch) { - return new SilentAuthenticationCallback() { - @Override - public void onSuccess(IAuthenticationResult authenticationResult) { - Assert.assertFalse(StringUtil.isEmpty(authenticationResult.getAccessToken())); - mAccount = authenticationResult.getAccount(); - latch.countDown(); - } - - @Override - public void onError(MsalException exception) { - fail(exception.getMessage()); - latch.countDown(); - } - }; - } - - /** - * A callback that can be used to perform assertions on completion of an interactive request - * (failure case) test. - * - * @param latch the latch associated to this request - * @return an {@link AuthenticationCallback} object - */ - protected AuthenticationCallback failureInteractiveCallback(final CountDownLatch latch, final String errorCode) { - return new AuthenticationCallback() { - @Override - public void onSuccess(IAuthenticationResult authenticationResult) { - fail("Unexpected success"); - latch.countDown(); - } - - @Override - public void onError(MsalException exception) { - Assert.assertEquals(errorCode, exception.getErrorCode()); - latch.countDown(); - } - - @Override - public void onCancel() { - fail("User cancelled flow"); - latch.countDown(); - } - }; - } - - /** - * A callback that can be used to perform assertions on completion of an silent request - * (failure case) test. - * - * @param latch the latch associated to this request - * @return an {@link AuthenticationCallback} object - */ - protected SilentAuthenticationCallback failureSilentCallback(final CountDownLatch latch, final String errorCode) { - return new SilentAuthenticationCallback() { - @Override - public void onSuccess(IAuthenticationResult authenticationResult) { - fail("Unexpected success"); - latch.countDown(); - } - - @Override - public void onError(MsalException exception) { - Assert.assertSame(errorCode, exception.getErrorCode()); - latch.countDown(); - } - }; - } -} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractPublicClientApplicationTest.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractPublicClientApplicationTest.java deleted file mode 100644 index d66d2c41c..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/AbstractPublicClientApplicationTest.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp; - -import android.app.Activity; -import android.content.Context; - -import androidx.test.core.app.ApplicationProvider; -import androidx.test.rule.ActivityTestRule; - -import com.microsoft.identity.client.IPublicClientApplication; -import com.microsoft.identity.client.PublicClientApplication; -import com.microsoft.identity.client.exception.MsalException; - -import org.junit.Before; -import org.junit.Rule; - -import static org.junit.Assert.fail; - -public abstract class AbstractPublicClientApplicationTest implements IPublicClientApplicationTest { - - @Rule - public ActivityTestRule mActivityRule = - new ActivityTestRule(MainActivity.class); - - protected Context mContext; - protected Activity mActivity; - protected IPublicClientApplication mApplication; - - @Before - public void setup() { - mContext = ApplicationProvider.getApplicationContext(); - mActivity = mActivityRule.getActivity(); - setupPCA(); - } - - private void setupPCA() { - try { - mApplication = PublicClientApplication.create(mContext, getConfigFileResourceId()); - } catch (InterruptedException e) { - fail(e.getMessage()); - } catch (MsalException e) { - fail(e.getMessage()); - } - } -} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IAcquireTokenNetworkTest.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IAcquireTokenNetworkTest.java deleted file mode 100644 index ea2f1c0d8..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IAcquireTokenNetworkTest.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp; - -import com.microsoft.identity.internal.testutils.labutils.LabUserQuery; - -/** - * An interface describing basic requirements to write a network (LAB API) based acquire token - * e2e test. - */ -public interface IAcquireTokenNetworkTest extends IAcquireTokenTest { - - /** - * Get the query that can be used to pull a user from the LAB API - * - * @return A {@link LabUserQuery} object that can be used to pull user via LAB API - */ - LabUserQuery getLabUserQuery(); - - /** - * Get the type of temp user that can be used to create a new temp user via LAB API - * - * @return The type of temp user as denoted in {@link com.microsoft.identity.internal.testutils.labutils.LabConstants.TempUserType} - */ - String getTempUserType(); - -} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IAcquireTokenTest.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IAcquireTokenTest.java deleted file mode 100644 index 55d72dc1b..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IAcquireTokenTest.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp; - -import com.microsoft.identity.client.ui.automation.app.IApp; -import com.microsoft.identity.client.ui.automation.broker.ITestBroker; - -/** - * An interface describing basic requirements to write an Acquire Token e2e test using MSAL library. - */ -public interface IAcquireTokenTest { - - /** - * Get the scopes that can be used for an acquire token test - * - * @return A string array consisting of OAUTH2 Scopes - */ - String[] getScopes(); - - /** - * Get the authority url that can be used for an acquire token test - * - * @return A string representing the url for an authority that can be used as token issuer - */ - String getAuthority(); - - /** - * Get the broker that can be used to during an acquire token test - * - * @return A {@link ITestBroker} object representing the broker being used during test - */ - ITestBroker getBroker(); - - /** - * Get the browser that may be being used during an acquire test. If a broker is present on the - * device then the browser may not be used for those acquire token requests. - * - * @return A {@link IApp} object representing the Android app of the browser being used - */ - IApp getBrowser(); - -} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IPublicClientApplicationTest.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IPublicClientApplicationTest.java deleted file mode 100644 index dcdb9aad4..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/IPublicClientApplicationTest.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp; - -public interface IPublicClientApplicationTest { - - int getConfigFileResourceId(); -} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/TestCase769049.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/TestCase769049.java index 525d3f95d..c7a994e79 100644 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/TestCase769049.java +++ b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/broker/TestCase769049.java @@ -24,15 +24,14 @@ import com.microsoft.identity.client.AcquireTokenParameters; import com.microsoft.identity.client.Prompt; -import com.microsoft.identity.client.msal.automationapp.AbstractAcquireTokenNetworkTest; import com.microsoft.identity.client.msal.automationapp.R; import com.microsoft.identity.client.msal.automationapp.interaction.InteractiveRequest; import com.microsoft.identity.client.msal.automationapp.interaction.OnInteractionRequired; -import com.microsoft.identity.client.ui.automation.broker.BrokerAuthenticator; +import com.microsoft.identity.client.ui.automation.broker.BrokerMicrosoftAuthenticator; import com.microsoft.identity.client.ui.automation.broker.ITestBroker; -import com.microsoft.identity.client.ui.automation.interaction.AadPromptHandler; import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; +import com.microsoft.identity.client.ui.automation.interaction.microsoftsts.AadPromptHandler; import com.microsoft.identity.internal.testutils.labutils.LabConfig; import com.microsoft.identity.internal.testutils.labutils.LabConstants; import com.microsoft.identity.internal.testutils.labutils.LabUserQuery; @@ -42,7 +41,7 @@ import java.util.Arrays; import java.util.concurrent.CountDownLatch; -public class TestCase769049 extends AbstractAcquireTokenNetworkTest { +public class TestCase769049 extends AbstractMsalBrokerTest { @Test public void test_769049() throws InterruptedException { @@ -68,12 +67,12 @@ public void handleUserInteraction() { final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() .prompt(PromptParameter.LOGIN) - .loginHintProvided(true) + .loginHint(mLoginHint) .sessionExpected(false) .consentPageExpected(false) .speedBumpExpected(false) .broker(getBroker()) - .expectingNonZeroAccountsInBroker(false) + .expectingBrokerAccountChooserActivity(false) .build(); new AadPromptHandler(promptHandlerParameters) @@ -108,12 +107,12 @@ public void handleUserInteraction() { final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() .prompt(PromptParameter.LOGIN) - .loginHintProvided(false) .sessionExpected(true) .consentPageExpected(false) .speedBumpExpected(false) .broker(getBroker()) - .expectingNonZeroAccountsInBroker(true) + .expectingBrokerAccountChooserActivity(true) + .expectingProvidedAccountInBroker(true) .build(); new AadPromptHandler(promptHandlerParameters) @@ -151,7 +150,7 @@ public String getAuthority() { @Override public ITestBroker getBroker() { - return new BrokerAuthenticator(); + return new BrokerMicrosoftAuthenticator(); } @Override diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/local/BrokerLessMsalTest.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/local/BrokerLessMsalTest.java deleted file mode 100644 index f8aa9a85a..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/local/BrokerLessMsalTest.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp.testpass.local; - -import com.microsoft.identity.client.msal.automationapp.AbstractAcquireTokenNetworkTest; -import com.microsoft.identity.client.ui.automation.broker.ITestBroker; - -public abstract class BrokerLessMsalTest extends AbstractAcquireTokenNetworkTest { - - @Override - public ITestBroker getBroker() { - return null; - } -} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938365.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938365.java deleted file mode 100644 index ca7c88b39..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938365.java +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp.testpass.usgov; - -import com.microsoft.identity.client.AcquireTokenParameters; -import com.microsoft.identity.client.Prompt; -import com.microsoft.identity.client.msal.automationapp.AbstractAcquireTokenNetworkTest; -import com.microsoft.identity.client.msal.automationapp.R; -import com.microsoft.identity.client.msal.automationapp.interaction.InteractiveRequest; -import com.microsoft.identity.client.msal.automationapp.interaction.OnInteractionRequired; -import com.microsoft.identity.client.ui.automation.broker.ITestBroker; -import com.microsoft.identity.client.ui.automation.interaction.AadPromptHandler; -import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; -import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; -import com.microsoft.identity.internal.testutils.labutils.LabConfig; -import com.microsoft.identity.internal.testutils.labutils.LabConstants; -import com.microsoft.identity.internal.testutils.labutils.LabUserQuery; - -import org.junit.Test; - -import java.util.Arrays; -import java.util.concurrent.CountDownLatch; - -// Interactive token acquisition with instance_aware=true, no login hint, and cloud account, -// and WW common authority -public class TestCase938365 extends AbstractAcquireTokenNetworkTest { - - @Test - public void test_938365() throws InterruptedException { - final CountDownLatch latch = new CountDownLatch(1); - - final AcquireTokenParameters parameters = new AcquireTokenParameters.Builder() - .startAuthorizationFromActivity(mActivity) - .withScopes(Arrays.asList(mScopes)) - .withCallback(successfulInteractiveCallback(latch)) - .withPrompt(Prompt.SELECT_ACCOUNT) - .build(); - - - final InteractiveRequest interactiveRequest = new InteractiveRequest( - mApplication, - parameters, - new OnInteractionRequired() { - @Override - public void handleUserInteraction() { - mBrowser.handleFirstRun(); - - final String username = mLoginHint; - final String password = LabConfig.getCurrentLabConfig().getLabUserPassword(); - - final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() - .loginHintProvided(false) - .sessionExpected(false) - .consentPageExpected(false) - .speedBumpExpected(false) - .prompt(PromptParameter.SELECT_ACCOUNT) - .build(); - - new AadPromptHandler(promptHandlerParameters) - .handlePrompt(username, password); - } - } - ); - - interactiveRequest.execute(); - latch.await(); - } - - @Override - public LabUserQuery getLabUserQuery() { - final LabUserQuery query = new LabUserQuery(); - query.azureEnvironment = LabConstants.AzureEnvironment.AZURE_US_GOVERNMENT; - return query; - } - - @Override - public String getTempUserType() { - return null; - } - - @Override - public String[] getScopes() { - return new String[]{"User.read"}; - } - - @Override - public String getAuthority() { - return mApplication.getConfiguration().getDefaultAuthority().toString(); - } - - @Override - public ITestBroker getBroker() { - return null; - } - - @Override - public int getConfigFileResourceId() { - return R.raw.msal_config_instance_aware_common; - } -} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938367.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938367.java deleted file mode 100644 index b1a44a9de..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938367.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp.testpass.usgov; - -import com.microsoft.identity.client.AcquireTokenParameters; -import com.microsoft.identity.client.Prompt; -import com.microsoft.identity.client.msal.automationapp.AbstractAcquireTokenNetworkTest; -import com.microsoft.identity.client.msal.automationapp.R; -import com.microsoft.identity.client.msal.automationapp.interaction.InteractiveRequest; -import com.microsoft.identity.client.msal.automationapp.interaction.OnInteractionRequired; -import com.microsoft.identity.client.ui.automation.broker.ITestBroker; -import com.microsoft.identity.client.ui.automation.interaction.AadPromptHandler; -import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; -import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; -import com.microsoft.identity.internal.testutils.labutils.LabConfig; -import com.microsoft.identity.internal.testutils.labutils.LabConstants; -import com.microsoft.identity.internal.testutils.labutils.LabUserQuery; - -import org.junit.Test; - -import java.util.Arrays; -import java.util.concurrent.CountDownLatch; - -// Interactive token acquisition with instance_aware=true, login hint present, and cloud account, -// and WW organizations authority -public class TestCase938367 extends AbstractAcquireTokenNetworkTest { - - @Test - public void test_938367() throws InterruptedException { - final CountDownLatch latch = new CountDownLatch(1); - - final AcquireTokenParameters parameters = new AcquireTokenParameters.Builder() - .withLoginHint(mLoginHint) - .startAuthorizationFromActivity(mActivity) - .withScopes(Arrays.asList(mScopes)) - .withCallback(successfulInteractiveCallback(latch)) - .withPrompt(Prompt.SELECT_ACCOUNT) - .build(); - - - final InteractiveRequest interactiveRequest = new InteractiveRequest( - mApplication, - parameters, - new OnInteractionRequired() { - @Override - public void handleUserInteraction() { - mBrowser.handleFirstRun(); - - final String username = mLoginHint; - final String password = LabConfig.getCurrentLabConfig().getLabUserPassword(); - - final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() - .prompt(PromptParameter.SELECT_ACCOUNT) - .loginHintProvided(true) - .sessionExpected(false) - .consentPageExpected(false) - .speedBumpExpected(false) - .build(); - - new AadPromptHandler(promptHandlerParameters) - .handlePrompt(username, password); - } - } - ); - - interactiveRequest.execute(); - latch.await(); - } - - @Override - public LabUserQuery getLabUserQuery() { - final LabUserQuery query = new LabUserQuery(); - query.azureEnvironment = LabConstants.AzureEnvironment.AZURE_US_GOVERNMENT; - return query; - } - - @Override - public String getTempUserType() { - return null; - } - - @Override - public String[] getScopes() { - return new String[]{"User.read"}; - } - - @Override - public String getAuthority() { - return mApplication.getConfiguration().getDefaultAuthority().toString(); - } - - @Override - public ITestBroker getBroker() { - return null; - } - - @Override - public int getConfigFileResourceId() { - return R.raw.msal_config_instance_aware_organization; - } - -} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938368.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938368.java deleted file mode 100644 index 42febc46f..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938368.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp.testpass.usgov; - -import com.microsoft.identity.client.AcquireTokenParameters; -import com.microsoft.identity.client.Prompt; -import com.microsoft.identity.client.msal.automationapp.AbstractAcquireTokenNetworkTest; -import com.microsoft.identity.client.msal.automationapp.R; -import com.microsoft.identity.client.msal.automationapp.interaction.InteractiveRequest; -import com.microsoft.identity.client.msal.automationapp.interaction.OnInteractionRequired; -import com.microsoft.identity.client.ui.automation.broker.ITestBroker; -import com.microsoft.identity.client.ui.automation.interaction.AadPromptHandler; -import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; -import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; -import com.microsoft.identity.internal.testutils.labutils.LabConfig; -import com.microsoft.identity.internal.testutils.labutils.LabConstants; -import com.microsoft.identity.internal.testutils.labutils.LabUserQuery; - -import org.junit.Test; - -import java.util.Arrays; -import java.util.concurrent.CountDownLatch; - -// Interactive token acquisition with instance_aware=true, login hint present, and federated account, -// and WW common authority -public class TestCase938368 extends AbstractAcquireTokenNetworkTest { - - @Test - public void test_938368() throws InterruptedException { - final CountDownLatch latch = new CountDownLatch(1); - - final AcquireTokenParameters parameters = new AcquireTokenParameters.Builder() - .withLoginHint(mLoginHint) - .startAuthorizationFromActivity(mActivity) - .withScopes(Arrays.asList(mScopes)) - .withCallback(successfulInteractiveCallback(latch)) - .withPrompt(Prompt.SELECT_ACCOUNT) - .build(); - - - final InteractiveRequest interactiveRequest = new InteractiveRequest( - mApplication, - parameters, - new OnInteractionRequired() { - @Override - public void handleUserInteraction() { - mBrowser.handleFirstRun(); - - final String username = mLoginHint; - final String password = LabConfig.getCurrentLabConfig().getLabUserPassword(); - - final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() - .prompt(PromptParameter.SELECT_ACCOUNT) - .loginHintProvided(true) - .sessionExpected(false) - .consentPageExpected(false) - .speedBumpExpected(false) - .build(); - - new AadPromptHandler(promptHandlerParameters) - .handlePrompt(username, password); - } - } - ); - - interactiveRequest.execute(); - latch.await(); - } - - @Override - public LabUserQuery getLabUserQuery() { - final LabUserQuery query = new LabUserQuery(); - query.azureEnvironment = LabConstants.AzureEnvironment.AZURE_CLOUD; - return query; - } - - @Override - public String getTempUserType() { - return null; - } - - @Override - public String[] getScopes() { - return new String[]{"User.read"}; - } - - @Override - public String getAuthority() { - return mApplication.getConfiguration().getDefaultAuthority().toString(); - } - - @Override - public ITestBroker getBroker() { - return null; - } - - @Override - public int getConfigFileResourceId() { - return R.raw.msal_config_instance_aware_common; - } - -} diff --git a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938384.java b/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938384.java deleted file mode 100644 index 6ae86ba82..000000000 --- a/msalautomationapp/src/androidTest/java/com/microsoft/identity/client/msal/automationapp/testpass/usgov/TestCase938384.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.msal.automationapp.testpass.usgov; - -import com.microsoft.identity.client.AcquireTokenParameters; -import com.microsoft.identity.client.Prompt; -import com.microsoft.identity.client.msal.automationapp.AbstractAcquireTokenNetworkTest; -import com.microsoft.identity.client.msal.automationapp.R; -import com.microsoft.identity.client.msal.automationapp.interaction.InteractiveRequest; -import com.microsoft.identity.client.msal.automationapp.interaction.OnInteractionRequired; -import com.microsoft.identity.client.ui.automation.broker.ITestBroker; -import com.microsoft.identity.client.ui.automation.interaction.AadPromptHandler; -import com.microsoft.identity.client.ui.automation.interaction.PromptHandlerParameters; -import com.microsoft.identity.client.ui.automation.interaction.PromptParameter; -import com.microsoft.identity.internal.testutils.labutils.LabConfig; -import com.microsoft.identity.internal.testutils.labutils.LabConstants; -import com.microsoft.identity.internal.testutils.labutils.LabUserQuery; - -import org.junit.Test; - -import java.util.Arrays; -import java.util.concurrent.CountDownLatch; - -// Interactive token acquisition with instance_aware=false and USGov authority -public class TestCase938384 extends AbstractAcquireTokenNetworkTest { - - @Test - public void test_938384() throws InterruptedException { - final CountDownLatch latch = new CountDownLatch(1); - - final AcquireTokenParameters parameters = new AcquireTokenParameters.Builder() - .startAuthorizationFromActivity(mActivity) - .withScopes(Arrays.asList(mScopes)) - .withCallback(successfulInteractiveCallback(latch)) - .withPrompt(Prompt.SELECT_ACCOUNT) - .fromAuthority(getAuthority()) - .build(); - - - final InteractiveRequest interactiveRequest = new InteractiveRequest( - mApplication, - parameters, - new OnInteractionRequired() { - @Override - public void handleUserInteraction() { - mBrowser.handleFirstRun(); - - final String username = mLoginHint; - final String password = LabConfig.getCurrentLabConfig().getLabUserPassword(); - - final PromptHandlerParameters promptHandlerParameters = PromptHandlerParameters.builder() - .prompt(PromptParameter.SELECT_ACCOUNT) - .loginHintProvided(false) - .sessionExpected(false) - .consentPageExpected(false) - .speedBumpExpected(false) - .build(); - - new AadPromptHandler(promptHandlerParameters) - .handlePrompt(username, password); - } - } - ); - - interactiveRequest.execute(); - latch.await(); - } - - @Override - public LabUserQuery getLabUserQuery() { - final LabUserQuery query = new LabUserQuery(); - query.azureEnvironment = LabConstants.AzureEnvironment.AZURE_US_GOVERNMENT; - return query; - } - - @Override - public String getTempUserType() { - return null; - } - - @Override - public String[] getScopes() { - return new String[]{"User.read"}; - } - - @Override - public String getAuthority() { - return "https://login.microsoftonline.us/common"; - } - - @Override - public ITestBroker getBroker() { - return null; - } - - @Override - public int getConfigFileResourceId() { - return R.raw.msal_config_default; - } - -}