Beispiel #1
0
        public void GetUserSuccess()
        {
            var c   = new DefaultClient(token);
            var ret = c.Execute(new GetUserRequest(2));

            Console.WriteLine(ret.email);
        }
Beispiel #2
0
        public void GetNodesSuccess()
        {
            var c  = new DefaultClient(token);
            var ls = c.Execute(new GetNodesRequest());

            Console.WriteLine(ls.Count);
        }
    private IClient MakeSampleClient()
    {
      IClient client = new DefaultClient();

      client.Name = "test";
      client.IsEnabled = true;
      client.PluginTemplate = new DefaultPluginTemplate()
      {
        DLLName = "dllname",
        FullClassName = "fullclassname"
      };
      //client.Properties = new ClientProperties()
      //{
      //  Description = "description",
      //  IsEnabled = true,
      //  Name = client.Name,
      //};
      client.Schedule = new Common.Client.ClientSchedule()
      {
        IsRunContinuously = true,
        RunEverySeconds = 34
      };

      return client;
    }
Beispiel #4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtEmail.Text.IsNullOrEmpty() || txtPasswd.Text.IsNullOrEmpty())
            {
                return;
            }
            btnLogin.Text    = "登录中,请稍候...";
            btnLogin.Enabled = false;

            var       client = new DefaultClient();
            TokenData tokenData;

            try
            {
                tokenData = client.Execute(new TokenRequest()
                {
                    Email = txtEmail.Text.Trim(), Passwd = txtPasswd.Text
                });
                client.Token = tokenData.token;

                //获取用户信息
                var user = client.Execute(new GetUserRequest(tokenData.user_id));
                if (user.enable != 1)
                {
                    throw new UserFriendlyException("你的账号已经到期,请先充值后再畅游世界"); //todo:how to charge
                }
                if (user.transfer_enable < user.u + user.d)
                {
                    throw new UserFriendlyException("哦,你的流量都用完了,请先充值吧!");
                }

                //获取节点
                var nodes  = client.Execute(new GetNodesRequest());
                var config = _controller.GetCurrentConfiguration();
                config.configs = nodes.Select(n => new Server()
                {
                    server      = n.server,
                    server_port = user.port,
                    method      = user.method,
                    password    = user.passwd,
                    timeout     = 10,
                    auth        = false
                }).ToList();
                config.enabled         = true;
                config.autoCheckUpdate = false;
                config.index           = new Random().Next(1, config.configs.Count);
                Configuration.Save(config);

                ShadowsocksControllerExtension.SetUser(user);

                Close();
            }
            catch (Exception ex)
            {
                btnLogin.Text    = "登录";
                btnLogin.Enabled = true;

                MessageBox.Show($"出错了:{ex.Message}");
            }
        }
        public static void UpdateUser(string manager, PersonModel _fp)
        {
            using (DefaultClient _client = new DefaultClient())
            {
                _client.ClientCredential = CredentialCache.DefaultNetworkCredentials;
                _client.RefreshSchema();
                List <RmResource> _res = _client.Enumerate("/Person[ObjectID='" + _fp.ObjectID + "']").ToList();
                foreach (RmPerson _r in _res)
                {
                    RmResourceChanges changes = new RmResourceChanges(_r);
                    try
                    {
                        changes.BeginChanges();
                        if (string.IsNullOrWhiteSpace(manager))
                        {
                            RmAttributeName _attr = new RmAttributeName("Manager");
                            _r.Attributes.Remove(_attr);
                        }
                        else
                        {
                            _r.Manager = new RmReference(manager);
                        }

                        _client.Put(changes);
                        changes.AcceptChanges();
                    }
                    catch
                    {
                        changes.DiscardChanges();
                    }
                }
            }
        }
