+ throw new IllegalStateException("Cannot verify auth", e);
+ }
+ }
+
+ public static char[] readPassword() {
+ Console console = System.console();
+ if (console == null) {// IDE
+ System.out.print("Password: ");
+ try (Scanner s = new Scanner(System.in)) {
+ String password = s.next();
+ return password.toCharArray();
+ }
+ } else {
+ console.printf("Password: ");
+ char[] pwd = console.readPassword();
+ return pwd;