Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javasecurity;
- import java.io.Console;
- import java.io.IOException;
- /**
- *
- * @author ObiTo
- */
- public class JavaSecurity {
- public static void main (String args[]) throws IOException {
- Console c = System.console();
- if (c == null) {
- System.err.println("No console.");
- System.exit(1);
- }
- String username = c.readLine("Enter your user name: ");
- String password = c.readLine("Enter your password: ");
- if (!verify(username, password)) {
- throw new SecurityException("Invalid Credentials");
- }
- }
- private static boolean verify(String username, String password) {
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement