Пример #1
0
        public ActionResult AuthVerify(string username, string password, string rpxId)
        {
            RpxViewData viewData = new RpxViewData();

            viewData.RpxIndentifier = rpxId;

            bool isApproved = false;

            if (SecurityManager.ValidateUser(username, password, out isApproved))
            {
                if (!isApproved)
                {
                    return(RedirectToAction("Confirm", "Security"));
                }
                else
                {
                    var rpx = new RPXService(WebUtils.GetRpxSettings());
                    rpx.MapLocalKey(viewData.RpxIndentifier, username);
                    SecurityManager.SignIn(username, true);
                    RedirectToAction("Index", "Home");
                }
            }

            return(View(viewData));
        }
Пример #2
0
        public ActionResult AuthVerify()
        {
            RpxViewData viewData = new RpxViewData();
            string      token    = this.Request.Params["token"];

            if (!String.IsNullOrEmpty(token))
            {
                var rpx = new RPXService(WebUtils.GetRpxSettings());

                var auth = rpx.GetAuthenticationDetails(token, true);
                if (auth != null)
                {
                    viewData.RpxIndentifier = auth.Identifier;
                    if (!String.IsNullOrEmpty(auth.LocalKey))
                    {
                        // Verify against DB...
                        User user = SecurityManager.GetUser(auth.LocalKey);
                        if (user != null)
                        {
                            //Game.SetAuthCookie(auth.LocalKey, true);
                            SecurityManager.SignIn(auth.LocalKey, true);
                            return(Redirect("/"));
                        }
                        else
                        {
                            return(Redirect("/Login"));
                        }
                    }
                    else
                    {
                        // Requires Mapping.
                        // Do Nothing...
                    }
                }
                else
                {
                    // Auth Failed.
                    return(Redirect("/Login"));
                }
            }
            else
            {
                return(Redirect("/Login"));
            }

            return(View(viewData));
        }
 public void TestSetup()
 {
     mockApiWrapper = MockRepository.GenerateMock<IRPXApiWrapper>();
     rpxService = new RPXService(mockApiWrapper);
 }