Example #1
0
        public void OpenVaultDb_throws_CanceledMultiFactorException_when_user_cancels()
        {
            var flow = new RestFlow().Post(ResponseWithError4002);

            Exceptions.AssertThrowsCanceledMultiFactor(
                () => Client.OpenVaultDb(Username, Password, DeviceId, DeviceName, GetCancelingUi(), flow),
                "Second factor step is canceled by the user");
        }
        public void OpenVault_throws_on_canceled_oob()
        {
            var flow = new RestFlow()
                       .Post(OobRequiredResponse);

            Exceptions.AssertThrowsCanceledMultiFactor(
                () => Client.OpenVault(Username, Password, ClientInfo, CancelingUi, flow),
                "Out of band step is canceled by the user");
        }
        public void OpenVault_throws_on_canceled_otp()
        {
            var flow = new RestFlow()
                       .Post(KeyIterationCount.ToString())
                       .Post(OtpRequiredResponse);

            Exceptions.AssertThrowsCanceledMultiFactor(
                () => Client.OpenVault(Username, Password, ClientInfo, CancelingUi, flow),
                "Second factor step is canceled by the user");
        }
        public void PerformSecondFactorAuthentication_throws_on_canceled_mfa()
        {
            var flow = new RestFlow();

            Exceptions.AssertThrowsCanceledMultiFactor(
                () => Client.PerformSecondFactorAuthentication(GoogleAuthFactors,
                                                               TestData.SessionKey,
                                                               new CancelingUi(),
                                                               null,
                                                               flow),
                "Second factor step is canceled by the user");
        }
        public void Open_throws_on_user_canceled_otp()
        {
            var flow = new RestFlow()
                .Post(GetFixture("exists-otp"))
                .Post(GetFixture("device-registered"))
                .Post(GetFixture("empty-vault"));

            var ui = new Mock<Ui>();
            ui.Setup(x => x.ProvideGoogleAuthPasscode(It.IsAny<int>())).Returns(Ui.Passcode.Cancel);

            Exceptions.AssertThrowsCanceledMultiFactor(() => Vault.Open(Username, Password, Uki, ui.Object, flow),
                                                       "MFA canceled by the user");
        }
        public void LogIn_continues_to_MFA_step()
        {
            var flow = new RestFlow()
                       .Post(GetFixture("login-mfa-required-response"));

            Exceptions.AssertThrowsCanceledMultiFactor(() => Client.LogIn(UserInfo,
                                                                          Password,
                                                                          OAuthCookieValue,
                                                                          new CancellingUi(),
                                                                          GetSecureStorage(),
                                                                          flow),
                                                       "is canceled by the user");
        }