public static Boolean checkAD(string username, string password) { // Attempt directory binds Boolean adValid = AD.checkPw(username, password); if (adValid) { log.Info(String.Format("Correct Active Directory password for user {0}", username)); return(true); } else { log.Info(String.Format("Incorrect Active Directory password for user {0}", username)); return(false); } }
/// <summary> /// Validates a user's passsword against various authentication sources /// </summary> /// <param name="username">username of user</param> /// <param name="password">password to validate</param> /// <param name="sync">whether the authentication sources are in sync</param> /// <returns>whether the user could succesfully bind to any directory</returns> public static Boolean checkPw(string username, string password) { Boolean adValid = AD.checkPw(username, password); // Return true if can bind to active directory if (adValid) { log.Info(String.Format("Correct old password for user {0}", username)); return(true); } else { log.Info(String.Format("Incorrect old password for user {0}", username)); log.Info(String.Format("{0} enabled: {1}", username, AD.isEnabled(username))); return(false); } }