Пример #1
0
        private void SignInUser(bool createPersistentCookie, string user)
        {
            if (WebSecurity.UserExists(user))
            {
                int timeout = createPersistentCookie ? 43200 : 30;

                var cookie = SSOAuthenticationService.CreateFormsAuthenticationCookie(user, timeout, createPersistentCookie);

                HttpContext.Response.Cookies.Add(cookie);
            }
        }
Пример #2
0
        public ActionResult LoginWithToken(string token, bool createPersistentCookie)
        {
            var user = SSOAuthenticationService.DecryptToken(token);

            if (WebSecurity.UserExists(user))
            {
                int timeout = createPersistentCookie ? 43200 : 30;

                var cookie = SSOAuthenticationService.CreateFormsAuthenticationCookie(user, timeout, createPersistentCookie);

                HttpContext.Response.SetCookie(cookie);
            }

            return(RedirectToAction("Index", "Home"));
        }