Ejemplo n.º 1
0
            public void VerifyUser()
            {
                KeyVaultClient KeyVault;

                try
                {
                    var azureServiceTokenProvider = new AzureServiceTokenProvider();
                    var _token = azureServiceTokenProvider.GetAccessTokenAsync("https://vault.azure.net").Result;
                    KeyVault = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
                }
                catch (Exception e)
                {
                    throw e;
                }
                var    bundle         = KeyVault.GetSecretAsync("https://pr-kv-uks-dev.vault.azure.net/secrets/AppConnectionKey").Result;
                string appAccessToken = bundle.Value;

                string            resetToken = "ThClkDquzDXMLQ1tVJvpUCkBxg2RQOG0ilNuu6BZj4IKI0sCam";
                VerifyUserRequest request    = new VerifyUserRequest(connection, appAccessToken, resetToken);


                VerifyUserResponse response = request.Send();

                Assert.AreEqual(response.StatusCode, System.Net.HttpStatusCode.OK);
            }
        public async Task <VerifyUserResult> VerifyUser(VerifyUserRequest model)
        {
            var user = await _userAppService.GetAsync(new EntityDto <long>(model.UserId));

            await _twiioVerificationService.ConfirmVerification(user.PhoneNumber, model.Code);

            return(new VerifyUserResult {
                IsVerified = true
            });
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> LogIn(string email, [FromBody] VerifyUserRequest createRequest, [FromServices] IJwtSigningEncodingKey signingEncodingKey)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var user = await _service.LogIn(createRequest, signingEncodingKey);

            return(Ok(user));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 同步通过好友认证
 /// </summary>
 /// <param name="info">sync中获得的申请信息</param>
 /// <returns></returns>
 public SimpleResponse VerifyUser(RecommendInfo info)
 {
     string verifyUserUrl = host + "/cgi-bin/mmwebwx-bin/webwxverifyuser?r=" + Utils.GetJavaTimeStamp();
     VerifyUserRequest request = new VerifyUserRequest();
     request.BaseRequest = baseRequest;
     request.Opcode = VERIFYUSER_OPCODE.VERIFYUSER_OPCODE_VERIFYOK;
     request.SceneList = new List<int>() { (int)ADDSCENE_PF.ADDSCENE_PF_WEB };
     request.VerifyUserList = new List<Modal.Request.VerifyUser>() { new Modal.Request.VerifyUser { Value = info.UserName, VerifyUserTicket = info.Ticket } };
     request.skey = baseRequest.Skey;
     //反馈结果可以不理
     return httpClient.PostJson<SimpleResponse>(verifyUserUrl, request);
 }
Ejemplo n.º 5
0
        public object Get(VerifyUserRequest req)
        {
            // get user for the activation key
            using (var db = DbConfig.GetConnection ()) {
                var user = db.First<DBUser> (u => u.VerifySecret == req.VerifySecret);

                if (user == null) return new HttpResult () {
                    StatusCode = HttpStatusCode.NotFound
                };

                user.IsVerified = true;
                user.VerifySecret = "";
                db.Save (user);
            }
            return new HttpResult () {
                StatusCode = HttpStatusCode.OK
            };
        }
        //Verify email
        public ActionResult Verify(string token)
        {
            string connection     = ConfigurationManager.AppSettings["InternalAPIURL"];
            var    appAccessToken = WebUtils.GetVaultSecret("AppConnectionKey");

            VerifyUserRequest  verifyRequest  = new VerifyUserRequest(connection, appAccessToken, token);
            VerifyUserResponse verifyResponse = verifyRequest.Send();

            if (verifyResponse.StatusCode == System.Net.HttpStatusCode.OK)
            {
                TempData["Success"] = "You have successfully verified your email address. You can now login below.";
            }
            else
            {
                TempData["Errors"] = "There was an error processing your request.";
            }

            return(RedirectToAction("Login", "Account"));
        }
Ejemplo n.º 7
0
        public async Task <UserToken> LogIn(VerifyUserRequest request, IJwtSigningEncodingKey signingEncodingKey)
        {
            //request.Password = Crypto.ComputeSha256Hash(request.Password);
            var dbUsers = await _context.Users.Find(us => us.Email == request.Email && us.Password == request.Password).ToListAsync();

            if (dbUsers.Count == 0)
            {
                throw new CreateFailedException("Incorrect email or password");
            }
            var u = _mapper.Map <User>(dbUsers[0]);

            string token = CreateToken(u, signingEncodingKey);

            UserToken user = new UserToken
            {
                Id    = u.Id,
                Token = token,
                Name  = u.Name,
            };

            return(user);
        }
Ejemplo n.º 8
0
        public object Get(VerifyUserRequest req)
        {
            // get user for the activation key
            using (var db = DbConfig.GetConnection()) {
                var user = db.First <DBUser> (u => u.VerifySecret == req.VerifySecret);

                if (user == null)
                {
                    return new HttpResult()
                           {
                               StatusCode = HttpStatusCode.NotFound
                           }
                }
                ;

                user.IsVerified   = true;
                user.VerifySecret = "";
                db.Save(user);
            }
            return(new HttpResult()
            {
                StatusCode = HttpStatusCode.OK
            });
        }
Ejemplo n.º 9
0
 public async Task <UserToken> LogIn(VerifyUserRequest request, IJwtSigningEncodingKey signingEncodingKey)
 {
     return(await _repository.LogIn(request, signingEncodingKey));
 }