Ejemplo n.º 1
0
        public void Sso_ClearSession_ItShouldDeleteTheMaestranoSession()
        {
            // Build context
            var samlResp = new SsoResponseStub();
            var att      = samlResp.GetAttributes();
            var user     = new User(samlResp);
            var session  = Helpers.FakeHttpSessionState(preset);

            preset.Sso.SetSession(session, user);

            // Test
            preset.Sso.ClearSession(session);
            Assert.IsNull(session[preset.Marketplace]);
        }
Ejemplo n.º 2
0
        public void Sso_ClearSession_ItShouldDeleteTheMaestranoSession()
        {
            MnoHelper.Environment = "production";

            // Build context
            var samlResp = new SsoResponseStub();
            var att      = samlResp.GetAttributes();
            var user     = new User(samlResp);
            var session  = Helpers.FakeHttpSessionState();

            MnoHelper.Sso.SetSession(session, user);

            // Test
            MnoHelper.Sso.ClearSession(session);
            Assert.IsNull(session["maestrano"]);
        }
Ejemplo n.º 3
0
        public void Sso_SetSession_ItShouldSetTheUserInSession()
        {
            // Build context
            var samlResp = new SsoResponseStub();
            var att      = samlResp.GetAttributes();
            var user     = new User(samlResp);
            var session  = Helpers.FakeHttpSessionState(preset);

            preset.Sso.SetSession(session, user);

            // Decrypt session
            var enc    = System.Text.Encoding.UTF8;
            var json   = enc.GetString(Convert.FromBase64String(session[preset.Marketplace].ToString()));
            var mnoObj = JObject.Parse(json);

            Assert.AreEqual(user.SsoSession, mnoObj.Value <String>("session"));
            Assert.AreEqual(user.Uid, mnoObj.Value <String>("uid"));
            Assert.AreEqual(user.GroupUid, mnoObj.Value <String>("group_uid"));
            Assert.AreEqual(user.SsoSessionRecheck, mnoObj.Value <DateTime>("session_recheck"));
        }
        public void Sso_SetSession_ItShouldSetTheUserInSession()
        {
            MnoHelper.Environment = "production";

            // Build context
            var httpContext = Helpers.FakeHttpContext();
            var samlResp    = new SsoResponseStub();
            var att         = samlResp.GetAttributes();
            var user        = new User(samlResp);

            MnoHelper.Sso.SetSession(httpContext.Session, user);

            // Decrypt session
            var enc    = System.Text.Encoding.UTF8;
            var json   = enc.GetString(Convert.FromBase64String(httpContext.Session["maestrano"].ToString()));
            var mnoObj = JObject.Parse(json);

            Assert.AreEqual(user.SsoSession, mnoObj.Value <String>("session"));
            Assert.AreEqual(user.Uid, mnoObj.Value <String>("uid"));
            Assert.AreEqual(user.GroupUid, mnoObj.Value <String>("group_uid"));
            Assert.AreEqual(user.SsoSessionRecheck, mnoObj.Value <DateTime>("session_recheck"));
        }