This assignment tests your understanding of interface in Java.You are required to implement an authentication module for a system that manages users login information. The authentication module allows the user to create and modify their information. It also provides the function to authenticate the user by password.You need to design the program structure. Please make good use of object-oriented programming for this assignment. You must make use of interface, and all instant variables must be private. The marking criteria are included at the end of this assignment description.You are also required to write JavaDoc for all non-private classes and non-private class members.TasksWhen the program is executed, the following menu should be displayed:Welcome to the COMP2396 Authentication system!1. Authenticate user2. Add user record3. Edit user recordWhat would you like to perform?Please enter your command (1-3, or 0 to terminate the system):
In the sample outputs below, texts in bold are user inputs.1. Hashing interface Create an Interface class Hash to perform hashing (MD5, SHA1, SHA256 etc) o Implement a hash function for the program to use.o To use the Java hash utility, please refer to:https://docs.oracle.com/javase/8/docs/api/java/security/MessageDige st.html To allow the system to change the hashing algorithm without modifying the program logic. The hashing interface should be used in the following:o Hash the user input password when adding a user. o Hash the user input password for the authentication.o Hash the user input password when the user change or reset the password.2. Add user recordWelcome to the COMP2396 Authentication system!1. Authenticate user2. Add user record3. Edit user recordWhat would you like to perform?Please enter your command (1-3, or 0 to terminate the system):2Please enter your username:RaymondPlease enter your password:123456Your password has to fulfil: at least 1 small letter, 1 capital letter,1 digit!Please enter your password:123456AbcPlease re-enter your password:123456AbcPlease enter your full name:Raymond ChanPlease enter your email address:[email protected]Please enter your phone number:12345678Record added successfully!Please enter your command (1-3, or 0 to terminate the system): Define a User class to store the following:o Username o Hashed password o Full Name o Email address o Phone numbero Failed login count o Account locked Add a user record in the authentication system. If the username is used by another, print out The username is already taken! right after the user inputted the desired username and exit the add user process. Use the hashing function to hash the user input password. The system should store the hashed password instead of the plain text password. The program should check if the password fulfils the following requirements:o The password should contain at least 6 characters, with at least 1 small letter, 1 capital letter, 1 digit. The program should check if the two passwords entered are identical. If not identical, print out Passwords do not match, no user added! and exit the add user process.
3. Authentication with error handlings and error countPlease enter your command (1-3, or 0 to terminate the system):1Please enter your username:RaymondPlease enter your password:123456AbcLogin success! Hello Raymond!Please enter your command (1-3, or 0 to terminate the system): The authentication module should validate if the user can provide a correct username and password.Please enter your command (1-3, or 0 to terminate the system):1Please enter your username: RayPlease enter your password:123456AbcUser not found!Please enter your command (1-3, or 0 to terminate the system): If the user tries to login with a username that does not exist, print out User not found!.Please enter your command (1-3, or 0 to terminate the system):1Please enter your username:RaymondPlease enter your password: 147852369Login failed!Please enter your command (1-3, or 0 to terminate the system):1Please enter your username:RaymondPlease enter your password: 147852369Login failed!Please enter your command (1-3, or 0 to terminate the system):1Please enter your username: RaymondPlease enter your password: 147852369Login failed!Please enter your command (1-3, or 0 to terminate the system):1Please enter your username:RaymondPlease enter your password:147852369Login failed! Your account has been locked!Please enter your command (1-3, or 0 to terminate the system): If the user enters a wrong password, print out Login failed!. If the failed count is less than 3 and the user can login successfully, the failed count will reset to 0. If the failed count is greater than or equal to 3, the user account is locked, and the user will not be allowed to login again. In this case, no matter the user has inputted a correct password not, print out Login failed! Your account has been locked!.
4. Modify user recordPlease enter your command (1-3, or 0 to terminate the system):3Please enter your username:RaymondPlease enter your password:123456AbcLogin success! Hello Raymond!Please enter your new password:123456AcbPlease re-enter your new password:123456AcbPlease enter your new full name:Raymond ChanPlease enter your new email address: [email protected]Record update successfully!Please enter your command (1-3, or 0 to terminate the system): To modify the user record, the user has to provide the username and password before he can edit the record. The program should handle incorrect username or password input in the same way as stated in part 3. In those cases, the user will not be prompted to edit the user record. (Refer to part 3 for sample output) When the user successfully login, allow the user to change the password, full name, and email address. The program should check if the two new passwords entered are identical. If not identical, print out New passwords do not match, user record not edited! and exit the edit user process.
5. Exit the program When 0 is inputted to the system, your program should terminate.
6. Reading user input You must use BufferedReader to read user inputs. Declare the BufferedReader once in your program. Call readLine() once to read one line of user input. If you fail to do so, your program may not be able to read the user input from the Moodle evaluation system.// Declare BufferedReader to read from System.inBufferedReader input = new BufferedReader(new InputStreamReader(System.in));// Use readLine() wherever reading user input is needed to read one line of inputString inputLine; try {inputLine = input.readLine();} catch (IOException e) {System.out.print(Input Error.); }
Reviews
There are no reviews yet.