Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. package javasecurity;
  2.  
  3. import java.io.Console;
  4. import java.io.IOException;
  5.  
  6. /**
  7. *
  8. * @author ObiTo
  9. */
  10. public class JavaSecurity {
  11. public static void main (String args[]) throws IOException {
  12. Console c = System.console();
  13. if (c == null) {
  14. System.err.println("No console.");
  15. System.exit(1);
  16. }
  17. String username = c.readLine("Enter your user name: ");
  18. String password = c.readLine("Enter your password: ");
  19. if (!verify(username, password)) {
  20. throw new SecurityException("Invalid Credentials");
  21. }
  22. }
  23. private static boolean verify(String username, String password) {
  24. return true;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement