Beispiel #1
0
        public void CheckRequestTestRegEx()
        {
            request.Cookies.Add(CookieTools.MakeCookie(CookieTools.HobbesCookieName, "testValue"));
            HttpContext testContext = new HttpContext(request, response);

            confidence = endpointUUT.CheckRequest(testContext, confidence);
            Assert.IsTrue(confidence.SimpleValue == 100);
        }
Beispiel #2
0
        public void CheckRequestTestWhitelist()
        {
            request.Cookies.Add(CookieTools.MakeCookie(CookieTools.HobbesCookieName, "testValue" + "ehr.ajax"));
            request = new HttpRequest("", "http://localhost/hobbes/ehr.ajax", "");
            HttpContext testContext = new HttpContext(request, response);


            confidence = endpointUUT.CheckRequest(testContext, confidence);
            Assert.IsTrue(confidence.SimpleValue == 100);
        }
Beispiel #3
0
        public void CheckRequestTest()
        {
            request.Cookies.Add(CookieTools.MakeCookie(CookieTools.HobbesCookieName, "testValue"));
            HttpContext testContext = new HttpContext(request, response);

            IContextChecker uot      = new ircda.hobbes.CookieContext();
            SSOConfidence   conf     = new SSOConfidence();
            SSOConfidence   testconf = uot.CheckRequest(testContext, conf);

            Assert.IsNotNull(testconf);
            Assert.AreEqual(testconf.SimpleValue, 0, "Problem: Confidence is wrong,");
        }
Beispiel #4
0
        public void IsInRoleTest()
        {
            SSOConfidence conf = new SSOConfidence();

            System.Web.HttpCookie testCookie = CookieTools.MakeCookie("TestCookie", "TestValue");
            string tte = CookieTools.NewExpiresTime(1).ToString();

            testCookie = CookieTools.AddTo(testCookie, CookieTools.SessionExpires, tte);
            testCookie = CookieTools.AddTo(testCookie, CookieTools.Roles, "NO_ACCESS");
            UserStatus uut = new UserStatus("Tester", false, testCookie, conf);

            Assert.IsTrue(uut.IsInRole("NO_ACCESS"), "Problem: IsInRole False");
        }
Beispiel #5
0
        public void UserStatusTest()
        {
            SSOConfidence conf = new SSOConfidence();

            System.Web.HttpCookie testCookie = CookieTools.MakeCookie("TestCookie", "TestValue");
            string tte = CookieTools.NewExpiresTime(1).ToString();

            testCookie = CookieTools.AddTo(testCookie, CookieTools.SessionExpires, tte);
            UserStatus uut = new UserStatus("Tester", false, testCookie, conf);

            Assert.IsTrue(uut.Username.Equals("Tester"), "Problem: Username incorrect");
            Assert.IsTrue(uut.IsSessionValid(), "Problem: Session Time Invalid");
            tte          = CookieTools.NewExpiresTime(-3).ToString();
            testCookie   = CookieTools.SetCookieValue(testCookie, CookieTools.SessionExpires, tte);
            uut.MyCookie = testCookie;
            Assert.IsFalse(uut.IsSessionValid(), "Problem: Expired Time Fail");
        }
Beispiel #6
0
        public void CheckConfidenceTest()
        {
            SSOConfidence result = null;

            try
            {
                request.Cookies.Add(CookieTools.MakeCookie(CookieTools.HobbesCookieName, "testValue"));
                HttpContext testContext = new HttpContext(request, response);
                result = ContextDriver.CheckConfidences(testContext);
            }
            catch (Exception ex)
            {
                Assert.Fail("Problem: Check Context Failure {0} @ {1}", ex.Message, ex.StackTrace);
            }
            Assert.IsNotNull(result, "Problem: ContextDriver.CheckConfidences returned null");
            Assert.IsTrue(result.SimpleValue > 50, "Problem: No Confidence at all");
        }
Beispiel #7
0
 public void Setup()
 {
     endpointUUT = new EndpointContext();
     confidence  = new SSOConfidence();
 }