Example #1
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!IsLoggedIn)
     {
         SSOHelper.RedirectToSSOPage("Login.aspx", null);
     }
     else
     {
         if (!Page.Request.IsSecureConnection)
         {
             SSOHelper.RedirectToSecure();
         }
     }
 }
Example #2
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!IsLoggedIn)
     {
         SSOHelper.RedirectToSSOPage("Login.aspx", null);
     }
     else
     {
         if (!Page.Request.IsSecureConnection && String.IsNullOrEmpty(Request.QueryString["closePopUp"]))
         {
             SSOHelper.RedirectToSecure();
         }
     }
 }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsLoggedIn)
            {
                SSOHelper.RedirectToSecure();

                if (!Page.IsPostBack)
                {
                    //if (!String.IsNullOrEmpty(Request.QueryString["url"])) asi solo devuelve null ... Gustavo Saraceni
                    //string url = HttpContext.Current.Request.QueryString["url"];
                    //if (string.IsNullOrEmpty(url))
                    //    url = SSOHelper.Configuration["StartPage"] as string;

                    //btnVolver.OnClientClick = String.Format("window.location='{0}'", Request.QueryString["url" + "/sips"]);
                    RefreshUI();
                }
            }
            else
            {
                SSOHelper.RedirectToSSOPage("Login.aspx", Request.Url.ToString());
            }
        }
Example #4
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (IsLoggedIn)
            {
                // Logout
                SSOHelper.MembershipProvider.Logout(SSOHelper.CurrentIdentity.SessionId);
                // Clear cookie
                Response.Cookies.Add(new HttpCookie(SSOHelper.MembershipProvider.CookieName, null)
                {
                    Path = "/", Domain = SSOHelper.Configuration["Domain"].ToString(), Expires = DateTime.Now
                });
            }

            // Redirect
            if (Request.QueryString["relogin"] == "1")
            {
                SSOHelper.RedirectToSSOPage("Login.aspx", Request.QueryString["url"]);
            }
            else
            {
                SSOHelper.RedirectToURL();
            }
        }
Example #5
0
        private void Application_AuthenticateRequest(object sender, EventArgs e)
        {
            SSOHelper.Authenticate();

            if (!((SSOHelper.MembershipProvider.AllowAnonymousAccessToImages && IsImage()) || (SSOHelper.MembershipProvider.AllowAnonymousAccessToScripts && IsScript())))
            {
                SSOModule module = SSOModule.FindByURL(HttpContext.Current.Request.Url);
                if (module == null)
                {
                    if (SSOHelper.MembershipProvider.AlwaysAuthenticate && (SSOHelper.CurrentIdentity == null || SSOHelper.CurrentIdentity.State == SSOIdentitySessionState.Inexistent))
                    {
                        SSOHelper.RedirectToSSOPage("Login.aspx", HttpContext.Current.Request.Url.ToString());
                    }
                    else
                    {
                        if (SSOHelper.CurrentIdentity == null || SSOHelper.CurrentIdentity.State == SSOIdentitySessionState.Inexistent)
                        {
                            HttpContext.Current.User = null;
                        }
                        else
                        if (!IsWebMethod() || SSOHelper.MembershipProvider.UpdateTimeoutOnWebMethod)
                        {
                            SSOHelper.MembershipProvider.UpdateTimeout(SSOHelper.CurrentIdentity);
                        }
                    }
                }
                else
                {
                    // Check if it needs to authenticate
                    if (SSOHelper.MembershipProvider.AlwaysAuthenticate || module.IsProtected)
                    {
                        if (SSOHelper.CurrentIdentity == null)
                        {
                            SSOHelper.RedirectToSSOPage("Login.aspx", HttpContext.Current.Request.Url.ToString());
                        }
                        else
                        {
                            switch (SSOHelper.CurrentIdentity.State)
                            {
                            case SSOIdentitySessionState.Ok:
                                if (RequireAccess(module))
                                {
                                    // Access allowed --> Update timeout
                                    if (!IsWebMethod() || SSOHelper.MembershipProvider.UpdateTimeoutOnWebMethod)
                                    {
                                        SSOHelper.MembershipProvider.UpdateTimeout(SSOHelper.CurrentIdentity);
                                    }
                                }
                                else
                                {
                                    SSOHelper.RedirectToErrorPage(403, 0, null);
                                }
                                break;

                            case SSOIdentitySessionState.Locked:
                                SSOHelper.RedirectToSSOPage("LockSession.aspx", HttpContext.Current.Request.Url.ToString());
                                break;

                            case SSOIdentitySessionState.Inexistent:
                                SSOHelper.RedirectToSSOPage("Login.aspx?timeout=1", HttpContext.Current.Request.Url.ToString());
                                break;

                            case SSOIdentitySessionState.SecurityError:
                                SSOHelper.RedirectToErrorPage(403, 4, null);
                                break;
                            }
                        }
                    }
                    else
                    {
                        // Access allowed --> Update timeout
                        if (SSOHelper.CurrentIdentity != null && SSOHelper.CurrentIdentity.State == SSOIdentitySessionState.Ok && (!IsWebMethod() || SSOHelper.MembershipProvider.UpdateTimeoutOnWebMethod))
                        {
                            SSOHelper.MembershipProvider.UpdateTimeout(SSOHelper.CurrentIdentity);
                        }
                    }
                }
            }
        }
Example #6
0
 protected void btnRegresar_Click(object sender, EventArgs e)
 {
     SSOHelper.RedirectToSSOPage("Login.aspx", null);
 }