public void TestBadLogin() { ISecurityManager securityManager = new SqlSecurityManager(connection); securityManager.OpenSession(); IUserManager userManager = securityManager.UserManager; User user = userManager.CheckCredentials("Johnny", "English"); securityManager.Close(); }
public void TempTest() { ISecurityManager securityManager = new SqlSecurityManager(connection); securityManager.OpenSession(); IRoleManager roleManager = securityManager.RoleManager; Role role = roleManager.SelectRoleByName("demo"); roleManager.DeleteRole(); securityManager.Close(); }
public void TestGoodLogin() { ISecurityManager securityManager = new SqlSecurityManager(connection); securityManager.OpenSession(); IUserManager userManager = securityManager.UserManager; User user = userManager.CheckCredentials("root", "admin"); securityManager.Close(); Assert.AreEqual("root", user.Login); Assert.IsFalse(user.Disabled); Assert.AreEqual(0u, user.ConsecutiveErrors); }
protected void btnConnect_Click(object sender, EventArgs e) { string connectionString = ConfigurationManager.ConnectionStrings["WebApp"].ConnectionString; using (SqlConnection connection = new SqlConnection(connectionString)) { try { ISecurityManager securityManager = new SqlSecurityManager(connection); securityManager.OpenSession(); IUserManager userManager = securityManager.UserManager; string login = txtLogin.Text; string password = txtPassword.Text; User user = userManager.CheckCredentials(login, password); securityManager.Close(); lblResult.Text = "Welcome " + txtLogin.Text; } catch (BadCredentialsException) { lblResult.Text = "Téki?"; } } }