Ejemplo n.º 1
0
        internal Silanis.ESL.SDK.Authentication ToSDKAuthentication()
        {
            if (apiAuth == null)
            {
                return(sdkAuth);
            }

            string telephoneNumber = null;

            Silanis.ESL.SDK.Authentication sdkAuthentication = null;

            if (apiAuth.Challenges.Count == 0)
            {
                sdkAuthentication = new Authentication(new AuthenticationMethodConverter(apiAuth.Scheme).ToSDKAuthMethod());
            }
            else
            {
                IList <Challenge> sdkChallenges = new List <Challenge>();
                foreach (AuthChallenge apiChallenge in apiAuth.Challenges)
                {
                    if (AuthenticationMethod.CHALLENGE.getApiValue().Equals(apiAuth.Scheme))
                    {
                        sdkChallenges.Add(new ChallengeConverter(apiChallenge).ToSDKChallenge());
                    }
                    else
                    {
                        telephoneNumber = apiChallenge.Question;
                        break;
                    }
                }

                if (AuthenticationMethod.CHALLENGE.getApiValue().Equals(apiAuth.Scheme))
                {
                    sdkAuthentication = new Silanis.ESL.SDK.Authentication(sdkChallenges);
                }
                else
                {
                    sdkAuthentication = new Silanis.ESL.SDK.Authentication(telephoneNumber);
                }
            }

            return(sdkAuthentication);
        }
        internal Silanis.ESL.SDK.Authentication ToSDKAuthentication()
        {
            if (apiAuth == null)
            {
                return sdkAuth;
            }

            string telephoneNumber = null;
            Silanis.ESL.SDK.Authentication sdkAuthentication = null;

            if (apiAuth.Challenges.Count != 0)
            {
                IList<Challenge> sdkChallenges = new List<Challenge>();
                foreach (AuthChallenge apiChallenge in apiAuth.Challenges)
                {
                    if (apiAuth.Scheme == AuthScheme.CHALLENGE)
                    {
                        sdkChallenges.Add(new ChallengeConverter(apiChallenge).ToSDKChallenge());
                    }
                    else
                    {
                        telephoneNumber = apiChallenge.Question;
                        break;
                    }
                }

                if (apiAuth.Scheme == AuthScheme.CHALLENGE)
                {
                    sdkAuthentication = new Silanis.ESL.SDK.Authentication(sdkChallenges);
                }
                else
                {
                    sdkAuthentication = new Silanis.ESL.SDK.Authentication(telephoneNumber);
                }
            }

            return sdkAuthentication;
        }
Ejemplo n.º 3
0
 public AuthenticationConverter(Silanis.ESL.SDK.Authentication sdkAuth)
 {
     this.sdkAuth = sdkAuth;
 }
 public AuthenticationConverter(Silanis.ESL.SDK.Authentication sdkAuth)
 {
     this.sdkAuth = sdkAuth;
 }