コード例 #1
0
        public ActionResult SsoResult(string samlResponse, string RelayState)
        {
            LogManager.GetLogger(this.GetType()).Debug("Entering SsoResult... RelayState=" + RelayState);
            string lillyID = GetUserIdFromSaml(samlResponse, RelayState);

            LogManager.GetLogger(this.GetType()).Debug("SsoResult - lillyID : " + lillyID);

            // TODO: 应该在生产服务器上完成,但现在DMZ不能主动连外网,只能搞到外网的测试服务器上测试了。
            //ViewBag.samlResponse = samlResponse;
            //ViewBag.RelayState = RelayState;
            //return View();
            if (string.IsNullOrEmpty(RelayState))
            {
                var Token = AccessTokenContainer.TryGetToken(CorpId, CorpSecret);

                LogManager.GetLogger(this.GetType()).Debug("Starting ConcernApi.TwoVerification... Token=" + Token + " - lillyid=" + lillyID);
                var result = ConcernApi.TwoVerification(Token, lillyID);

                return(Redirect("/subscribed.html"));
            }
            else
            {
                // 如果是其他网站的请求,直接返回给对方网站
                ViewBag.samlResponse = samlResponse;
                ViewBag.RelayState   = RelayState;
                return(View());
            }
        }
コード例 #2
0
        /// <summary>
        /// 微信认证成功
        /// </summary>
        /// <returns></returns>
        public ActionResult Subscribed(string WeChatUserID)
        {
            var objConfig = WeChatCommonService.GetWeChatConfigByID(1);
            var token     = AccessTokenContainer.TryGetToken(objConfig.WeixinCorpId, objConfig.WeixinCorpSecret);

            LogManager.GetLogger(this.GetType()).Debug("Starting ConcernApi.TwoVerification... Token=" + token + " - WeChatUserID=" + WeChatUserID);
            var result = ConcernApi.TwoVerification(token, WeChatUserID);

            return(Redirect("/subscribed.html"));
        }
コード例 #3
0
        public ActionResult Agree()
        {
            if (string.IsNullOrEmpty(ViewBag.WeChatUserID))
            {
                return(Redirect("/notauthed.html"));
            }
            var config = WeChatCommonService.GetWeChatConfigByID(AppId);
            var Token  = AccessTokenContainer.TryGetToken(config.WeixinCorpId, config.WeixinCorpSecret);

            LogManager.GetLogger(this.GetType()).Debug("Starting ConcernApi.TwoVerification... Token=" + Token + " - WeChatUserID=" + ViewBag.WeChatUserID);
            var result = ConcernApi.TwoVerification(Token, ViewBag.WeChatUserID);

            return(Redirect("~/subscribed.html"));
        }
コード例 #4
0
        public ActionResult Agree()
        {
            if (string.IsNullOrEmpty(ViewBag.LillyId))
            {
                return(Redirect("/notauthed.html"));
            }

            var Token = AccessTokenContainer.TryGetToken(CorpId, CorpSecret);

            LogManager.GetLogger(this.GetType()).Debug("Starting ConcernApi.TwoVerification... Token=" + Token + " - lillyid=" + ViewBag.LillyId);
            var result = ConcernApi.TwoVerification(Token, ViewBag.LillyId);

            return(Redirect("~/subscribed.html"));
        }