-
Notifications
You must be signed in to change notification settings - Fork 1
/
Security.java
59 lines (53 loc) · 1.98 KB
/
Security.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import java.util.*;
//Checks the security options that the user wants
public class Security {
//Fields used for the security object
public static Boolean confidentiality;
public static Boolean integrity;
public static Boolean authentication;
public Security() {
checkUserInput();
}
//Deals with users inputs and sets the respective field values
public static void checkUserInput() {
// Prompt user to enable/disable security properties
Scanner reader = new Scanner(System.in);
String c, i, a;
System.out.println("Require confidentiality? (y or n)");
while (true) {
c = reader.nextLine();
if (c.equals("y")) {
confidentiality = true;
break;
} else if (c.equals("n")) {
confidentiality = false;
break;
}
System.out.println("Invalid input, try again.");
}
System.out.println("Require integrity? (y or n)");
while (true) {
i = reader.nextLine();
if (i.equals("y")) {
integrity = true;
break;
} else if (i.equals("n")) {
integrity = false;
break;
}
System.out.println("Invalid input, try again.");
}
System.out.println("Require authentication? (y or n)");
while (true) {
a = reader.nextLine();
if (a.equals("y")) {
authentication = true;
break;
} else if (a.equals("n")) {
authentication = false;
break;
}
System.out.println("Invalid input, try again.");
}
}
}