Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using netbeans can you please describe setup and provide screen shots? Will provide supporting documents if needed first 10: login app next two: user last

image text in transcribed

Using netbeans

can you please describe setup and provide screen shots?

Will provide supporting documents if needed

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
first 10: login app
image text in transcribed
image text in transcribed
next two: user
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
last 4: user accessor
Part II: Apply select NIST low-impact security controls to the JavaFX Login application. . The following security controls should be applied to the application (check the NIST Security Controls Database for details, description and guidance for each control: AC-7 - UNSUCCESSFUL LOGON ATTEMPTS AC-8-SYSTEM USE NOTIFICATION AU-3 - CONTENT OF AUDIT RECORDS AU-8 - TIME STAMPS IA-2(1) IDENTIFICATION AND AUTHENTICATION (ORGANIZATIONAL USERS) | NETWORK ACCESS TO PRIVILEGED ACCOUNTS (Note this is an enhancement of an existing low-impact security control) Select one additional low-impact security control and implement it. This can be an enhancement or a required low-impact security control. Selecting a control that provides documentation as opposed to code changes is also acceptable and encouraged. . . Hints: C. 111 a. Start with the baseline Login Application and add methods (or additional classes) as needed to comply with each of the security controls. b. You will need to make some decisions for your implementation for the security audit/log files format. Each student may have a slightly different implementation. For the multi-factor authentication, keep it simple. One approach is to send an email to the user with a security code. Then, have them check their email and enter the code. If the code matches, they are properly authenticated. d. There are examples for using JavaMail and writing to files in the materials for this week. Be sure to use those as needed. e. Pay attention to the details of the NIST database description and make sure all of the selected security controls for this project are fully implemented. f. Start on this early. This will take you longer than you think. Deliverables Provide your security fixed Java source code along with a PDF document describing how you addressed each security control. For example, you should list the security control and the descriptions and show and describe the code that addresses the security control. You should also provide screen shots and descriptions of the successful executing the code and the resultant output as applied to each security control. Be sure to submit all of your Java source code if you used multiple classes. Your code should be well-documented with comments, include header comments, use proper variable and naming conventions and properly formatted. (Use the Google Java style guidelines provided in the content-> Course Resources). Be sure your PDF document is neat, well-organized and is well-written with minimal spelling and grammar errors. All references used should be included in your document. 5 loginApp - Notepad File Edit Format View Help / To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools Templates . and open the template in the editor. package loginApp: import java.io. BufferedWriter; import java.io.IOException; import java.io.Print Writer; import java.net. InetAddress; import java.sql. ResultSet; import java.util.List; import java.util. Properties; import java.util. Random; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail. Transport; import javax.mail. Internet. InternetAddress; import javax.mail. Internet. MineMessage; import javafx application. Application; import javafx.event. ActionEvent; import javafx.event. EventHandler; import javafx.geometry. Pos; import javafx scene. Scene; import javafx.scene.control. Button; Import javafx.scene.control. Label import javafx.scene.control. Password Field; import javafx.scene.control. TextField; import javafx.scene. layout GridPane; import javafx.scene.paint.Color; Import javafx.scene. text. Font: TI Type here to search hp logpp - Notepad File Edit Format View Hide import javax.scene.layout.GridPane; import javax.scene.paint.Color import javax.scene.Text. Font: import javax.scene.text.Text; import javafx.stage. Stage; Mauthor is Adopted from Oracle's Login Tutorial Application https://docs.oracle.com/javafx/2/get started/form.htm public class loginApp extends Application Final int maxAttempts - 3; private UserDataAccessor dataAccessor; Kverride public void start(Stage primaryStage) primaryStage.setTitle("My Login App"); Grid Pane divides your window into grids GridPane grid - new GridPane(); // Align to Center 7/ Note Position is geometric object for alignment grid.setAlignment(Pos.CENTER), // Set gap between the components // Larger numbers aan bigger Spaces grid.setHap(10), grid.setVgap(18); 77 System use notification Text notif - new Text("You are accessing low-impact security controls to na JavaFX application Terms and Conditions poly.): // Add text to grld , Span 2 columns 4 rows notif. setFont(Font.font ("Verdana", 14)): notif. setF111(Color.web(E84462")); prid.add(notif, 0, , 3, 1); En Colis 100 Type here to search (hp lopp - Notepad 1/ Create some text to place in the scene Text scenetitie new Text("Welcome Login to continue."); // Add text to grid ,e span 2 columns, 1 ro srid.add(scenetitie, ee, 1, 4); // Create Label Label user new Label("User Name) // Add label to orld 0,1 prid.add(userName, 9, 3); // Create Textfield TextField user TextField-new TextField(); // Add textfield to grid 1,1 grid.add(userTextField, 1, "); I // Create Label Label pw new Label("Password: "); // Add label to grid 0,2 grid.add(pw, B, 4); // Create Passwordfield Passwordfield pwbox - new PasswordField(); // Add Password field to grid 1,2 grid.add(pBox, 1, 4); 1/ Create Label Label userCode - new Label("Security Code :"); // Add label to grid 0,1 grid.add(userCode, 0, 5); // Create Textfield TextField code = new TextField(); // Add text field to grid 1,1 grid.add(code, 1, 5); // Create security code Button . H ER Type here to search dopad grid.add(code, 1, 5); // Create security code Button Button se new Button("Get Code) 1/Add button to rid 1.4 grid.add(sec, 1. 6) 1/ Create Login Button Button btn new Button("Login"); // Add button to grid 1,4 erid.add(tr, 2. ) final text action target - ne Text(); prid.add(actiontarget, 1, 1); 1 Set the Action when button is clicked btn senetlone EventHandlercctionet Override public void handle(ActionEvento) // Authenticate the user List user users - null; boolean 1sValid - falses String role - try dataccessor-new UserDatacestor.com.myl.jdbc.ver w//localhost/ast", root", "); // previeve, users - dataccesser.getUser: 2 catch(Exception err) System.out.println("Error Herr); 1(code.getText(). finalitation annet-new Text UT- GA Type here to see - hp BE System.out.println("Error: ); (code.getText() ----> 1 Final Text actionarpet - Text(); grld.daction target 1, 8): action agr. setFill(Color FINESRTCK); action target.setText("Please enter the security code want to your wall.) > else try String cd - dataccessor.getSecurity Code(userlextid.text()); IF(code portfext.quals(cd)) role - dataccessorgteleuser Textselgelext(). > AsValid - wuthenticate(user Textieldtext(). p. ext(), wars): else final Text actiontarget - Text(); grid.add(actiontarget, 1. 8) actlontarget. setFill(Color. FEREBRICK) actiontarget.setText"Security Code Mismatch.) > catch(Exception exe) System.out.println("Error exp): W If valid clear the grid and welcome the user 1 (sValid) TECH Type here to search 35 VI ER HA fil 46 $ 8 7 6 8 9 0 2 WIf valid clear the wrid and the ser if (isValid) prid.vetvisible(role) Granel new Gridane(): // Mote Position is geometric object for slight Aliento Center orld.setAlignment (PCENTER): sap between the components // larger numbers a big spaces grid.setVgap(10) Text scenetitle new Text (el.co.userlextField text().louwe Boed in a rela) I/ Add text to grid ,espon 2 columns, 1 row trid2.add(scantitle, , 0, 2, 1); Scene scene-hew Scene(grida, 500, 400) primaryStage.setScene(scene) primaryStage Show(); // If Invalid Ask user to try win Helse Final Text actiontarget new Text); grid(actiontarget, 1, 5); actiontarget.setF11(Color FIREBRICK) for (User user users) IF(userlextField.getText().equals Torecaseus peter if(usr.getAccountLocked().val("1"> datakccessor updatecker(userTextField.getText(), 1); actiontarget.setText("Please try again."); else if(usr.setAccount Locked().equals("")) Syst.out.print(ur.getAccountLocked()); actionare settext("Your account has been locked. Contact your listrator 3137 AG Type here to search (hp V. System.out.print.getAccountLo0). acting salext(Your account your > >> // Set the Action when security code button clicked se snction(new EventHandleraction Override public void handle(Action) // Authenticate the use Listuser users - null Interess lp - null; int code security Code(); try 1p - InetAddress.setHost(): > catch(Exception) System.out.print("Error: "); ) try dataccessor - new sertaccessor(com.webcrew//localhost, prom users - detaccessor.getherlist): catch(Exception) 1 System.out.println("Error: "); 1 for User uses BM Type here to search hp being a Tom View Systue.out.println("Error); 1 for (ver users) i'wnerlextield txt().equals norecourgette >> Furthcote().s("")) datacesso SecurityCoderetteleget text). 1. ) Sendeilir 10). Code) actiontarget.setText"Please me the code to your"). else if(usr.getAccount) actionarget.setText(Your count has been social contact your str.) 2 > 2 >> // Set the size of Scene Scene scene new Scenerid, 500, 400); primaryStage.setScene(scene) primaryStage.show(); paras are the command line arts public static void main(String[] args) { launch(args): > 1 ** paraswer the username entered Baran tward the password antened 15 WA Type here to search hop Taunch(s) unawer the entered para ped the password entered return is valid true for authenticated public boolean authenticate(Striser, Stringard, Listhars list) boolean Value - false; for(user use i list) 1/ too through arwy list 1f(usp. ettema().s(user) Msr.got Password().sed) the count") isValid - tros return valid; 2 public static void string enal)Inte) Properties propis Properties(); props.put('mall satp.host peops.put('ll satp. socketfactory.port 6) wp-gat.com props.put(all satp. socketFactory.ca "javak.netissl.sesocketfactory props.put('nalismtp aut true) props put all apport","465) Session session - Session.getDefaulthach(propt. new avax.mail Authenticator() protected PasswordAuthentication et corduthenticati return ner Passwordtentication your brail account your called > >>> RO 3:15 PM CA Type here to search op Session session - Session Detaittanceops mail. Authentic protected Passwortication toward the ration) reture wasthentication your scent your all per 2 >>> try Messagessage - Message Session); setFrom Internet ress("from.co message.setRecipients (essage. Recipientlype. 10, InternetArgs.parse()); setject("Testing Saject) message.setText("Please use the following code to incin to your account and Transport Sandesape) System.out.println("Don"): catch (MessagingException e) { throw new RuntimeException(); 2 > public int security Code) 1 Random random - new Random(); Il generate a random number between 1 and 1932378 Int start -1, end-1912378; int number - rando.nextInt( od start 1) start return number: 2 150 Type here to search UT 3157 IN HD the Notepad File it format View package login App: import javax.beans.property, StringProperty import javax.beans.property. SimpleStringProperty; public class User private final String Property username - new SimpleString 'roperty(this, "username"); public StringProperty username Property() { return username: 2 public final Strin getUsername() { return username Property().get(); 3 public final void setUsername(String username) username Property().set(username); private final StringProperty accountNonLocked - new SimpleStringProperty(this, "account Nontocked"); public String Property accountLockedProperty() { return account NonLocked 3 public final String BetAccountLocked) return accountLockedProperty().get(); 3 public final void setAccountLocked (String account Nonlocked) { account LockedProperty().set(account Nonlocked); 2 private final String Property password - new SimpleStringProperty(this, "password"); public String Property password Property return password; public final String setPassword return passwordProperty().get(); public final void setPassword(String password) password Property().set(password), 1 Type here to search hp es ver Notepad Hleda Fond View Hello public final void setAccountlocked(String account NonLocked) { accountLockedProperty().set(account NonLocked); I private final StringProperty password = new SimpleString Property(this, "password"); public StringProperty password Property() { return password > public final String setPassword) { return password Property().get(); public final void setPassword(String password) { password Property().set(password) 2 private final StringProperty email-new SimpleStringProperty(this, "email"); public StringProperty all Property() { return email ) public final String getEnail() { return email Property().get(); 3 public final vold setCuail(String email) enal Property().set(onat) public User public User(String username, String password, String accounthonLocked, String email) setUsername username) set Password password); setAccountLocked (account Nonlocked) setEnall(en 11); 9 Type here to search B. pipi java.net.Ltdess mort java.sql.Connection Import java. 41.Driverger import java. SQLENCepto It Start import java.time locatie INDOT vasaras portatilir import javro public class User Accord 1 7 in all, we connection pol... private Connection connection pc UserDataccessori driverClas, Strine Stranger, Strine) throws Saption Classic Cassfordrive connection vector: System.println("S) catchbotion) Syst.printineri o vodi shut throws Se int ht Produto > $ 4 & 7 8 O 6 5 9 3 7 2 1 U O T W E Y Q R Masiyal public void shutdown() throws Sception if (comection - null) { Connection.close(). 2 1 public List User ikerlist() throws Exception Statement tant connection.createStact ResultSet as stateetry(select from wes"); Listcuser User ist new ArrayListo): while (.net) String users.getString() 1 String password - PetString password"); String accountionLocked - PetString(accountance) Stringit -.getString(); User User - new user username, password, account hienocked, all) User ist.add(er): for (User use Userlist) System.out.println(usr.getUsername Pasword()); // Print each element 1/ return User ist public void updatticer(String user int try Startsit - connection.createstate() Resultats - stant.executeQuery("select from empts where werranea fcirs.next() 1 Stritt insertinto user user tot last value 3M 40 Type to search Statet station.createstat) String stat - updates account ontware tit.execute(s) . catch(SQLxception e) System.out.print("Error 45). 1 public void save Security Code(String rano, Inetadress to int code) try Statet stat - connection.createState(); String stw - *insert into user_login(usema, ipdress, security_che, d) values stunt, cute(stat) 0 catch(Soe Exception se) System.out.print("Error: ".se); al 1 public String Security Code(Strine sene) throws Soception ResultSet as - nul try Statement tant connection.createStar String stat - "Select from er logins where username username order by the - swt.execute Query(stat); catch(Exception se) System.out.print("Error: ".se) MM AO . Type here to search hp ( 9 > O 8 7 6 5 4 7 3 theated System.out.print("Error *); 1 public String getsecurity CodeString with Socio try oder y luede Statement cmt connection.createState(). String stat - Select * from user logins where were es - Stunt executory(st); > catch(SOException se) 1 System.out.print("Errort ise) 1 return string(4) 2 public String Role(String user) throws Exception ResultSet as - null; try Statement sit-connection.createState() String stat - "Select from user roles where we stat.executegory(stat); catch(SQLException se) System.out.print("Error); 1 return rs.getString(3) urder by La DESET other methods, ce sedusere...) etc w 4 3 Type here to search 1 > O & 7 8 9 6 5 4 1 Part II: Apply select NIST low-impact security controls to the JavaFX Login application. . The following security controls should be applied to the application (check the NIST Security Controls Database for details, description and guidance for each control: AC-7 - UNSUCCESSFUL LOGON ATTEMPTS AC-8-SYSTEM USE NOTIFICATION AU-3 - CONTENT OF AUDIT RECORDS AU-8 - TIME STAMPS IA-2(1) IDENTIFICATION AND AUTHENTICATION (ORGANIZATIONAL USERS) | NETWORK ACCESS TO PRIVILEGED ACCOUNTS (Note this is an enhancement of an existing low-impact security control) Select one additional low-impact security control and implement it. This can be an enhancement or a required low-impact security control. Selecting a control that provides documentation as opposed to code changes is also acceptable and encouraged. . . Hints: C. 111 a. Start with the baseline Login Application and add methods (or additional classes) as needed to comply with each of the security controls. b. You will need to make some decisions for your implementation for the security audit/log files format. Each student may have a slightly different implementation. For the multi-factor authentication, keep it simple. One approach is to send an email to the user with a security code. Then, have them check their email and enter the code. If the code matches, they are properly authenticated. d. There are examples for using JavaMail and writing to files in the materials for this week. Be sure to use those as needed. e. Pay attention to the details of the NIST database description and make sure all of the selected security controls for this project are fully implemented. f. Start on this early. This will take you longer than you think. Deliverables Provide your security fixed Java source code along with a PDF document describing how you addressed each security control. For example, you should list the security control and the descriptions and show and describe the code that addresses the security control. You should also provide screen shots and descriptions of the successful executing the code and the resultant output as applied to each security control. Be sure to submit all of your Java source code if you used multiple classes. Your code should be well-documented with comments, include header comments, use proper variable and naming conventions and properly formatted. (Use the Google Java style guidelines provided in the content-> Course Resources). Be sure your PDF document is neat, well-organized and is well-written with minimal spelling and grammar errors. All references used should be included in your document. 5 loginApp - Notepad File Edit Format View Help / To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools Templates . and open the template in the editor. package loginApp: import java.io. BufferedWriter; import java.io.IOException; import java.io.Print Writer; import java.net. InetAddress; import java.sql. ResultSet; import java.util.List; import java.util. Properties; import java.util. Random; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail. Transport; import javax.mail. Internet. InternetAddress; import javax.mail. Internet. MineMessage; import javafx application. Application; import javafx.event. ActionEvent; import javafx.event. EventHandler; import javafx.geometry. Pos; import javafx scene. Scene; import javafx.scene.control. Button; Import javafx.scene.control. Label import javafx.scene.control. Password Field; import javafx.scene.control. TextField; import javafx.scene. layout GridPane; import javafx.scene.paint.Color; Import javafx.scene. text. Font: TI Type here to search hp logpp - Notepad File Edit Format View Hide import javax.scene.layout.GridPane; import javax.scene.paint.Color import javax.scene.Text. Font: import javax.scene.text.Text; import javafx.stage. Stage; Mauthor is Adopted from Oracle's Login Tutorial Application https://docs.oracle.com/javafx/2/get started/form.htm public class loginApp extends Application Final int maxAttempts - 3; private UserDataAccessor dataAccessor; Kverride public void start(Stage primaryStage) primaryStage.setTitle("My Login App"); Grid Pane divides your window into grids GridPane grid - new GridPane(); // Align to Center 7/ Note Position is geometric object for alignment grid.setAlignment(Pos.CENTER), // Set gap between the components // Larger numbers aan bigger Spaces grid.setHap(10), grid.setVgap(18); 77 System use notification Text notif - new Text("You are accessing low-impact security controls to na JavaFX application Terms and Conditions poly.): // Add text to grld , Span 2 columns 4 rows notif. setFont(Font.font ("Verdana", 14)): notif. setF111(Color.web(E84462")); prid.add(notif, 0, , 3, 1); En Colis 100 Type here to search (hp lopp - Notepad 1/ Create some text to place in the scene Text scenetitie new Text("Welcome Login to continue."); // Add text to grid ,e span 2 columns, 1 ro srid.add(scenetitie, ee, 1, 4); // Create Label Label user new Label("User Name) // Add label to orld 0,1 prid.add(userName, 9, 3); // Create Textfield TextField user TextField-new TextField(); // Add textfield to grid 1,1 grid.add(userTextField, 1, "); I // Create Label Label pw new Label("Password: "); // Add label to grid 0,2 grid.add(pw, B, 4); // Create Passwordfield Passwordfield pwbox - new PasswordField(); // Add Password field to grid 1,2 grid.add(pBox, 1, 4); 1/ Create Label Label userCode - new Label("Security Code :"); // Add label to grid 0,1 grid.add(userCode, 0, 5); // Create Textfield TextField code = new TextField(); // Add text field to grid 1,1 grid.add(code, 1, 5); // Create security code Button . H ER Type here to search dopad grid.add(code, 1, 5); // Create security code Button Button se new Button("Get Code) 1/Add button to rid 1.4 grid.add(sec, 1. 6) 1/ Create Login Button Button btn new Button("Login"); // Add button to grid 1,4 erid.add(tr, 2. ) final text action target - ne Text(); prid.add(actiontarget, 1, 1); 1 Set the Action when button is clicked btn senetlone EventHandlercctionet Override public void handle(ActionEvento) // Authenticate the user List user users - null; boolean 1sValid - falses String role - try dataccessor-new UserDatacestor.com.myl.jdbc.ver w//localhost/ast", root", "); // previeve, users - dataccesser.getUser: 2 catch(Exception err) System.out.println("Error Herr); 1(code.getText(). finalitation annet-new Text UT- GA Type here to see - hp BE System.out.println("Error: ); (code.getText() ----> 1 Final Text actionarpet - Text(); grld.daction target 1, 8): action agr. setFill(Color FINESRTCK); action target.setText("Please enter the security code want to your wall.) > else try String cd - dataccessor.getSecurity Code(userlextid.text()); IF(code portfext.quals(cd)) role - dataccessorgteleuser Textselgelext(). > AsValid - wuthenticate(user Textieldtext(). p. ext(), wars): else final Text actiontarget - Text(); grid.add(actiontarget, 1. 8) actlontarget. setFill(Color. FEREBRICK) actiontarget.setText"Security Code Mismatch.) > catch(Exception exe) System.out.println("Error exp): W If valid clear the grid and welcome the user 1 (sValid) TECH Type here to search 35 VI ER HA fil 46 $ 8 7 6 8 9 0 2 WIf valid clear the wrid and the ser if (isValid) prid.vetvisible(role) Granel new Gridane(): // Mote Position is geometric object for slight Aliento Center orld.setAlignment (PCENTER): sap between the components // larger numbers a big spaces grid.setVgap(10) Text scenetitle new Text (el.co.userlextField text().louwe Boed in a rela) I/ Add text to grid ,espon 2 columns, 1 row trid2.add(scantitle, , 0, 2, 1); Scene scene-hew Scene(grida, 500, 400) primaryStage.setScene(scene) primaryStage Show(); // If Invalid Ask user to try win Helse Final Text actiontarget new Text); grid(actiontarget, 1, 5); actiontarget.setF11(Color FIREBRICK) for (User user users) IF(userlextField.getText().equals Torecaseus peter if(usr.getAccountLocked().val("1"> datakccessor updatecker(userTextField.getText(), 1); actiontarget.setText("Please try again."); else if(usr.setAccount Locked().equals("")) Syst.out.print(ur.getAccountLocked()); actionare settext("Your account has been locked. Contact your listrator 3137 AG Type here to search (hp V. System.out.print.getAccountLo0). acting salext(Your account your > >> // Set the Action when security code button clicked se snction(new EventHandleraction Override public void handle(Action) // Authenticate the use Listuser users - null Interess lp - null; int code security Code(); try 1p - InetAddress.setHost(): > catch(Exception) System.out.print("Error: "); ) try dataccessor - new sertaccessor(com.webcrew//localhost, prom users - detaccessor.getherlist): catch(Exception) 1 System.out.println("Error: "); 1 for User uses BM Type here to search hp being a Tom View Systue.out.println("Error); 1 for (ver users) i'wnerlextield txt().equals norecourgette >> Furthcote().s("")) datacesso SecurityCoderetteleget text). 1. ) Sendeilir 10). Code) actiontarget.setText"Please me the code to your"). else if(usr.getAccount) actionarget.setText(Your count has been social contact your str.) 2 > 2 >> // Set the size of Scene Scene scene new Scenerid, 500, 400); primaryStage.setScene(scene) primaryStage.show(); paras are the command line arts public static void main(String[] args) { launch(args): > 1 ** paraswer the username entered Baran tward the password antened 15 WA Type here to search hop Taunch(s) unawer the entered para ped the password entered return is valid true for authenticated public boolean authenticate(Striser, Stringard, Listhars list) boolean Value - false; for(user use i list) 1/ too through arwy list 1f(usp. ettema().s(user) Msr.got Password().sed) the count") isValid - tros return valid; 2 public static void string enal)Inte) Properties propis Properties(); props.put('mall satp.host peops.put('ll satp. socketfactory.port 6) wp-gat.com props.put(all satp. socketFactory.ca "javak.netissl.sesocketfactory props.put('nalismtp aut true) props put all apport","465) Session session - Session.getDefaulthach(propt. new avax.mail Authenticator() protected PasswordAuthentication et corduthenticati return ner Passwordtentication your brail account your called > >>> RO 3:15 PM CA Type here to search op Session session - Session Detaittanceops mail. Authentic protected Passwortication toward the ration) reture wasthentication your scent your all per 2 >>> try Messagessage - Message Session); setFrom Internet ress("from.co message.setRecipients (essage. Recipientlype. 10, InternetArgs.parse()); setject("Testing Saject) message.setText("Please use the following code to incin to your account and Transport Sandesape) System.out.println("Don"): catch (MessagingException e) { throw new RuntimeException(); 2 > public int security Code) 1 Random random - new Random(); Il generate a random number between 1 and 1932378 Int start -1, end-1912378; int number - rando.nextInt( od start 1) start return number: 2 150 Type here to search UT 3157 IN HD the Notepad File it format View package login App: import javax.beans.property, StringProperty import javax.beans.property. SimpleStringProperty; public class User private final String Property username - new SimpleString 'roperty(this, "username"); public StringProperty username Property() { return username: 2 public final Strin getUsername() { return username Property().get(); 3 public final void setUsername(String username) username Property().set(username); private final StringProperty accountNonLocked - new SimpleStringProperty(this, "account Nontocked"); public String Property accountLockedProperty() { return account NonLocked 3 public final String BetAccountLocked) return accountLockedProperty().get(); 3 public final void setAccountLocked (String account Nonlocked) { account LockedProperty().set(account Nonlocked); 2 private final String Property password - new SimpleStringProperty(this, "password"); public String Property password Property return password; public final String setPassword return passwordProperty().get(); public final void setPassword(String password) password Property().set(password), 1 Type here to search hp es ver Notepad Hleda Fond View Hello public final void setAccountlocked(String account NonLocked) { accountLockedProperty().set(account NonLocked); I private final StringProperty password = new SimpleString Property(this, "password"); public StringProperty password Property() { return password > public final String setPassword) { return password Property().get(); public final void setPassword(String password) { password Property().set(password) 2 private final StringProperty email-new SimpleStringProperty(this, "email"); public StringProperty all Property() { return email ) public final String getEnail() { return email Property().get(); 3 public final vold setCuail(String email) enal Property().set(onat) public User public User(String username, String password, String accounthonLocked, String email) setUsername username) set Password password); setAccountLocked (account Nonlocked) setEnall(en 11); 9 Type here to search B. pipi java.net.Ltdess mort java.sql.Connection Import java. 41.Driverger import java. SQLENCepto It Start import java.time locatie INDOT vasaras portatilir import javro public class User Accord 1 7 in all, we connection pol... private Connection connection pc UserDataccessori driverClas, Strine Stranger, Strine) throws Saption Classic Cassfordrive connection vector: System.println("S) catchbotion) Syst.printineri o vodi shut throws Se int ht Produto > $ 4 & 7 8 O 6 5 9 3 7 2 1 U O T W E Y Q R Masiyal public void shutdown() throws Sception if (comection - null) { Connection.close(). 2 1 public List User ikerlist() throws Exception Statement tant connection.createStact ResultSet as stateetry(select from wes"); Listcuser User ist new ArrayListo): while (.net) String users.getString() 1 String password - PetString password"); String accountionLocked - PetString(accountance) Stringit -.getString(); User User - new user username, password, account hienocked, all) User ist.add(er): for (User use Userlist) System.out.println(usr.getUsername Pasword()); // Print each element 1/ return User ist public void updatticer(String user int try Startsit - connection.createstate() Resultats - stant.executeQuery("select from empts where werranea fcirs.next() 1 Stritt insertinto user user tot last value 3M 40 Type to search Statet station.createstat) String stat - updates account ontware tit.execute(s) . catch(SQLxception e) System.out.print("Error 45). 1 public void save Security Code(String rano, Inetadress to int code) try Statet stat - connection.createState(); String stw - *insert into user_login(usema, ipdress, security_che, d) values stunt, cute(stat) 0 catch(Soe Exception se) System.out.print("Error: ".se); al 1 public String Security Code(Strine sene) throws Soception ResultSet as - nul try Statement tant connection.createStar String stat - "Select from er logins where username username order by the - swt.execute Query(stat); catch(Exception se) System.out.print("Error: ".se) MM AO . Type here to search hp ( 9 > O 8 7 6 5 4 7 3 theated System.out.print("Error *); 1 public String getsecurity CodeString with Socio try oder y luede Statement cmt connection.createState(). String stat - Select * from user logins where were es - Stunt executory(st); > catch(SOException se) 1 System.out.print("Errort ise) 1 return string(4) 2 public String Role(String user) throws Exception ResultSet as - null; try Statement sit-connection.createState() String stat - "Select from user roles where we stat.executegory(stat); catch(SQLException se) System.out.print("Error); 1 return rs.getString(3) urder by La DESET other methods, ce sedusere...) etc w 4 3 Type here to search 1 > O & 7 8 9 6 5 4 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

ISBN: 133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions