Question
My code works but i am trying to get it to let me in when the user name and password is put in, instead it
My code works but i am trying to get it to let me in when the user name and password is put in, instead it makes me put it in 3 times before the welcome message appears. also i am trying to make it give me 3 tries and if they are incorrect it logs out. and last i am trying to make it quit when the work quit is typed in. details are below.
For security-minded professionals, it is important that only the appropriate people gain access to data in a computer system. This is called authentication. Once users gain entry, it is also important that they only see data related to their role in a computer system. This is called authorization. For the zoo, you will develop an authentication system that manages both authentication and authorization. You have been given a credentials file that contains credential information for authorized users. You have also been given three files, one for each role:zookeeper, veterinarian, and admin. Each role file describes the data the particular role should be authorized to access. Create an authentication system that does all of the following:
Asks the user for a username
Asks the user for a password
Converts the password using a message digest five (MD5)hashoIt is not required that you write the MD5 from scratch. Use the code located in this document and follow the comments in it to perform this operation.
Checks the credentials against the valid credentials provided in the credentials fileo Use the hashed passwords in the second column; the third column contains the actual passwords for testing and the fourth row contains the role of each user.
Limits failed attempts to three before notifying the user and exiting the program
Gives authenticated users access to the correct role file after successful authentication of The system information stored in the role file should be displayed. For example, if a zookeepers credentials is successfully authenticated, then the contents from the zookeeper file will be displayed. If an admins credentials is successfully authenticated, then the contents from the admin file will be displayed.
Allows a user to logout
Stays on the credential screen until either a successful attempt has been made, three unsuccessful attempts have been made, or a user chooses to exit
Credentials file below:
griffin.keyes 108de81c31bf9c622f76876b74e9285f "alphabet soup" zookeeper rosario.dawson 3e34baa4ee2ff767af8c120a496742b5 "animal doctor" admin bernie.gorilla a584efafa8f9ea7fe5cf18442f32b07b "secret password" veterinarian donald.monkey 17b1b7d8a706696ed220bc414f729ad3 "M0nk3y business" zookeeper jerome.grizzlybear 3adea92111e6307f8f2aae4721e77900 "grizzly1234" veterinarian bruce.grizzlybear 0d107d09f5bbe40cade3de5c71e9e9b7 "letmein" adminAuthentication.javax Source History 1| import java "10.BufferedReader; 2import java.io.InputStreamReader; 3import java.security.MessageDigest 4import java.util.HashMap; 5: L import java.util.Map; class Credentials t public static void Authentication (String original) throws Exception ( 10 MessageDigest md = MessageDigest.getInstance ("MD5"); md. update (original.getBytes )) byte [ ] digest = md. digest ( ) ; StringBuilder sb = new StringBuilder(); for (byte b digest) 12 13 14 15 16 17 18 19 20 ublic class Authentication t 21 sb.append (String. format("02x, b & Oxff)) private static String username private static String passrord: 23 24 25 26 27 28 29 30 31 32 public static void main (String[] args) throws Exception f Map
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started