Beispiel #1
0
		internal Silanis.ESL.API.Auth ToAPIAuthentication ()
		{
			Silanis.ESL.API.Auth auth = new Silanis.ESL.API.Auth ();

			auth.Scheme = Scheme ();

			foreach (Challenge challenge in challenges)
			{
				Silanis.ESL.API.AuthChallenge authChallenge = new Silanis.ESL.API.AuthChallenge();

				authChallenge.Question = challenge.Question;
				authChallenge.Answer = challenge.Answer;
				auth.AddChallenge (authChallenge);
			}

			if (!String.IsNullOrEmpty (PhoneNumber))
			{
				Silanis.ESL.API.AuthChallenge challenge = new Silanis.ESL.API.AuthChallenge ();

				challenge.Question = PhoneNumber;
				auth.AddChallenge (challenge);
			}

			return auth;
		}
        public Silanis.ESL.API.AuthChallenge ToAPIChallenge()
        {
            if (sdkChallenge == null)
            {
                return apiChallenge;
            }

            Silanis.ESL.API.AuthChallenge result = new Silanis.ESL.API.AuthChallenge();
            result.Question = sdkChallenge.Question;
            result.Answer = sdkChallenge.Answer;

            switch (sdkChallenge.MaskOption)
            {
                case Challenge.MaskOptions.MaskInput:
                    result.MaskInput = true;
                    break;
                case Challenge.MaskOptions.None:
                    result.MaskInput = false;
                    break;
                default:
                    throw new EslException("Invalid SDK Challenge.MaskOption enum", null);
            }

            return result;
        }
        public void ConvertNullAPIToAPI()
        {
            apiAuthChallenge1 = null;
            converter = new ChallengeConverter(apiAuthChallenge1);

            Assert.IsNull(converter.ToAPIChallenge());
        }
        public Silanis.ESL.API.AuthChallenge ToAPIChallenge()
        {
            if (sdkChallenge == null)
            {
                return(apiChallenge);
            }

            Silanis.ESL.API.AuthChallenge result = new Silanis.ESL.API.AuthChallenge();
            result.Question = sdkChallenge.Question;
            result.Answer   = sdkChallenge.Answer;

            switch (sdkChallenge.MaskOption)
            {
            case Challenge.MaskOptions.MaskInput:
                result.MaskInput = true;
                break;

            case Challenge.MaskOptions.None:
                result.MaskInput = false;
                break;

            default:
                result.MaskInput = true;
                break;
            }

            return(result);
        }
        public void ConvertNullAPIToAPI()
        {
            apiAuthChallenge1 = null;
            converter         = new ChallengeConverter(apiAuthChallenge1);

            Assert.IsNull(converter.ToAPIChallenge());
        }
