示例#1
0
        // GET: Security
        public ActionResult Logout()
        {
            NextGenCMS.APIHelper.classes.APIHelper apiCaller = new NextGenCMS.APIHelper.classes.APIHelper();
            var loginResponse = (LoginResponse)Session["SessionContext"];

            apiCaller.Delete(ConfigurationManager.AppSettings["API:URL"] + "authentication/logout/" + loginResponse.Ticket);
            Session.Abandon();
            return(new RedirectResult(BaseURL));
        }
示例#2
0
        public ActionResult Authenticate(string username, string password, string tenant)
        {
            if (!string.IsNullOrEmpty(tenant))
            {
                username = username + "@" + tenant.Trim();
            }
            NextGenCMS.APIHelper.classes.APIHelper apiCaller = new NextGenCMS.APIHelper.classes.APIHelper();
            LoginModel _loginModel = new LoginModel
            {
                password = password,
                username = username
            };
            string        response = apiCaller.Post(ConfigurationManager.AppSettings["API:URL"] + "authentication/login", JsonConvert.SerializeObject(_loginModel));
            LoginResponse result   = JsonConvert.DeserializeObject <LoginResponse>(response);

            Session["SessionContext"] = result;
            Session["tenant"]         = tenant;
            return(new RedirectResult(BaseURL));
        }