private void application_BeginRequest(object sender, EventArgs e)
        {
            HttpApplication application = (HttpApplication)sender;

            ctx = application.Context;
            if (ctx.Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                string wresult = ctx.Request.Form["wresult"];
                if (!string.IsNullOrEmpty(wresult))
                {
                    ResultObject ro = Utility.GetValuesFromWResult(wresult);
                    if (!string.IsNullOrEmpty(ro.TenantId))
                    {
                        if (DatabaseIssuerNameRegistry.TryAddTenant(ro.TenantId, ro.TenantId))
                        {
                            ctx.Response.Redirect("/default.aspx?ISubscriptionToken=" + ro.AccessToken);
                        }
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }
        }
示例#2
0
        public ActionResult SignUpCallback()
        {
            string tenantId    = Request.QueryString["TenantId"];
            string signupToken = Request.QueryString["signupToken"];

            if (DatabaseIssuerNameRegistry.ContainsTenant(tenantId))
            {
                // The tenant is already registered, show the completion page.
                return(View());
            }

            string consent = Request.QueryString["Consent"];

            if (!String.IsNullOrEmpty(tenantId) &&
                String.Equals(consent, "Granted", StringComparison.OrdinalIgnoreCase))
            {
                // Register the tenant when the permission is granted.
                if (DatabaseIssuerNameRegistry.TryAddTenant(tenantId, signupToken))
                {
                    return(View());
                }
            }

            return(View("Error"));
        }