Ejemplo n.º 1
0
        public void Logoff(string token)
        {
            if (!string.IsNullOrEmpty(token))
            {
                var user = SSOAuthenticationService.DecryptToken(token);

                if (WebSecurity.UserExists(user))
                {
                    WebSecurity.Logout();
                }
            }
        }
Ejemplo n.º 2
0
        public void Login(string token)
        {
            const bool createPersistentCookie = false;

            if (!string.IsNullOrEmpty(token))
            {
                var user = SSOAuthenticationService.DecryptToken(token);

                if (WebSecurity.UserExists(user))
                {
                    SignInUser(createPersistentCookie, user);
                }
            }
        }
Ejemplo n.º 3
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"));
        }