Example #1
0
        /// <summary>
        /// Written by Jonas
        /// Shows a page with the Fiscals that the logged in user have access to.
        /// </summary>
        public ActionResult Fiscals()
        {
            List <JToken> jTokenList = XenaLogic.CallXena(Session["access_token"].ToString(),
                                                          "User/XenaUserMembership?listOptions.showDeactivated=true&listOptions.forceNoPaging=true");

            return(View(XenaLogic.GetFiscalList(jTokenList)));
        }
Example #2
0
        public ActionResult Debug(string token)
        {
            Session["loggedIn"]     = true;
            Session["access_token"] = token;

            List <JToken> jTokenList = XenaLogic.CallXena(Session["access_token"].ToString(),
                                                          "User/XenaUserMembership?listOptions.showDeactivated=true&listOptions.forceNoPaging=true");

            Session["userName"] = jTokenList[0]["ResourceName"].ToString();

            return(RedirectToAction("Fiscals"));
        }
Example #3
0
        /// <summary>
        /// Written by Jonas
        /// When the "Login" Link is pushed on the page.
        /// Makes a QueryString with the parameters that is needed and a "Callback URL", then it sends it to Xena's Authorization Server.
        /// Then you get redirect to Xena's own Login Page, here you enter your data and press Login.
        /// </summary>
        public void Login()
        {
            NameValueCollection queryString = HttpUtility.ParseQueryString(string.Empty);

            queryString["response_type"] = "code id_token";
            queryString["client_id"]     = "2e64617f-dc5d-4983-ba27-7dcdb2ed5510.apps.xena.biz";
            queryString["redirect_uri"]  = "http://xenabudgetmanager.azurewebsites.net/";
            queryString["scope"]         = "openid testapi";
            queryString["nonce"]         = XenaLogic.RandomString(32);
            queryString["response_mode"] = "form_post";
            queryString["json"]          = "true";

            Response.Redirect("https://login.xena.biz/connect/authorize?" + queryString);
        }
Example #4
0
        public ActionResult Index(Xena xena)
        {
            xena.id_code      = Request["code"];
            xena.access_token = XenaLogic.AccessToken(xena);

            Session["access_token"] = xena.access_token;
            Session["loggedIn"]     = true;

            List <JToken> jTokenList = XenaLogic.CallXena(Session["access_token"].ToString(),
                                                          "User/XenaUserMembership?ForceNoPaging=true&Page=0&PageSize=10&ShowDeactivated=false");

            Session["userName"] = jTokenList[0]["ResourceName"].ToString();

            ViewBag.Token = xena.access_token; // Debug

            //return View(); // Debug
            return(RedirectToAction("Fiscals"));
        }