예제 #1
0
        protected void verifyUserAuthentication()
        {
            SecurityAgent SecAgent = new SecurityAgent();

            if (Request.Cookies["__BlackChair-Authenticator"] != null && Request.Cookies["UserID"] != null)
            {
                if (Request.Cookies["__BlackChair-Authenticator"].Value == SecAgent.CurrentUserGroup)
                {
                    if (SecAgent.isValidUserName(Request.Cookies["UserID"].Value))
                    {
                    }
                    else
                    {
                        Response.Redirect("~/UnidentifiedUser.aspx");
                    }
                }
                else
                {
                    if (SecAgent.isBlackChairOpenToNewUsers())
                    {
                        SecAgent.newUserAdded();
                        Response.Cookies["__BlackChair-Authenticator"].Value   = SecAgent.CurrentUserGroup;
                        Response.Cookies["__BlackChair-Authenticator"].Expires = DateTime.Now.AddMonths(1);

                        Response.Cookies["UserID"].Value   = SecAgent.getNewUser();
                        Response.Cookies["UserID"].Expires = DateTime.Now.AddMonths(1);
                    }
                    else
                    {
                        Response.Redirect("~/UnidentifiedUser.aspx");
                    }
                }
            }
            else
            {
                if (SecAgent.isBlackChairOpenToNewUsers())
                {
                    SecAgent.newUserAdded();
                    Response.Cookies["__BlackChair-Authenticator"].Value   = SecAgent.CurrentUserGroup;
                    Response.Cookies["__BlackChair-Authenticator"].Expires = DateTime.Now.AddMonths(1);

                    Response.Cookies["UserID"].Value   = SecAgent.getNewUser();
                    Response.Cookies["UserID"].Expires = DateTime.Now.AddMonths(1);
                }
                else
                {
                    Response.Redirect("~/UnidentifiedUser.aspx");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!isSessionLoggedIn())
            {
                Response.Redirect("UnderTheHood_Authenticator.aspx");
            }

            SecurityAgent SecAgent = new SecurityAgent();

            if (!IsPostBack)
            {
                tb_PresentUserGroup.Text = SecAgent.CurrentUserGroup;
            }

            if (SecAgent.isBlackChairOpenToNewUsers())
            {
                Label2.Text = "Presently ALLOWING new browsers to register.";
            }
            else
            {
                Label2.Text = "Presently NOT ALLOWING new browsers to register.";
            }
        }