Beispiel #1
0
        public void TestFixtureSetUp()
        {
            backup = AccessFilter.CurrentSecurityManager;
            FakeSecurityManager securityManager = new FakeSecurityManager();

            AccessFilter.CurrentSecurityManager = () => securityManager;
        }
Beispiel #2
0
        public ActionResult Login(UserCredentials credentials)
        {
            ISecurityManager security = new FakeSecurityManager();

            if (security.Authenticate(credentials.UserName, credentials.Password))
            {
                HttpContext.User = new GenericPrincipal(new GenericIdentity(credentials.UserName), new string[] { "user" });
                return(RedirectToAction("Welcome"));
            }
            else
            {
                credentials.Password = "";
                return(Login(credentials, "Login failed !"));
            }
        }