In this assignment, you are asked to implement a simple user authentication controller, where you can add/delete users, change passwords of the users, and log users in and out, list all registered and active users. Registered users are the ones added with adduser function, and active users are the ones that are logged in. A user must be registered to be added to the active users list with the login function.

You are given a header file (AuthenticationController.h) which provides the public interface (core functionalities) of AuthenticationController class.

Requirements:

  • You are asked to create and implement AuthenticationController.cpp file that includes implementations for all public functions provided in the header file. You can add private methods and fields, but don't modify the public functions. You can also create other classes.
  • You are asked to create two hash tables. Table1 stores < username,password> pairs of the registered users. Table1 will contain both old passwords and new password of the users. Table2 contains usernames of the active (logged in) users.
  • You are asked to use open addressing with double hashing in the implementation of hash table. Hash function implementation is provided in the header file.
  • If it is not possible to find an empty slot after a number of probes that is equals to the table size for a new entry, do not insert that entry.
  • [Optional Requirement] [+10 points]: In case of addUser, changePassword and login, if the load factor of the table is greater than MAX_LOAD_FACTOR, you are supposed to expand the table. New table size becomes the smallest prime number greater than 2*(tablesize). Don't rehash the "DELETED" and "EMPTY" entries.

Sample state of Table 1 (order depends on the hash function, this is just a sample):

"Fatma", password of Fatma
"Alfred", password of Alfred
"Margo" , password of Margo
"Fatma", old password of Fatma
"Sara", password of Sara
"Margo" , old password of Margo
ā€¯Fatma", another old password of Fatma

Sample state of Table 2:

Fatma
Margo

Suggestion: Use vectors to implement tables instead of arrays. Here is a sample code.

#include < iostream>
#include < vector>
using namespace std;
struct user{
string username;
string password;
};
int
main(){
vector< user> table;
table.resize(10); //it is easier to resize with vectors
user aUser;
aUser.username ="Fatma";
aUser.password = "apassword";
table[0] = aUser;
cout<<"username:"<cout<<"password:"<}
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.