示例#1
0
        public void SessionStorageIsSetFromForms()
        {
            securityWebService.AddExistingSession("User");
            string    session = securityWebService.Sessions[0].SessionId;
            string    message;
            AmplaUser user = amplaUserService.SessionLogin(session, out message);

            Assert.That(user, Is.Not.Null);
            FormsAuthenticationService.StoreUserTicket(user, false);

            context.Response.Redirect("http://localhost/Production");

            Assert.That(AmplaSessionStorage.GetAmplaSession(), Is.Empty);
            new AlignSessionWithFormsAuthentication(context.Request, AmplaSessionStorage, FormsAuthenticationService).Execute();

            Assert.That(AmplaSessionStorage.GetAmplaSession(), Is.EqualTo(session));
        }
示例#2
0
        public void DisabledSessionStorageDoesntThrow()
        {
            context = context.WithSessionsDisabled();
            Assert.That(context.Session.Enabled, Is.False);

            securityWebService.AddExistingSession("User");
            string    session = securityWebService.Sessions[0].SessionId;
            string    message;
            AmplaUser user = amplaUserService.SessionLogin(session, out message);

            Assert.That(user, Is.Not.Null);
            FormsAuthenticationService.StoreUserTicket(user, false);

            context.Response.Redirect("http://localhost/Production");

            new AlignSessionWithFormsAuthentication(context.Request, AmplaSessionStorage, FormsAuthenticationService).Execute();

            Assert.That(AmplaSessionStorage.GetAmplaSession(), Is.Empty);
        }