/// <summary>
        /// GetAuthenticationMethods method implmentation
        /// </summary>
        public override List <AvailableAuthenticationMethod> GetAuthenticationMethods(AuthenticationContext ctx)
        {
            if (!IsInitialized)
            {
                throw new Exception("Provider not initialized !");
            }

            List <AvailableAuthenticationMethod> result = GetSessionData(this.Kind, ctx);

            if (result != null)
            {
                return(result);
            }
            else
            {
                result = new List <AvailableAuthenticationMethod>();
#if !azuretest
                GetAvailableAuthenticationMethodsResponse authMethods = GetAzureAvailableAuthenticationMethods(ctx);
                foreach (AuthenticationMethod current in authMethods.AuthenticationMethods)
                {
                    AvailableAuthenticationMethod item = GetAuthenticationMethodProperties(current);
                    if (item.Method != AuthenticationResponseKind.Error)
                    {
                        item.IsDefault = current.IsDefault;
                        result.Add(item);
                    }
                }
#else
                AuthenticationMethod current1 = new AuthenticationMethod()
                {
                    Id = "OneWaySMS", IsDefault = true
                };
                current1.Properties.Add("MobilePhone", "+33 123123456");
                AuthenticationMethod current2 = new AuthenticationMethod()
                {
                    Id = "TwoWaySMS", IsDefault = false
                };
                current2.Properties.Add("MobilePhone", "+33 123123456");
                AvailableAuthenticationMethod item1 = GetAuthenticationMethodProperties(current1);
                item1.IsDefault = current1.IsDefault;
                result.Add(item1);
                AvailableAuthenticationMethod item2 = GetAuthenticationMethodProperties(current2);
                item2.IsDefault = current2.IsDefault;
                result.Add(item2);
#endif
                if (result.Count > 0)
                {
                    SaveSessionData(this.Kind, ctx, result);
                }
            }
            return(result);
        }
        /// <summary>
        /// GetAuthenticationMethod method implementation
        /// </summary>
        private AvailableAuthenticationMethod GetAuthenticationMethodProperties(AuthenticationMethod method)
        {
            AvailableAuthenticationMethod result = new AvailableAuthenticationMethod();

            result.IsDefault     = false;
            result.RequiredPin   = false;
            result.IsRemote      = true;
            result.IsTwoWay      = false;
            result.IsSendBack    = true;
            result.RequiredEmail = false;
            result.RequiredPhone = false;
            result.RequiredCode  = false;
            if (method.Id == "PhoneAppNotification")
            {
                result.IsTwoWay      = true;
                result.RequiredEmail = false;
                result.RequiredPhone = false;
                result.RequiredCode  = false;
                result.Method        = AuthenticationResponseKind.PhoneAppNotification;
            }
            else if (method.Id == "PhoneAppOTP")
            {
                result.RequiredEmail = false;
                result.RequiredPhone = false;
                result.RequiredCode  = true;
                result.Method        = AuthenticationResponseKind.PhoneAppOTP;
            }
            else if (method.Id == "OneWaySMS")
            {
                result.RequiredEmail = false;
                result.RequiredPhone = false;
                result.RequiredCode  = true;
                if (method.Properties.ContainsKey("MobilePhone"))
                {
                    result.ExtraInfos = method.Properties["MobilePhone"];
                }
                if (method.Properties.ContainsKey("PinEnabled"))
                {
                    result.RequiredPin = true;
                    result.Method      = AuthenticationResponseKind.SmsOneWayOTPplusPin;
                }
                else
                {
                    result.Method = AuthenticationResponseKind.SmsOneWayOTP;
                }
            }
            else if (method.Id == "TwoWaySMS")
            {
                result.RequiredEmail = false;
                result.RequiredPhone = false;
                result.RequiredCode  = false;
                result.IsTwoWay      = true;
                if (method.Properties.ContainsKey("MobilePhone"))
                {
                    result.ExtraInfos = method.Properties["MobilePhone"];
                }
                if (method.Properties.ContainsKey("PinEnabled"))
                {
                    result.RequiredPin = true;
                    result.Method      = AuthenticationResponseKind.SmsTwoWayOTPplusPin;
                }
                else
                {
                    result.Method = AuthenticationResponseKind.SmsTwoWayOTP;
                }
            }
            else if (method.Id == "TwoWayVoiceMobile")
            {
                result.RequiredEmail = false;
                result.RequiredPhone = false;
                result.RequiredCode  = false;
                result.IsTwoWay      = true;
                if (method.Properties.ContainsKey("MobilePhone"))
                {
                    result.ExtraInfos = method.Properties["MobilePhone"];
                }
                if (method.Properties.ContainsKey("PinEnabled"))
                {
                    result.RequiredPin = true;
                    result.Method      = AuthenticationResponseKind.VoiceTwoWayMobilePlusPin;
                }
                else
                {
                    result.Method = AuthenticationResponseKind.VoiceTwoWayMobile;
                }
            }
            else if (method.Id == "TwoWayVoiceOffice")
            {
                result.RequiredEmail = false;
                result.RequiredPhone = false;
                result.RequiredCode  = false;
                result.IsTwoWay      = true;
                if (method.Properties.ContainsKey("PhoneNumber"))
                {
                    result.ExtraInfos = method.Properties["PhoneNumber"];
                }
                if (method.Properties.ContainsKey("PhoneNumber"))
                {
                    result.RequiredPin = true;
                    result.Method      = AuthenticationResponseKind.VoiceTwoWayOfficePlusPin;
                }
                else
                {
                    result.Method = AuthenticationResponseKind.VoiceTwoWayOffice;
                }
            }
            else if (method.Id == "TwoWayVoiceAlternateMobile")
            {
                result.RequiredEmail = false;
                result.RequiredPhone = false;
                result.RequiredCode  = false;
                result.IsTwoWay      = true;
                if (method.Properties.ContainsKey("AlternateMobilePhone"))
                {
                    result.ExtraInfos = method.Properties["AlternateMobilePhone"];
                }
                if (method.Properties.ContainsKey("PinEnabled"))
                {
                    result.RequiredPin = true;
                    result.Method      = AuthenticationResponseKind.VoiceTwoWayAlternateMobilePlusPin;
                }
                else
                {
                    result.Method = AuthenticationResponseKind.VoiceTwoWayAlternateMobile;
                }
            }
            else
            {
                result.Method = AuthenticationResponseKind.Error;
            }
            return(result);
        }