Beispiel #6
0
        public async Task CategoryDeleteOperationsTest()
        {
            var unauthorizedResponse = await DefaultClient.DeleteAsync($"api/Categories/{Guid.NewGuid()}");

            Assert.Equal(HttpStatusCode.Unauthorized, unauthorizedResponse.StatusCode);

            var notExistingResponse = await AuthorizedClient.DeleteAsync($"api/Categories/{Guid.NewGuid()}");

            Assert.Equal(HttpStatusCode.NoContent, notExistingResponse.StatusCode);

            var badResponse = await AuthorizedClient.DeleteAsync($"api/Categories/{Guid.Empty}");

            Assert.Equal(HttpStatusCode.BadRequest, badResponse.StatusCode);

            var category = new Models.Category()
            {
                Name = "IsDeletePossible"
            };

            category = await categoryRepository.Create(category);

            var response = await AuthorizedClient.DeleteAsync($"api/Categories/{category.Id}");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
Beispiel #7
0
        private IResponse RevokeBiz(string msg)
        {
            IResponse response = null;

            var     serverUrl = System.Configuration.ConfigurationManager.AppSettings["ServerUrl"].ToString();
            IClient client    = new DefaultClient(serverUrl, null, null);

            var dtoModel = Newtonsoft.Json.JsonConvert.DeserializeObject <UIMessageModel>(msg);

            switch (dtoModel.ActionType)
            {
            case ActionType.Sit:
            {
                var req = new Sdk.Request.SquareSitRequest()
                {
                    Biz_Content = Newtonsoft.Json.JsonConvert.SerializeObject(dtoModel.Data)
                };
                response = client.Execute(req);
            }
            break;

            case ActionType.Ready:
                break;

            case ActionType.Move:
                break;

            default:
                break;
            }

            return(response);
        }
Beispiel #8
0
        public void ProcessAsync_WhenValidEmail_ExpectValidResult([NotNull] string email)
        {
            // Arrange
            var mockConfig = new Mock <IConfiguration <KeyAuthentication> >();

            mockConfig.Setup(r => r.Get).Returns(() => new KeyAuthentication {
                LicenseKey = LicenseKey
            });

            var defaultClient = new DefaultClient(this.LoggerFactory, mockConfig.Object);

            // Act
            var stopwatch = Stopwatch.StartNew();
            var result    = defaultClient.ProcessAsync(new VerificationRequest {
                Email = email
            }, CancellationToken.None).Result;

            stopwatch.Stop();

            // Assert
            Assert.True(result.Result != null);
            this.logger.LogInformation("Result:{0}", JsonConvert.SerializeObject(result));
            this.OutHelper.WriteLine("Result:{0}", JsonConvert.SerializeObject(result));
            this.OutHelper.WriteLine(string.Empty);
            this.OutHelper.WriteLine(string.Empty);
            this.WriteTimeElapsed(stopwatch.ElapsedMilliseconds);
            this.OutHelper.WriteLine(string.Empty);
            this.OutHelper.WriteLine(string.Empty);
        }
Beispiel #9
0
        public async Task IsItPossibleToCreateNewUser()
        {
            var user = new Eager.User()
            {
                Username = "******",
                Password = "******",
                Email    = "*****@*****.**"
            };
            var content = new StringContent(JsonConvert.SerializeObject(user), Encoding.UTF8, "application/json");

            var userBadData = new Eager.User()
            {
                Username = "",
                Password = "******",
                Email    = "post@user"
            };
            var contentBadData = new StringContent(JsonConvert.SerializeObject(userBadData), Encoding.UTF8, "application/json");

            var unauthResponse = await DefaultClient.PostAsync("api/Users", content);

            Assert.Equal(HttpStatusCode.Unauthorized, unauthResponse.StatusCode);

            var badResponse = await AuthorizedClient.PostAsync("api/Users", contentBadData);

            Assert.Equal(HttpStatusCode.BadRequest, badResponse.StatusCode);

            var response = await AuthorizedClient.PostAsync("api/Users", content);

            var responseContent = await response.Content.ReadAsStringAsync();

            Assert.Equal(HttpStatusCode.Created, response.StatusCode);
        }
Beispiel #10
0
        public void DeleteTest_WithoutCrumb()
        {
            var client = DefaultClient.Create();

            SetupDeleteJob(client);

            client.Jobs.Delete("Delete Job");
        }
Beispiel #11
0
        public async Task DeleteTest_WithoutCrumb_Async()
        {
            var client = DefaultClient.Create();

            await SetupDeleteJobAsync(client);

            await client.Jobs.DeleteAsync("Delete Job");
        }
Beispiel #12
0
 public void SetDefaultController()
 {
     if (DefaultClient.OptimizeForServer())
     {
         return;
     }
     animator.runtimeAnimatorController = defaultController;
 }
Beispiel #13
0
        public async Task GetTokenShouldSuccess()
        {
            IWeChatClient client  = new DefaultClient(ServerUrl, AppId, AppSecret);
            var           request = new GetAccessTokenReqeust();
            var           result  = await client.GetAccessToken(request);

            Assert.NotNull(result.AccessToken);
            Assert.True(result.ExpiresIn > 0);
        }
Beispiel #14
0
            public void SetAnimation(AnimationName name)
            {
                if (DefaultClient.OptimizeForServer())
                {
                    return;
                }

                SetAnimation(name, AnimationLayer.Base);
            }
Beispiel #15
0
        public async Task AuthenticationShouldFailWithoutSaltFirst()
        {
            var jsonString = JsonConvert.SerializeObject("test");
            var content    = new StringContent(jsonString, Encoding.UTF8, "application/json");

            var authResponse = await DefaultClient.PostAsync("api/auth/Admin", content);

            Assert.False(authResponse.IsSuccessStatusCode);
        }
Beispiel #16
0
        public async Task DeleteTest_WithCrumb()
        {
            var client = DefaultClient.Create();

            await client.UpdateSecurityCrumbAsync();

            await SetupDeleteJob(client);

            await client.Jobs.DeleteAsync("Delete Job");
        }
Beispiel #17
0
        public void GetTokenSuccess()
        {
            var c   = new DefaultClient();
            var ret = c.Execute(new TokenRequest()
            {
                Email  = "*****@*****.**",
                Passwd = "wobuzd123"
            });

            Console.WriteLine(token = ret.token);
        }
Beispiel #18
0
            void Awake()
            {
                if (DefaultClient.OptimizeForServer())
                {
                    Destroy(GetComponentInChildren <Animator>());
                    return;
                }

                animator          = GetComponentInChildren <Animator>() as Animator;
                defaultController = animator.runtimeAnimatorController;
            }
        /// <summary>
        /// 执行
        /// </summary>
        public override void Execute()
        {
            var ServiceTime = DateTime.Now;

            while (true)
            {
                try
                {
                    //从预约订单推送消息数据链表左边起获取一条数据
                    AssignOrderPushContent content = RedisDB.ListLeftPop <AssignOrderPushContent>(LegworkConfig.RedisKey.LegworkUserAddOrder);

                    //不存在,则休眠1秒钟,避免CPU空转
                    if (null == content)
                    {
                        Thread.Sleep(100);
                        continue;
                    }

                    //获取预约订单推送接口配置信息
                    var apiConfig = PushApiConfigManager.GetApiConfig(SysEnums.PushType.LegworkUserAddOrder);

                    if (null == apiConfig)
                    {
                        continue;
                    }

                    //将订单数据转换成为字典以便参与接口加密
                    var dic = content.ToMap();

                    if (apiConfig.Method == "get")
                    {
                        DefaultClient.DoGet(apiConfig.Url, dic, PushApiConfigManager.Config.ModuleID, PushApiConfigManager.Config.Secret);
                    }
                    else if (apiConfig.Method == "post")
                    {
                        DefaultClient.DoPost(apiConfig.Url, dic, PushApiConfigManager.Config.ModuleID, PushApiConfigManager.Config.Secret);
                        ExceptionLoger loger = new ExceptionLoger(@"/logs/Sccess" + DateTime.Now.ToString("yyyyMMdd") + ".txt");
                        loger.Success("用户下单推送给工作端推送时", "推送结果:订单编号为“" + content.OrderCode + "”");
                    }
                }
                catch (Exception ex)
                {
                    if (ServiceTime.AddHours(1) >= DateTime.Now)
                    {
                        ServiceTime = DateTime.Now;
                        //异常处理
                        ExceptionLoger loger = new ExceptionLoger(@"/logs/Error" + DateTime.Now.ToString("yyyyMMdd") + ".txt");
                        loger.Write("用户下单,用户下单推送给工作端", ex);
                    }
                    Thread.Sleep(100);
                    continue;
                }
            }
        }
        public static string GetToken()
        {
            var assumeRoleRequest = new AssumeRoleRequest();

            assumeRoleRequest.RoleArn         = RoleArn;
            assumeRoleRequest.RoleSessionName = "robert_test";

            var assumeRoleResponse = DefaultClient.GetAcsResponse(assumeRoleRequest);

            return(assumeRoleResponse.Credentials.SecurityToken);
        }
Beispiel #21
0
        public async Task CategoryPutOperationsTest()
        {
            var category = new Models.Category()
            {
                Name = "PutTest"
            };

            category = await categoryRepository.Create(category);

            Models.Eager.Category[] categroyUpdateModel =
            {
                new Models.Eager.Category()
                {
                    Id   = category.Id,
                    Name = "updateContent"
                }
            };
            var updateContent = new StringContent(JsonConvert.SerializeObject(categroyUpdateModel), Encoding.UTF8, "application/json");

            Models.Eager.Category[] categoryWithEmptyId =
            {
                new Models.Eager.Category()
                {
                    Name = "contentNoId"
                }
            };
            var contentNoId = new StringContent(JsonConvert.SerializeObject(categoryWithEmptyId), Encoding.UTF8, "application/json");

            Models.Eager.Category[] categoryWithWrongId =
            {
                new Models.Eager.Category()
                {
                    Id   = Guid.NewGuid(),
                    Name = "contentWrongId"
                }
            };
            var contentWrongId = new StringContent(JsonConvert.SerializeObject(categoryWithWrongId), Encoding.UTF8, "application/json");


            var unauthorizedResponse = await DefaultClient.PutAsync($"api/Categories", updateContent);

            Assert.Equal(HttpStatusCode.Unauthorized, unauthorizedResponse.StatusCode);

            // When no Id create new record
            var createResponse = await AuthorizedClient.PutAsync($"api/Categories", contentNoId);

            Assert.Equal(HttpStatusCode.OK, createResponse.StatusCode);

            // When Id is invalid (e.g not found in db)
            var badRequestResponse = await AuthorizedClient.PutAsync($"api/Categories", contentWrongId);

            Assert.Equal(HttpStatusCode.BadRequest, badRequestResponse.StatusCode);
        }
Beispiel #22
0
        public async Task CreatingCategoryWithoutAuthorization()
        {
            var category = new Models.Eager.Category()
            {
                Name = "No auth test name"
            };
            var jsonString = JsonConvert.SerializeObject(category);
            var content    = new StringContent(jsonString, Encoding.UTF8, "application/json");

            var response = await DefaultClient.PostAsync("api/Categories", content);

            Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
        }
Beispiel #23
0
        public async Task IsSaltGeneratingCorrectly(string username, bool sucessfulResponse)
        {
            var response = await DefaultClient.GetAsync($"api/auth/{username}");

            string responseBody = await response.Content.ReadAsStringAsync();

            Assert.Equal(sucessfulResponse, response.IsSuccessStatusCode);

            if (sucessfulResponse)
            {
                Assert.Equal(90, responseBody.Length);
            }
        }
Beispiel #24
0
        public async Task GetAllCategories()
        {
            // Add sample category
            var category = new Models.Category()
            {
                Name = "Test"
            };
            await categoryRepository.Create(category);

            // Response should return
            var getAllResponse = await DefaultClient.GetAsync("api/Categories");

            Assert.Equal(HttpStatusCode.OK, getAllResponse.StatusCode);
        }
Beispiel #25
0
        public void Dispose()
        {
            if (_isDisposed)
            {
                throw new ObjectDisposedException("FimClient");
            }
            _isDisposed = true;

            _log.Debug("Disposing FIM client by user {0}", System.Threading.Thread.CurrentPrincipal.Identity.Name);

            _defaultClient.Dispose();
            _defaultClient = null;
            _pagedQueriesClient.Close();
            _pagedQueriesClient = null;
        }
Beispiel #26
0
        public void ListAllJobs()
        {
            var client = DefaultClient.Create();

            var jenkins = client.Get();

            foreach (var job in jenkins.Jobs)
            {
                output.WriteLine($"{job.Name} [{job.Class}]");

                var jobBase = client.Jobs.Get <JenkinsJobBase>(job.Name);
                output.WriteLine($"  {jobBase.FullDisplayName}");
                output.WriteLine($"  {jobBase.Url}");
            }
        }
        public async Task MessageTemplateSendShouldSuccess()
        {
            IWeChatClient client = new DefaultClient(ServerUrl, AppId, AppSecret);

            var requestToken = new GetAccessTokenReqeust();
            var resultToken  = await client.GetAccessToken(requestToken);

            var token = resultToken.AccessToken;

            var request = new MessageTemplateSendRequest <Template>();
            var model   = new MessageTemplateSendModel <Template>();

            model.ToUser     = OpenID;
            model.TemplateId = TemplateId;
            model.Template   = new Template
            {
                Head = new TemplateContent
                {
                    Value = "恭喜你购买成功!",
                    Color = "#173177"
                },
                ProductName = new TemplateContent
                {
                    Value = "巧克力",
                    Color = "#173177"
                },
                TotalPrice = new TemplateContent
                {
                    Value = "39.8元",
                    Color = "#173177"
                },
                PayTime = new TemplateContent
                {
                    Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Color = "#173177"
                },
                Remark = new TemplateContent
                {
                    Value = "欢迎再次购买!",
                    Color = "#173177"
                }
            };

            request.Parameters = model;
            var result = await client.Execute(request, token);

            Assert.True(result.ErrorCode == 0);
        }
Beispiel #28
0
        public async Task ListAllJobsAsync()
        {
            var client = DefaultClient.Create();

            var jenkins = await client.GetAsync();

            foreach (var job in jenkins.Jobs)
            {
                TestContext.Out.WriteLine($"{job.Name} [{job.Class}]");

                var jobBase = await client.Jobs.GetAsync <JenkinsJobBase>(job.Name);

                TestContext.Out.WriteLine($"  {jobBase.FullDisplayName}");
                TestContext.Out.WriteLine($"  {jobBase.Url}");
            }
        }
        public IActionResult Index()
        {
            var dic = new Dictionary <string, string>();

            dic.Add("ID", "天道新创");
            //Users user = new Users();
            //user.UserId = 1;
            //user.Name = "Test";
            //user.Password = Strings.PasswordEncrypt("admin");
            //dic = DicMapper.ToMap(user);
            //var txt = DefaultClient.DoPost("http://localhost:36177/api/values", dic, "A0001", "8C44B1F5-CC25-46C9-AA1E-BB2BB0123E66").Result;
            var txt = DefaultClient.DoGet("http://localhost:36177/api/values", dic, "A0001", "8C44B1F5-CC25-46C9-AA1E-BB2BB0123E66").Result;

            //var txt = DefaultClient.DoGet("http://localhost:2025/v1/admin/1", dic, "A0001", "8C44B1F5-CC25-46C9-AA1E-BB2BB0123E66").Result;
            ViewBag.Txt = txt;
            return(View());
        }
        public MainStatusResponseType ProcessAsyncTests(string emailAddress)
        {
            // arrange
            var mockConfiguration = new Mock<IConfiguration<KeyAuthentication>>();

            mockConfiguration.Setup(r => r.Get).Returns(() => new KeyAuthentication { LicenseKey = MyLicenseKey });

            var defaultClient = new DefaultClient(mockConfiguration.Object);

            // act
            var verificationResponse =
                defaultClient.ProcessAsync(new VerificationRequest { Email = emailAddress }, CancellationToken.None)
                    .Result;

            // assert
            return verificationResponse.Result;
        }
Beispiel #31
0
        static void Demo()
        {
            var     serverUrl = "http://localhost:28310/";
            IClient client    = new DefaultClient(serverUrl, null, null);

            var sitReq = new SquareSitRequest()
            {
                Biz_Content = Newtonsoft.Json.JsonConvert.SerializeObject(new Dictionary <string, string>()
                {
                    { "table_id", "1" }
                })
            };
            var sitRes = client.Execute(sitReq, "1");

            var readyReq = new SquareReadyRequest();
            var readyRes = client.Execute(readyReq);

            var moveReq1 = new ChessMoveRequest()
            {
                Biz_Content = Newtonsoft.Json.JsonConvert.SerializeObject(new Dictionary <string, string>()
                {
                    { "chesstype", ChessType.Cannons.ToString().ToLower() },
                    { "index", "0" },
                    { "relativex", "4" },
                    { "relativey", "2" },
                })
            };
            var moveRes1 = client.Execute(moveReq1);

            //stories
            //tom and jerry sit at board 1
            //tom ready
            //jerry ready
            //board start


            //var red = new Square("tom");
            //var black = new Square("jerry");
            //var table = new Table();

            //var ing = new Chessing("tom vs jerry at 2018.6.20 17:40");

            //table.StartChessing(ing);

            //ing.Start(true);//at red
        }
        public void ProcessAsync_WhenTestList1_ExpectLoggingAndTimingOutput()
        {
            // arrange
            var mockConfiguration = new Mock<IConfiguration<KeyAuthentication>>();

            mockConfiguration.Setup(r => r.Get).Returns(() => new KeyAuthentication { LicenseKey = MyLicenseKey });

            var defaultClient = new DefaultClient(mockConfiguration.Object);

            var defaultService = new DefaultService(defaultClient);
            defaultService.ProgressChanged += (o, args) => Console.WriteLine(JsonConvert.SerializeObject(args));

            // act
            var stopwatch = Stopwatch.StartNew();
            var verificationResponses = defaultService.ProcessAsync(new VerificationRequest { Emails = TestList1 }, CancellationToken.None).Result;
            stopwatch.Stop();

            // assert
            Console.WriteLine("# emails checked: {0}", verificationResponses.Results.Count);
            Console.WriteLine(JsonConvert.SerializeObject(verificationResponses));
            WriteTimeElapsed(stopwatch.ElapsedMilliseconds);
        }
        /// <summary>
        /// 获取SSO 退出URL
        /// </summary>
        /// <param name="context">http请求上下文</param>
        /// <returns>SSO 退出URL</returns>
        private string GetExitUrl(HttpContext context)
        {
            DefaultClient ssoClient = new DefaultClient();

            return ssoClient.GetExitUrl();
        }
Beispiel #34
0
        /// <summary>
        /// 登陆
        /// </summary>
        /// <returns>结果</returns>
        public ActionResult Index()
        {
            ClearCK1Cookie();

            if (SSOClientConfigHelper.SSOType == 0)
            {
                return this.SSOUrl();
            }
            else if (SSOClientConfigHelper.SSOType == 1)
            {
                ////有域名共享cookie方式,主要适用于大平台(自己域名),同时生成主域名凭证
                return this.SSOCookie();
            }
            else if (SSOClientConfigHelper.SSOType == 2)
            {
                ////兼容方式:先1后0(过渡期间使用)
                if (this.Request.Cookies["Ticket"] != null)
                {
                    // 新单点登陆
                    string uid = string.Empty;
                    try
                    {
                        DefaultClient ssoclient = new DefaultClient();
                        string msg = string.Empty;
                        uid = ssoclient.GetUserTicket();
                        if (!ssoclient.CheckLogin(out msg))
                        {
                            this.TempData["ResMsg"] = "获取账号信息失败";
                            return this.View("ErrorPage");
                        }
                        else
                        {
                            // 权限验证
                            uid = ssoclient.GetUserTicket();

                            TrackIdManager.GetInstance(uid);

                            if (!string.IsNullOrEmpty(uid))
                            {
                                UserLoginServiceHelper.UserLoginServiceHelper userHelper =
                                    new UserLoginServiceHelper.UserLoginServiceHelper();
                                MStaffInfo staffInfo = userHelper.GetStaffInfoModel(uid);
                                ////登录用户不为平台时限制ip
                                int staffType = staffInfo.StaffType;
                                if (staffType != 1)
                                {
                                    if (!userHelper.LimitIpLogin(staffInfo.Department_id, this.GetIpAddr()))
                                    {
                                        return this.Json("当前登录IP不在允许的登录IP范围内!", "text/html", JsonRequestBehavior.AllowGet);
                                    }
                                }

                                if (staffInfo.StaffType != 1)
                                {
                                    this.TempData["ResMsg"] = "当前账号无权限";
                                    return this.View("ErrorPage");
                                }

                                //// 登陆成功
                                FormsAuthentication.SetAuthCookie(staffInfo.Staff_id, false);

                                //// TODO 保存用户部门对象
                                this.Session["$sessionName$_UserInfo"] = staffInfo;

                                // 登录成功,创建本地票据
                                this.SetLocalTicket(staffInfo);

                                //// 页面跳转
                                if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request["RequestPage"]))
                                {
                                    return this.Redirect("~/" + HttpUtility.UrlDecode(System.Web.HttpContext.Current.Request["RequestPage"]));
                                }
                                else
                                {
                                    return this.Redirect("~/Home/Index");
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        // 单点登录失败吃掉异常
                        AppException appEx = new AppException(string.Empty, ex.Message, ex, null);
                        LogManager.Log.WriteException(appEx);
                    }
                }

                return this.SSOUrl();
            }

            return this.SSOUrl();
        }
Beispiel #35
0
 private void sendInvoiceButton_Click(object sender, EventArgs e)
 {
     INVOICMessage invoice = new INVOICMessage();
     invoice.Sender = invoiceSender.Text.ToUpper();
     invoice.Recipient = invoiceRecipient.Text.ToUpper();
     invoice.InvoiceNumber = invoiceNumber.Text.ToUpper();
     invoice.ItemDescription = invoiceItemDescription.Text.ToUpper();
     invoice.DueDate = invoiceDueDate.Value.ToString("yyMMdd");
     invoice.Reference = invoiceReference.Text.ToUpper();
     invoice.Amount = invoiceAmount.Text.ToUpper();
     invoice.Currency = invoiceCurrency.Text.ToUpper();
     INVOICMessageAdress adress = new INVOICMessageAdress();
     adress.Street = invoiceStreet.Text.ToUpper();
     adress.City = invoiceCity.Text.ToUpper();
     adress.Zipcode = invoiceZipcode.Text.ToUpper();
     adress.Country = invoiceCountry.Text.ToUpper();
     invoice.Adress = adress;
     DefaultClient proxy = new DefaultClient();
     proxy.ClientCredentials.UserName.UserName = "******";
     proxy.ClientCredentials.UserName.Password = "******";
     InvoiceResult result = proxy.Operation_1(invoice);
     MessageBox.Show(result.Result);
 }
Beispiel #36
0
 public void SetClient(DefaultClient client)
 {
     this.client = client;
     login = client.gameObject.AddComponent<Login>() as Login;
     login.SetLoginUi(loginUI);
 }
Beispiel #37
0
        /// <summary>
        /// 获取SSO URL
        /// </summary>
        /// <param name="context">http请求上下文</param>
        /// <returns>SSO URL</returns>
        public string GetSSOUrl(HttpContext context)
        {
            MStaffInfo staffInfo = HttpContext.Current.Session["$safeprojectname$_UserInfo"] as MStaffInfo;

            string strReturn = "{\"status\":false,\"url\":\"\",\"flg\":false,\"domainUrl\":\"\"}";

            if (staffInfo == null)
            {
                return strReturn;
            }

            if (SSOClientConfigHelper.SSOType == 0)
            {
                return strReturn;
            }

            DefaultClient client = new DefaultClient();
            strReturn = client.GetSSOUrl(staffInfo.Staff_id, staffInfo.Password);

            return strReturn;
        }
Beispiel #38
0
        /// <summary>
        /// 退出
        /// </summary>
        /// <returns>结果</returns>
        public ActionResult LoginOut()
        {
            FormsAuthentication.SignOut();

            ////单点登录退出
            try
            {
                if (SSOClientConfigHelper.SSOType != 0)
                {
                    DefaultClient ssoClient = new DefaultClient();
                    ssoClient.Logout();
                }
            }
            finally
            {
                Session.Clear();
                Session.Abandon();
                FormsAuthentication.SignOut();
            }

            ////return this.RedirectToAction("Index"); 
            return this.Redirect("Index?type=exit");
        }
Beispiel #39
0
 /// <summary>
 /// 清除单点登陆跨域请求标识
 /// </summary>
 private static void ClearCK1Cookie()
 {
     DefaultClient client = new DefaultClient();
     client.ClearCK1Cookie();
 }
 void Awake()
 {
     instance = this;
     startScene = Application.loadedLevelName;
     DontDestroyOnLoad(transform.gameObject);
 }
Beispiel #41
0
 /// <summary>
 /// 设置单点登录本地Ticket
 /// </summary>
 /// <param name="staff">用户</param>
 private void SetLocalTicket(MStaffInfo staff)
 {
     try
     {
         if (SSOClientConfigHelper.SSOType == 1 || SSOClientConfigHelper.SSOType == 2)
         {
             DefaultClient client = new DefaultClient();
             client.SaveLocalTicket(staff.Staff_id);
         }
     }
     catch (Exception ex)
     {
         AppException appEx = new AppException(string.Empty, "认证中心故障:" + ex.Message, ex, null);
         LogManager.Log.WriteException(appEx);
     }
 }