Beispiel #6
0
        internal Silanis.ESL.API.Auth ToAPIAuthentication()
        {
            Silanis.ESL.API.Auth auth = new Silanis.ESL.API.Auth();

            auth.Scheme = Scheme();

            foreach (Challenge challenge in challenges)
            {
                Silanis.ESL.API.AuthChallenge authChallenge = new Silanis.ESL.API.AuthChallenge();

                authChallenge.Question = challenge.Question;
                authChallenge.Answer   = challenge.Answer;
                auth.AddChallenge(authChallenge);
            }

            if (!String.IsNullOrEmpty(PhoneNumber))
            {
                Silanis.ESL.API.AuthChallenge challenge = new Silanis.ESL.API.AuthChallenge();

                challenge.Question = PhoneNumber;
                auth.AddChallenge(challenge);
            }

            return(auth);
        }
        public void ConvertAPIToAPI()
        {
            apiAuthChallenge1 = CreateTypicalAPIChallenge();
            converter = new ChallengeConverter(apiAuthChallenge1);
            apiAuthChallenge2 = converter.ToAPIChallenge();

            Assert.IsNotNull(apiAuthChallenge2);
            Assert.AreEqual(apiAuthChallenge2, apiAuthChallenge1);
        }
        private Silanis.ESL.API.AuthChallenge CreateTypicalAPIChallenge()
        {
            Silanis.ESL.API.AuthChallenge result = new Silanis.ESL.API.AuthChallenge();
            result.Question  = "What is the name of your dog?";
            result.Answer    = "Max";
            result.MaskInput = false;

            return(result);
        }
        public void ConvertAPIToAPI()
        {
            apiAuthChallenge1 = CreateTypicalAPIChallenge();
            converter         = new ChallengeConverter(apiAuthChallenge1);
            apiAuthChallenge2 = converter.ToAPIChallenge();

            Assert.IsNotNull(apiAuthChallenge2);
            Assert.AreEqual(apiAuthChallenge2, apiAuthChallenge1);
        }
        public void ConvertAPIToSDK()
        {
            apiAuthChallenge1 = CreateTypicalAPIChallenge();
            sdkAuthChallenge1 = new ChallengeConverter(apiAuthChallenge1).ToSDKChallenge();

            Assert.IsNotNull(sdkAuthChallenge1);
            Assert.AreEqual(sdkAuthChallenge1.Question, apiAuthChallenge1.Question);
            Assert.AreEqual(sdkAuthChallenge1.Answer, apiAuthChallenge1.Answer);
            Assert.AreEqual(sdkAuthChallenge1.MaskOption, Challenge.MaskOptions.None);
        }
        public void ConvertSDKToAPI()
        {
            sdkAuthChallenge1 = CreateTypicalSDKChallenge();
            apiAuthChallenge1 = new ChallengeConverter(sdkAuthChallenge1).ToAPIChallenge();

            Assert.IsNotNull(apiAuthChallenge1);
            Assert.AreEqual(apiAuthChallenge1.Question, sdkAuthChallenge1.Question);
            Assert.AreEqual(apiAuthChallenge1.Answer, sdkAuthChallenge1.Answer);
            Assert.AreEqual(apiAuthChallenge1.MaskInput, true);
        }
        public void ConvertAPIToSDK()
        {
            apiAuthChallenge1 = CreateTypicalAPIChallenge();
            sdkAuthChallenge1 = new ChallengeConverter(apiAuthChallenge1).ToSDKChallenge();

            Assert.IsNotNull(sdkAuthChallenge1);
            Assert.AreEqual(sdkAuthChallenge1.Question, apiAuthChallenge1.Question);
            Assert.AreEqual(sdkAuthChallenge1.Answer, apiAuthChallenge1.Answer);
            Assert.AreEqual(sdkAuthChallenge1.MaskOption, Challenge.MaskOptions.None);
        }
Beispiel #13
0
        private Silanis.ESL.API.Auth CreateTypicalAPIAuthentication()
        {
            Silanis.ESL.API.Auth          result        = new Silanis.ESL.API.Auth();
            Silanis.ESL.API.AuthChallenge authChallenge = new Silanis.ESL.API.AuthChallenge();
            authChallenge.Question  = "What is the name of your dog?";
            authChallenge.Answer    = "Max";
            authChallenge.MaskInput = true;
            result.AddChallenge(authChallenge);
            result.Scheme = Silanis.ESL.API.AuthScheme.CHALLENGE;

            return(result);
        }
 /// <summary>
 /// Construct with API object involved in conversion.
 /// </summary>
 /// <param name="apiChallenge">API challenge.</param>
 public ChallengeConverter(Silanis.ESL.API.AuthChallenge apiChallenge)
 {
     this.apiChallenge = apiChallenge;
 }
 /// <summary>
 /// Construct with API object involved in conversion.
 /// </summary>
 /// <param name="apiChallenge">API challenge.</param>
 public ChallengeConverter(Silanis.ESL.API.AuthChallenge apiChallenge)
 {
     this.apiChallenge = apiChallenge;
 }
        private Silanis.ESL.API.Auth CreateTypicalAPIAuthentication()
        {
            Silanis.ESL.API.Auth result = new Silanis.ESL.API.Auth();
            Silanis.ESL.API.AuthChallenge authChallenge = new Silanis.ESL.API.AuthChallenge();
            authChallenge.Question = "What is the name of your dog?";
            authChallenge.Answer = "Max";
            authChallenge.MaskInput = true;
            result.AddChallenge(authChallenge);
            result.Scheme = Silanis.ESL.API.AuthScheme.CHALLENGE;

            return result;
        }
        private Silanis.ESL.API.AuthChallenge CreateTypicalAPIChallenge()
        {
            Silanis.ESL.API.AuthChallenge result = new Silanis.ESL.API.AuthChallenge();
            result.Question = "What is the name of your dog?";
            result.Answer = "Max";
            result.MaskInput = false;

            return result;
        }
        public void ConvertSDKToAPI()
        {
            sdkAuthChallenge1 = CreateTypicalSDKChallenge();
            apiAuthChallenge1 = new ChallengeConverter(sdkAuthChallenge1).ToAPIChallenge();

            Assert.IsNotNull(apiAuthChallenge1);
            Assert.AreEqual(apiAuthChallenge1.Question, sdkAuthChallenge1.Question);
            Assert.AreEqual(apiAuthChallenge1.Answer, sdkAuthChallenge1.Answer);
            Assert.AreEqual(apiAuthChallenge1.MaskInput, true);
        }