|
|
@ -17,6 +17,13 @@ public class Vault implements VaultInterface { |
|
|
|
public boolean isInt = false; |
|
|
|
InputStream inputS = System.in; |
|
|
|
OutputStream outputS = System.out; |
|
|
|
private CredentialRepository credentialRepository = new CredentialRepository(); |
|
|
|
|
|
|
|
public static void main (String args[]) { |
|
|
|
Vault vault = new Vault(); |
|
|
|
vault.credentialMenu(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void println(String output) { |
|
|
|
try { |
|
|
@ -74,15 +81,8 @@ public class Vault implements VaultInterface { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void addCredential(){ |
|
|
|
Scanner scan = new Scanner(inputS); |
|
|
|
println("Type in username"); |
|
|
|
userName = scan.nextLine(); |
|
|
|
|
|
|
|
println("Type in password"); |
|
|
|
password = scan.nextLine(); |
|
|
|
//createNewCredential(userName, password); |
|
|
|
|
|
|
|
public void addCredential(String userName, String password){ |
|
|
|
credentialRepository.createNewCredential(userName, password); |
|
|
|
} |
|
|
|
|
|
|
|
public void showCredential(){ |
|
|
@ -93,10 +93,10 @@ public class Vault implements VaultInterface { |
|
|
|
|
|
|
|
if(str.matches("[0-9]+")) { |
|
|
|
isInt = true; |
|
|
|
//getCredentialsViaId(Integer.parseInt(str)); |
|
|
|
credentialRepository.getCredentialsViaId(Integer.parseInt(str)); |
|
|
|
} else { |
|
|
|
isInt = false; |
|
|
|
//getCredentialsViaName(str); |
|
|
|
credentialRepository.getCredentialsViaName(str); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@ -158,12 +158,19 @@ public class Vault implements VaultInterface { |
|
|
|
|
|
|
|
String input = scan.nextLine(); |
|
|
|
|
|
|
|
|
|
|
|
if (input.equals("e")) { |
|
|
|
credentialM = false; |
|
|
|
} else if (input.equals("a")) { |
|
|
|
println("Type username:"); |
|
|
|
println("Type in username"); |
|
|
|
userName = scan.nextLine(); |
|
|
|
|
|
|
|
println("Type in password"); |
|
|
|
password = scan.nextLine(); |
|
|
|
addCredential(userName, password); |
|
|
|
} else if (input.equals("c")) { |
|
|
|
println("Type username or ID to show credential:"); |
|
|
|
//println("Type username or ID to show credential:"); |
|
|
|
showCredential(); |
|
|
|
} else if (input.equals("l")) { |
|
|
|
println("Type username or ID to select credential:"); |
|
|
|
} |
|
|
|