Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["method"].ToString() == "logout")
         {
             sm.SessionLogout();
             sm.SessionDestroy();
             Response.Redirect(Root.Domain + "/search");
         }
         else if (Request.QueryString["method"].ToString() == "login" && sm.Session().PersonID > 0)
         {
             if (Request.QueryString["redirectto"] == null && Request.QueryString["edit"] == "true")
             {
                 if (Request.QueryString["editparams"] == null)
                 {
                     Response.Redirect(Root.Domain + "/edit/" + sm.Session().NodeID);
                 }
                 else
                 {
                     Response.Redirect(Root.Domain + "/edit/default.aspx?subject=" + sm.Session().NodeID + "&" + Request.QueryString["editparams"]);
                 }
             }
             else
             {
                 Response.Redirect(Request.QueryString["redirectto"].ToString());
             }
         }
     }
 }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            sm = new Framework.Utilities.SessionManagement();

            if (sm.Session().UserID < 0 || sm.Session().UserID == 0)
            {
                Response.Redirect(Framework.Utilities.Root.Domain);
            }

            masterpage = (Framework.Template)base.Master;

            LoadPresentationXML();
        }
Exemplo n.º 3
0
 private void RedirectAuthenticatedUser()
 {
     if (Request.QueryString["redirectto"] == null && Request.QueryString["edit"] == "true")
     {
         Response.Redirect(Root.Domain + "/edit/" + sm.Session().NodeID);
     }
     else if (Request.QueryString["redirectto"] != null)
     {
         if ("mypage".Equals(Request.QueryString["redirectto"].ToLower()))
         {
             Response.Redirect(Root.Domain + "/profile/" + sm.Session().NodeID);
         }
         else if ("myproxies".Equals(Request.QueryString["redirectto"].ToLower()))
         {
             Response.Redirect(Root.Domain + "/proxy/default.aspx?subject=" + sm.Session().NodeID);
         }
         else
         {
             Response.Redirect(Request.QueryString["redirectto"].ToString());
         }
     }
     Response.Redirect(Root.Domain);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public bool LogIn(string username, string password)
        {
            bool rtn = false;
            try
            {
                Framework.Utilities.SessionManagement sessionmanagement = new Framework.Utilities.SessionManagement();
                User user = new User();

                Framework.Utilities.Session session = sessionmanagement.Session();
                user.UserName = username;

                //ZAP - need to do an MD5 Hash on the password
                user.Password = password;

                Login.Utilities.DataIO dataio = new Login.Utilities.DataIO();
                dataio.UserLogin(ref user, ref session);

                if (user.Roles != null)
                {
                    rtn = true;
                }

                this.SaveUser(user);

            }
            catch (Exception ex)
            {
                //ZAP- need an error log.
                ex = ex;
                rtn = false;
            }

            //ZAP-  need to cross this bridge soon
            //Find out if they have a profile
            //If they have a profile Get the users proxies

            return rtn;
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["method"].ToString() == "logout")
                {
                    sm.SessionLogout();
                    sm.SessionDestroy();
                    Response.Redirect(Request.QueryString["redirectto"].ToString());
                }
                else if (Request.QueryString["method"].ToString() == "shibboleth")
                {
                    // added by Eric
                    // If they specify an Idp, then check that they logged in from the configured IDP
                    bool authenticated = false;
                    if (ConfigurationManager.AppSettings["Shibboleth.ShibIdentityProvider"] == null ||
                        ConfigurationManager.AppSettings["Shibboleth.ShibIdentityProvider"].ToString().Equals(Request.Headers.Get("ShibIdentityProvider").ToString(), StringComparison.InvariantCultureIgnoreCase))
                    {
                        String userName = Request.Headers.Get(ConfigurationManager.AppSettings["Shibboleth.UserNameHeader"].ToString()); //"025693078";
                        if (userName != null && userName.Trim().Length > 0)
                        {
                            Profiles.Login.Utilities.DataIO data = new Profiles.Login.Utilities.DataIO();
                            Profiles.Login.Utilities.User   user = new Profiles.Login.Utilities.User();

                            user.UserName = userName;
                            if (data.UserLoginExternal(ref user))
                            {
                                authenticated = true;
                                RedirectAuthenticatedUser();
                            }
                        }
                    }
                    if (!authenticated)
                    {
                        // try and just put their name in the session.
                        sm.Session().ShortDisplayName = Request.Headers.Get("ShibdisplayName");
                        RedirectAuthenticatedUser();
                    }
                }
                else if (Request.QueryString["method"].ToString() == "login")
                {
                    // see if they already have a login session, if so don't send them to shibboleth
                    Profiles.Framework.Utilities.SessionManagement sm = new Profiles.Framework.Utilities.SessionManagement();
                    String viewerId = sm.Session().PersonURI;
                    if (viewerId != null && viewerId.Trim().Length > 0)
                    {
                        RedirectAuthenticatedUser();
                    }
                    else
                    {
                        string redirect = Root.Domain + "/login/default.aspx?method=shibboleth";
                        if (Request.QueryString["redirectto"] == null && Request.QueryString["edit"] == "true")
                        {
                            redirect += "&edit=true";
                        }
                        else
                        {
                            redirect += "&redirectto=" + Request.QueryString["redirectto"].ToString();
                        }

                        Response.Redirect(ConfigurationManager.AppSettings["Shibboleth.LoginURL"].ToString().Trim() +
                                          HttpUtility.UrlEncode(redirect));
                    }
                }
            }
        }