SlideShare a Scribd company logo
1 of 9
FileWrite.javaFileWrite.java/*
* To change this license header, choose License Headers in Pro
ject Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package filewrite;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
/**
* @description This program will write text to a file and save t
he file in the
* project's root directory.
* @author Eric
*/
publicclassFileWrite{
/**
* @param args the command line arguments
*/
publicstaticvoid main(String[] args){
// declaring variables of text and initializing the buffered writer
String txt ="Hello World.";
BufferedWriter writer =null;
// write the text variable using the bufferedwriter to testing.txt
try{
writer =newBufferedWriter(newFileWriter("testing.txt")
);
writer.write(txt);
}
// print error message if there is one
catch(IOException io){
System.out.println("File IO Exception"+ io.getMessage());
}
//close the file
finally{
try{
if(writer !=null){
writer.close();
}
}
//print error message if there is one
catch(IOException io){
System.out.println("Issue closing the File."+ io.getMessage());
}
}
}
}
JavaMail.javaJavaMail.java/*
* To change this license header, choose License Headers in Pro
ject Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javamail;
import java.util.Properties;
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.MimeMessage;
/**
* @description This program uses Java to send emails over the
SSL protocol.
* @author Eric
*/
publicclassJavaMail{
/**
* @param args the command line arguments
*/
publicstaticvoid main(String[] args){
Properties props =newProperties();
props.put("mail.smtp.host","smtp.gmail.com");
props.put("mail.smtp.socketFactory.port","465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth","true");
props.put("mail.smtp.port","465");
Session session =Session.getDefaultInstance(props,
new javax.mail.Authenticator(){
protectedPasswordAuthentication getPasswordAuthentication(){
returnnewPasswordAuthentication("username","password");
}
});
try{
Message message =newMimeMessage(session);
message.setFrom(newInternetAddress("[email protected
]"));
message.setRecipients(Message.RecipientType.
TO,
InternetAddress.parse("[email protected]"));
message.setSubject("Testing Subject");
message.setText("Dear Mail Crawler,"+
"nn No spam to my email, please!");
Transport.send(message);
System.out.println("Done");
}catch(MessagingException e){
thrownewRuntimeException(e);
}
}
}
loginApp.javaloginApp.java/*
* To change this license header, choose License Headers in Pro
ject Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package loginApp;
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.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
/**
*
* @author jim Adopted from Oracle's Login Tutorial Applicati
on
* https://docs.oracle.com/javafx/2/get_started/form.htm
*/
publicclass loginApp extendsApplication{
@Override
publicvoid start(Stage primaryStage){
primaryStage.setTitle("My Login App");
// Grid Pane divides your window into grids
GridPane grid =newGridPane();
// Align to Center
// Note Position is geometric object for alignment
grid.setAlignment(Pos.CENTER);
// Set gap between the components
// Larger numbers mean bigger spaces
grid.setHgap(10);
grid.setVgap(10);
// Create some text to place in the scene
Text scenetitle =newText("Welcome. Login to continue.");
// Add text to grid 0,0 span 2 columns, 1 row
grid.add(scenetitle,0,0,2,1);
// Create Label
Label userName =newLabel("User Name:");
// Add label to grid 0,1
grid.add(userName,0,1);
// Create Textfield
TextField userTextField =newTextField();
// Add textfield to grid 1,1
grid.add(userTextField,1,1);
// Create Label
Label pw =newLabel("Password:");
// Add label to grid 0,2
grid.add(pw,0,2);
// Create Passwordfield
PasswordField pwBox =newPasswordField();
// Add Password field to grid 1,2
grid.add(pwBox,1,2);
// Create Login Button
Button btn =newButton("Login");
// Add button to grid 1,4
grid.add(btn,1,4);
finalText actiontarget =newText();
grid.add(actiontarget,1,6);
// Set the Action when button is clicked
btn.setOnAction(newEventHandler<ActionEvent>(){
@Override
publicvoid handle(ActionEvent e){
// Authenticate the user
boolean isValid = authenticate(userTextField.getText(), pwBox.
getText());
// If valid clear the grid and Welcome the user
if(isValid){
grid.setVisible(false);
GridPane grid2 =newGridPane();
// Align to Center
// Note Position is geometric object for alignment
grid2.setAlignment(Pos.CENTER);
// Set gap between the components
// Larger numbers mean bigger spaces
grid2.setHgap(10);
grid2.setVgap(10);
Text scenetitle =newText("Welcome "+ userTextField.getText()
+"!");
// Add text to grid 0,0 span 2 columns, 1 row
grid2.add(scenetitle,0,0,2,1);
Scene scene =newScene(grid2,500,400);
primaryStage.setScene(scene);
primaryStage.show();
// If Invalid Ask user to try again
}else{
finalText actiontarget =newText();
grid.add(actiontarget,1,6);
actiontarget.setFill(Color.FIREBRICK);
actiontarget.setText("Please try again.");
}
}
});
// Set the size of Scene
Scene scene =newScene(grid,500,400);
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
publicstaticvoid main(String[] args){
launch(args);
}
/**
* @param user the username entered
* @param pword the password entered
* @return isValid true for authenticated
*/
publicboolean authenticate(String user,String pword){
boolean isValid =false;
if(user.equalsIgnoreCase("servadmin")
&& pword.equals("foxtrot_1980")){
isValid =true;
}
return isValid;
}
}
Use the attached file for this assignment!
The following security controls need to 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.
Pointers:
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.
c. 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.
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 formatte

More Related Content

Similar to FileWrite.javaFileWrite.java  To change this license header.docx

Question IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docxQuestion IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docxaudeleypearl
 
Context and Dependency Injection 2.0
Context and Dependency Injection 2.0Context and Dependency Injection 2.0
Context and Dependency Injection 2.0Brian S. Paskin
 
I really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdfI really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdfamitbagga0808
 
Final Project Presentation
Final Project PresentationFinal Project Presentation
Final Project Presentationzroserie
 
Global objects in Node.pdf
Global objects in Node.pdfGlobal objects in Node.pdf
Global objects in Node.pdfSudhanshiBakre1
 
Standards For Java Coding
Standards For Java CodingStandards For Java Coding
Standards For Java CodingRahul Bhutkar
 
WPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaWPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaRainer Stropek
 
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosUnit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosFlutter Agency
 
Testing with JUnit 5 and Spring
Testing with JUnit 5 and SpringTesting with JUnit 5 and Spring
Testing with JUnit 5 and SpringVMware Tanzu
 
Enterprise Library 3.0 Overview
Enterprise Library 3.0 OverviewEnterprise Library 3.0 Overview
Enterprise Library 3.0 Overviewmcgurk
 
Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core Binary Studio
 
Enterprise Library 2.0
Enterprise Library 2.0Enterprise Library 2.0
Enterprise Library 2.0Raju Permandla
 
stateDatabuild.xml Builds, tests, and runs the project.docx
stateDatabuild.xml      Builds, tests, and runs the project.docxstateDatabuild.xml      Builds, tests, and runs the project.docx
stateDatabuild.xml Builds, tests, and runs the project.docxwhitneyleman54422
 
7\9 SSIS 2008R2_Training - Script Task
7\9 SSIS 2008R2_Training - Script Task7\9 SSIS 2008R2_Training - Script Task
7\9 SSIS 2008R2_Training - Script TaskPramod Singla
 
27 - Panorama Necto 14 component mode & java script - visualization & data di...
27 - Panorama Necto 14 component mode & java script - visualization & data di...27 - Panorama Necto 14 component mode & java script - visualization & data di...
27 - Panorama Necto 14 component mode & java script - visualization & data di...Panorama Software
 
[xp2013] Narrow Down What to Test
[xp2013] Narrow Down What to Test[xp2013] Narrow Down What to Test
[xp2013] Narrow Down What to TestZsolt Fabok
 

Similar to FileWrite.javaFileWrite.java  To change this license header.docx (20)

Question IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docxQuestion IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docx
 
Junit4.0
Junit4.0Junit4.0
Junit4.0
 
Context and Dependency Injection 2.0
Context and Dependency Injection 2.0Context and Dependency Injection 2.0
Context and Dependency Injection 2.0
 
I really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdfI really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdf
 
Final Project Presentation
Final Project PresentationFinal Project Presentation
Final Project Presentation
 
Global objects in Node.pdf
Global objects in Node.pdfGlobal objects in Node.pdf
Global objects in Node.pdf
 
Standards For Java Coding
Standards For Java CodingStandards For Java Coding
Standards For Java Coding
 
WPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaWPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA Austria
 
Lombok
LombokLombok
Lombok
 
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosUnit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
 
Testing with JUnit 5 and Spring
Testing with JUnit 5 and SpringTesting with JUnit 5 and Spring
Testing with JUnit 5 and Spring
 
Enterprise Library 3.0 Overview
Enterprise Library 3.0 OverviewEnterprise Library 3.0 Overview
Enterprise Library 3.0 Overview
 
Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core
 
Enterprise Library 2.0
Enterprise Library 2.0Enterprise Library 2.0
Enterprise Library 2.0
 
Hybrid framework
Hybrid frameworkHybrid framework
Hybrid framework
 
stateDatabuild.xml Builds, tests, and runs the project.docx
stateDatabuild.xml      Builds, tests, and runs the project.docxstateDatabuild.xml      Builds, tests, and runs the project.docx
stateDatabuild.xml Builds, tests, and runs the project.docx
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
7\9 SSIS 2008R2_Training - Script Task
7\9 SSIS 2008R2_Training - Script Task7\9 SSIS 2008R2_Training - Script Task
7\9 SSIS 2008R2_Training - Script Task
 
27 - Panorama Necto 14 component mode & java script - visualization & data di...
27 - Panorama Necto 14 component mode & java script - visualization & data di...27 - Panorama Necto 14 component mode & java script - visualization & data di...
27 - Panorama Necto 14 component mode & java script - visualization & data di...
 
[xp2013] Narrow Down What to Test
[xp2013] Narrow Down What to Test[xp2013] Narrow Down What to Test
[xp2013] Narrow Down What to Test
 

More from ssuser454af01

The following pairs of co-morbid disorders and  a write 700 words .docx
The following pairs of co-morbid disorders and  a write 700 words .docxThe following pairs of co-morbid disorders and  a write 700 words .docx
The following pairs of co-morbid disorders and  a write 700 words .docxssuser454af01
 
The following is an access verification technique, listing several f.docx
The following is an access verification technique, listing several f.docxThe following is an access verification technique, listing several f.docx
The following is an access verification technique, listing several f.docxssuser454af01
 
The following discussion board post has to have a response. Please r.docx
The following discussion board post has to have a response. Please r.docxThe following discussion board post has to have a response. Please r.docx
The following discussion board post has to have a response. Please r.docxssuser454af01
 
The following information has been taken from the ledger accounts of.docx
The following information has been taken from the ledger accounts of.docxThe following information has been taken from the ledger accounts of.docx
The following information has been taken from the ledger accounts of.docxssuser454af01
 
The following attach files are my History Homewrok and Lecture Power.docx
The following attach files are my History Homewrok and Lecture Power.docxThe following attach files are my History Homewrok and Lecture Power.docx
The following attach files are my History Homewrok and Lecture Power.docxssuser454af01
 
The following is adapted from the work of Paul Martin Lester.In .docx
The following is adapted from the work of Paul Martin Lester.In .docxThe following is adapted from the work of Paul Martin Lester.In .docx
The following is adapted from the work of Paul Martin Lester.In .docxssuser454af01
 
The following article is related to deterring employee fraud within .docx
The following article is related to deterring employee fraud within .docxThe following article is related to deterring employee fraud within .docx
The following article is related to deterring employee fraud within .docxssuser454af01
 
The Five stages of ChangeBy Thursday, June 25, 2015, respond to .docx
The Five stages of ChangeBy Thursday, June 25, 2015, respond to .docxThe Five stages of ChangeBy Thursday, June 25, 2015, respond to .docx
The Five stages of ChangeBy Thursday, June 25, 2015, respond to .docxssuser454af01
 
The first step in understanding the behaviors that are associated wi.docx
The first step in understanding the behaviors that are associated wi.docxThe first step in understanding the behaviors that are associated wi.docx
The first step in understanding the behaviors that are associated wi.docxssuser454af01
 
The first one is due Sep 24 at 1100AMthe French-born Mexican jo.docx
The first one is due Sep 24 at 1100AMthe French-born Mexican jo.docxThe first one is due Sep 24 at 1100AMthe French-born Mexican jo.docx
The first one is due Sep 24 at 1100AMthe French-born Mexican jo.docxssuser454af01
 
The first part is a direct quote, copied word for word. Includ.docx
The first part is a direct quote, copied word for word. Includ.docxThe first part is a direct quote, copied word for word. Includ.docx
The first part is a direct quote, copied word for word. Includ.docxssuser454af01
 
The final research paper should be no less than 15 pages and in APA .docx
The final research paper should be no less than 15 pages and in APA .docxThe final research paper should be no less than 15 pages and in APA .docx
The final research paper should be no less than 15 pages and in APA .docxssuser454af01
 
The first one Description Pick a physical activity. Somethi.docx
The first one Description Pick a physical activity. Somethi.docxThe first one Description Pick a physical activity. Somethi.docx
The first one Description Pick a physical activity. Somethi.docxssuser454af01
 
The first column suggests traditional familyschool relationships an.docx
The first column suggests traditional familyschool relationships an.docxThe first column suggests traditional familyschool relationships an.docx
The first column suggests traditional familyschool relationships an.docxssuser454af01
 
The first president that I actually remembered was Jimmy Carter.  .docx
The first president that I actually remembered was Jimmy Carter.  .docxThe first president that I actually remembered was Jimmy Carter.  .docx
The first president that I actually remembered was Jimmy Carter.  .docxssuser454af01
 
The final project for this course is the creation of a conceptual mo.docx
The final project for this course is the creation of a conceptual mo.docxThe final project for this course is the creation of a conceptual mo.docx
The final project for this course is the creation of a conceptual mo.docxssuser454af01
 
The finance department of a large corporation has evaluated a possib.docx
The finance department of a large corporation has evaluated a possib.docxThe finance department of a large corporation has evaluated a possib.docx
The finance department of a large corporation has evaluated a possib.docxssuser454af01
 
The Final Paper must have depth of scholarship, originality, theoret.docx
The Final Paper must have depth of scholarship, originality, theoret.docxThe Final Paper must have depth of scholarship, originality, theoret.docx
The Final Paper must have depth of scholarship, originality, theoret.docxssuser454af01
 
The Final exam primarily covers the areas of the hydrosphere, the bi.docx
The Final exam primarily covers the areas of the hydrosphere, the bi.docxThe Final exam primarily covers the areas of the hydrosphere, the bi.docx
The Final exam primarily covers the areas of the hydrosphere, the bi.docxssuser454af01
 
The Final Paper must be 8 pages (not including title and reference p.docx
The Final Paper must be 8 pages (not including title and reference p.docxThe Final Paper must be 8 pages (not including title and reference p.docx
The Final Paper must be 8 pages (not including title and reference p.docxssuser454af01
 

More from ssuser454af01 (20)

The following pairs of co-morbid disorders and  a write 700 words .docx
The following pairs of co-morbid disorders and  a write 700 words .docxThe following pairs of co-morbid disorders and  a write 700 words .docx
The following pairs of co-morbid disorders and  a write 700 words .docx
 
The following is an access verification technique, listing several f.docx
The following is an access verification technique, listing several f.docxThe following is an access verification technique, listing several f.docx
The following is an access verification technique, listing several f.docx
 
The following discussion board post has to have a response. Please r.docx
The following discussion board post has to have a response. Please r.docxThe following discussion board post has to have a response. Please r.docx
The following discussion board post has to have a response. Please r.docx
 
The following information has been taken from the ledger accounts of.docx
The following information has been taken from the ledger accounts of.docxThe following information has been taken from the ledger accounts of.docx
The following information has been taken from the ledger accounts of.docx
 
The following attach files are my History Homewrok and Lecture Power.docx
The following attach files are my History Homewrok and Lecture Power.docxThe following attach files are my History Homewrok and Lecture Power.docx
The following attach files are my History Homewrok and Lecture Power.docx
 
The following is adapted from the work of Paul Martin Lester.In .docx
The following is adapted from the work of Paul Martin Lester.In .docxThe following is adapted from the work of Paul Martin Lester.In .docx
The following is adapted from the work of Paul Martin Lester.In .docx
 
The following article is related to deterring employee fraud within .docx
The following article is related to deterring employee fraud within .docxThe following article is related to deterring employee fraud within .docx
The following article is related to deterring employee fraud within .docx
 
The Five stages of ChangeBy Thursday, June 25, 2015, respond to .docx
The Five stages of ChangeBy Thursday, June 25, 2015, respond to .docxThe Five stages of ChangeBy Thursday, June 25, 2015, respond to .docx
The Five stages of ChangeBy Thursday, June 25, 2015, respond to .docx
 
The first step in understanding the behaviors that are associated wi.docx
The first step in understanding the behaviors that are associated wi.docxThe first step in understanding the behaviors that are associated wi.docx
The first step in understanding the behaviors that are associated wi.docx
 
The first one is due Sep 24 at 1100AMthe French-born Mexican jo.docx
The first one is due Sep 24 at 1100AMthe French-born Mexican jo.docxThe first one is due Sep 24 at 1100AMthe French-born Mexican jo.docx
The first one is due Sep 24 at 1100AMthe French-born Mexican jo.docx
 
The first part is a direct quote, copied word for word. Includ.docx
The first part is a direct quote, copied word for word. Includ.docxThe first part is a direct quote, copied word for word. Includ.docx
The first part is a direct quote, copied word for word. Includ.docx
 
The final research paper should be no less than 15 pages and in APA .docx
The final research paper should be no less than 15 pages and in APA .docxThe final research paper should be no less than 15 pages and in APA .docx
The final research paper should be no less than 15 pages and in APA .docx
 
The first one Description Pick a physical activity. Somethi.docx
The first one Description Pick a physical activity. Somethi.docxThe first one Description Pick a physical activity. Somethi.docx
The first one Description Pick a physical activity. Somethi.docx
 
The first column suggests traditional familyschool relationships an.docx
The first column suggests traditional familyschool relationships an.docxThe first column suggests traditional familyschool relationships an.docx
The first column suggests traditional familyschool relationships an.docx
 
The first president that I actually remembered was Jimmy Carter.  .docx
The first president that I actually remembered was Jimmy Carter.  .docxThe first president that I actually remembered was Jimmy Carter.  .docx
The first president that I actually remembered was Jimmy Carter.  .docx
 
The final project for this course is the creation of a conceptual mo.docx
The final project for this course is the creation of a conceptual mo.docxThe final project for this course is the creation of a conceptual mo.docx
The final project for this course is the creation of a conceptual mo.docx
 
The finance department of a large corporation has evaluated a possib.docx
The finance department of a large corporation has evaluated a possib.docxThe finance department of a large corporation has evaluated a possib.docx
The finance department of a large corporation has evaluated a possib.docx
 
The Final Paper must have depth of scholarship, originality, theoret.docx
The Final Paper must have depth of scholarship, originality, theoret.docxThe Final Paper must have depth of scholarship, originality, theoret.docx
The Final Paper must have depth of scholarship, originality, theoret.docx
 
The Final exam primarily covers the areas of the hydrosphere, the bi.docx
The Final exam primarily covers the areas of the hydrosphere, the bi.docxThe Final exam primarily covers the areas of the hydrosphere, the bi.docx
The Final exam primarily covers the areas of the hydrosphere, the bi.docx
 
The Final Paper must be 8 pages (not including title and reference p.docx
The Final Paper must be 8 pages (not including title and reference p.docxThe Final Paper must be 8 pages (not including title and reference p.docx
The Final Paper must be 8 pages (not including title and reference p.docx
 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 

Recently uploaded (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 

FileWrite.javaFileWrite.java  To change this license header.docx

  • 1. FileWrite.javaFileWrite.java/* * To change this license header, choose License Headers in Pro ject Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package filewrite; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; /** * @description This program will write text to a file and save t he file in the * project's root directory. * @author Eric */ publicclassFileWrite{ /** * @param args the command line arguments */ publicstaticvoid main(String[] args){ // declaring variables of text and initializing the buffered writer String txt ="Hello World."; BufferedWriter writer =null; // write the text variable using the bufferedwriter to testing.txt try{ writer =newBufferedWriter(newFileWriter("testing.txt") ); writer.write(txt);
  • 2. } // print error message if there is one catch(IOException io){ System.out.println("File IO Exception"+ io.getMessage()); } //close the file finally{ try{ if(writer !=null){ writer.close(); } } //print error message if there is one catch(IOException io){ System.out.println("Issue closing the File."+ io.getMessage()); } } } } JavaMail.javaJavaMail.java/* * To change this license header, choose License Headers in Pro ject Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package javamail; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport;
  • 3. import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; /** * @description This program uses Java to send emails over the SSL protocol. * @author Eric */ publicclassJavaMail{ /** * @param args the command line arguments */ publicstaticvoid main(String[] args){ Properties props =newProperties(); props.put("mail.smtp.host","smtp.gmail.com"); props.put("mail.smtp.socketFactory.port","465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth","true"); props.put("mail.smtp.port","465"); Session session =Session.getDefaultInstance(props, new javax.mail.Authenticator(){ protectedPasswordAuthentication getPasswordAuthentication(){ returnnewPasswordAuthentication("username","password"); } }); try{ Message message =newMimeMessage(session); message.setFrom(newInternetAddress("[email protected ]")); message.setRecipients(Message.RecipientType. TO,
  • 4. InternetAddress.parse("[email protected]")); message.setSubject("Testing Subject"); message.setText("Dear Mail Crawler,"+ "nn No spam to my email, please!"); Transport.send(message); System.out.println("Done"); }catch(MessagingException e){ thrownewRuntimeException(e); } } } loginApp.javaloginApp.java/* * To change this license header, choose License Headers in Pro ject Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package loginApp; 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.PasswordField; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.scene.paint.Color; import javafx.scene.text.Text;
  • 5. import javafx.stage.Stage; /** * * @author jim Adopted from Oracle's Login Tutorial Applicati on * https://docs.oracle.com/javafx/2/get_started/form.htm */ publicclass loginApp extendsApplication{ @Override publicvoid start(Stage primaryStage){ primaryStage.setTitle("My Login App"); // Grid Pane divides your window into grids GridPane grid =newGridPane(); // Align to Center // Note Position is geometric object for alignment grid.setAlignment(Pos.CENTER); // Set gap between the components // Larger numbers mean bigger spaces grid.setHgap(10); grid.setVgap(10); // Create some text to place in the scene Text scenetitle =newText("Welcome. Login to continue."); // Add text to grid 0,0 span 2 columns, 1 row grid.add(scenetitle,0,0,2,1); // Create Label Label userName =newLabel("User Name:"); // Add label to grid 0,1 grid.add(userName,0,1); // Create Textfield TextField userTextField =newTextField();
  • 6. // Add textfield to grid 1,1 grid.add(userTextField,1,1); // Create Label Label pw =newLabel("Password:"); // Add label to grid 0,2 grid.add(pw,0,2); // Create Passwordfield PasswordField pwBox =newPasswordField(); // Add Password field to grid 1,2 grid.add(pwBox,1,2); // Create Login Button Button btn =newButton("Login"); // Add button to grid 1,4 grid.add(btn,1,4); finalText actiontarget =newText(); grid.add(actiontarget,1,6); // Set the Action when button is clicked btn.setOnAction(newEventHandler<ActionEvent>(){ @Override publicvoid handle(ActionEvent e){ // Authenticate the user boolean isValid = authenticate(userTextField.getText(), pwBox. getText()); // If valid clear the grid and Welcome the user if(isValid){ grid.setVisible(false); GridPane grid2 =newGridPane(); // Align to Center // Note Position is geometric object for alignment grid2.setAlignment(Pos.CENTER);
  • 7. // Set gap between the components // Larger numbers mean bigger spaces grid2.setHgap(10); grid2.setVgap(10); Text scenetitle =newText("Welcome "+ userTextField.getText() +"!"); // Add text to grid 0,0 span 2 columns, 1 row grid2.add(scenetitle,0,0,2,1); Scene scene =newScene(grid2,500,400); primaryStage.setScene(scene); primaryStage.show(); // If Invalid Ask user to try again }else{ finalText actiontarget =newText(); grid.add(actiontarget,1,6); actiontarget.setFill(Color.FIREBRICK); actiontarget.setText("Please try again."); } } }); // Set the size of Scene Scene scene =newScene(grid,500,400); primaryStage.setScene(scene); primaryStage.show(); } /** * @param args the command line arguments */ publicstaticvoid main(String[] args){ launch(args); } /** * @param user the username entered
  • 8. * @param pword the password entered * @return isValid true for authenticated */ publicboolean authenticate(String user,String pword){ boolean isValid =false; if(user.equalsIgnoreCase("servadmin") && pword.equals("foxtrot_1980")){ isValid =true; } return isValid; } } Use the attached file for this assignment! The following security controls need to 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.
  • 9. Pointers: 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. c. 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. 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 formatte