Exemplo n.º 1
0
        public void VerifyCloseCombine(Guid merchantId, string smsCode, string googleCode)
        {
            var merchant = new MerchantAccountDAC().GetById(merchantId);
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = merchant.ValidationFlag,
                GoogleAuthSecretKey = merchant.AuthSecretKey
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPOS, merchant.Id.ToString(), userSecrets, options, null);

            var model = SecurityVerify.GetModel <CloseGoogleAuth>(new CustomVerifier("CloseGoogleAuth"), SystemPlatform.FiiiPOS, merchant.Id.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("CloseGoogleAuth"), SystemPlatform.FiiiPOS, merchant.Id.ToString(), model);
        }
Exemplo n.º 2
0
        public void VerifyWithdrawCombine(Guid accountId, string smsCode, string googleCode, string divisionCode)
        {
            UserAccount user = new UserAccountDAC().GetById(accountId);
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = user.ValidationFlag,
                GoogleAuthSecretKey = user.AuthSecretKey
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPay, user.Id.ToString(), userSecrets, options, divisionCode);

            var model = SecurityVerify.GetModel <WithdrawVerify>(new CustomVerifier("UserWithdraw"), SystemPlatform.FiiiPay, user.Id.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("UserWithdraw"), SystemPlatform.FiiiPay, user.Id.ToString(), model);
        }
Exemplo n.º 3
0
        public void VerifyModifyCellphoneCombine(Guid accountId, string smsCode, string googleCode)
        {
            MerchantAccount merchant = new MerchantAccountDAC().GetById(accountId);

            if (merchant == null)
            {
                throw new CommonException(ReasonCode.ACCOUNT_NOT_EXISTS, Resources.用户不存在);
            }
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = merchant.ValidationFlag,
                GoogleAuthSecretKey = merchant.AuthSecretKey
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPOS, accountId.ToString(), userSecrets, options);

            var model = SecurityVerify.GetModel <ModifyCellphoneVerify>(new CustomVerifier("ModifyCellphone"), SystemPlatform.FiiiPOS, accountId.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("ModifyCellphone"), SystemPlatform.FiiiPOS, accountId.ToString(), model);
        }
Exemplo n.º 4
0
 public void SetSecrets(UserSecrets secrets)
 {
     using (var prefs = Application.Context.GetSharedPreferences("IC6.Xwitter", FileCreationMode.Private))
     {
         using (var prefEditor = prefs.Edit())
         {
             prefEditor.PutString(OAuth.OAuthToken.ToString(), secrets.OAuthToken);
             prefEditor.PutString(OAuth.OAuthSecret.ToString(), secrets.OAuthSecret);
             prefEditor.Commit();
         }
     }
 }
Exemplo n.º 5
0
        protected LrService(
            ILogger logger,
            ILrAuthProvider authProvider)
        {
            Logger       = logger;
            AuthProvider = authProvider;

            this.Lr = new LrProvider(
                new BaseClientService.Initializer
            {
                Serializer = new WebFormsToJsonSerializer()
            });

            this.UserSecrets   = this.AuthProvider.GetUserSecrets();
            this.CommonSecrets = this.AuthProvider.GetCommonSecrets();
        }
Exemplo n.º 6
0
        public MainPageViewModel(ILoginStore loginStoreSvc, ILinqToTwitterAuthorizer authorizeSvc)
        {
            _loginStoreService = loginStoreSvc;

            _userSecrets = loginStoreSvc.GetSecrets();

            _authSvc = authorizeSvc;

            if (_userSecrets != null)
            {
                _auth = _authSvc.GetAuthorizer(consumerKey,
                                               consumerSecret,
                                               _userSecrets.OAuthToken,
                                               _userSecrets.OAuthSecret);
            }
        }
Exemplo n.º 7
0
        public UserSecrets GetSecrets()
        {
            using (var prefs = Application.Context.GetSharedPreferences("IC6.Xwitter", FileCreationMode.Private))
            {
                var secrets = new UserSecrets()
                {
                    OAuthToken  = prefs.GetString(OAuth.OAuthToken.ToString(), null),
                    OAuthSecret = prefs.GetString(OAuth.OAuthSecret.ToString(), null)
                };

                if (secrets.OAuthSecret == null || secrets.OAuthToken == null)
                {
                    return(null);
                }

                return(secrets);
            }
        }
Exemplo n.º 8
0
        public void VerifyBindCombine(UserAccount user, string smsCode)
        {
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag = user.ValidationFlag
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPay, user.Id.ToString(), userSecrets, options, null);

            var model = SecurityVerify.GetModel <BindGoogleAuth>(new CustomVerifier("BindGoogleAuth"), SystemPlatform.FiiiPay, user.Id.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("BindGoogleAuth"), SystemPlatform.FiiiPay, user.Id.ToString(), model);
        }
Exemplo n.º 9
0
        public void VerifyResetPinCombine(Guid accountId, string idNumber, string smsCode, string googleCode)
        {
            MerchantAccount merchant = new MerchantAccountDAC().GetById(accountId);

            if (merchant == null)
            {
                throw new CommonException(ReasonCode.ACCOUNT_NOT_EXISTS, Resources.用户不存在);
            }
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = merchant.ValidationFlag,
                GoogleAuthSecretKey = merchant.AuthSecretKey
            };
            MerchantProfile profile = new MerchantProfileAgent().GetMerchantProfile(accountId);

            if (profile != null && profile.L1VerifyStatus == FiiiPay.Entities.Enums.VerifyStatus.Certified)
            {
                options.Add(new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.IDNumber, Code = idNumber
                });
                userSecrets.IdentityNo = profile.IdentityDocNo;
            }

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPOS, accountId.ToString(), userSecrets, options);

            var model = new ResetPinVerify {
                CombinedVerified = true
            };

            SecurityVerify.SetModel(new CustomVerifier("ResetPin"), SystemPlatform.FiiiPOS, accountId.ToString(), model);
        }
Exemplo n.º 10
0
        public void VerifyResetPinCombine(Guid accountId, string idNumber, string smsCode, string googleCode)
        {
            UserAccount user = new UserAccountDAC().GetById(accountId);
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = user.ValidationFlag,
                GoogleAuthSecretKey = user.AuthSecretKey
            };
            UserProfile profile = new UserProfileAgent().GetUserProfile(user.Id);

            if (profile != null && profile.L1VerifyStatus == VerifyStatus.Certified)
            {
                options.Add(new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.IDNumber, Code = idNumber
                });
                userSecrets.IdentityNo = profile.IdentityDocNo;
            }

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPay, user.Id.ToString(), userSecrets, options);

            var model = new ResetPinVerify()
            {
                CombinedVerified = true
            };

            SecurityVerify.SetModel(new CustomVerifier("ResetPin"), SystemPlatform.FiiiPay, user.Id.ToString(), model);
        }
Exemplo n.º 11
0
        public void VerifyUpdateCellphoneCombine(UserAccount user, string smsCode, string googleCode)
        {
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = user.ValidationFlag,
                GoogleAuthSecretKey = user.AuthSecretKey
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPay, user.Id.ToString(), userSecrets, options);

            var model = SecurityVerify.GetModel <UpdateCellphoneVerify>(new CustomVerifier("UpdateCellphone"), SystemPlatform.FiiiPay, user.Id.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("UpdateCellphone"), SystemPlatform.FiiiPay, user.Id.ToString(), model);
        }
Exemplo n.º 12
0
 public async Task InitMapperAsync(bool includeSyncUsers, bool twoPtUsersOnProject)
 {
     await Mapper.InitAsync(UserSecrets.Get("user01"), ProjectSecret(includeSyncUsers),
                            ParatextUsersOnProject(twoPtUsersOnProject), "paratextId");
 }
Exemplo n.º 13
0
 internal static Social GetUsersSocial(this UserSecrets us, string name)
 {
     return(us.Socials?.FirstOrDefault(s => s.Name == name));
 }
Exemplo n.º 14
0
 public async Task SetSecretsAsync(UserSecrets secrets)
 {
     await SetSecretsAsync(secrets.OAuthToken, secrets.OAuthSecret);
 }