I'm using Spring Shell for a CLI and I want to read a password from the input line. For such purpose spring shell has jline, so using the official documentation [1] of jline it suggests the following:
public static void main(String[] args) throws IOException {
String password = new ConsoleReader().readLine('*');
System.out.println("My password is: "+password);
}
When starting the application it looks like this:
mysecretpassword << entered by myself
**************** << masking from jline
My password is: mysecretpassword << my output
So my question is what is the purpose of masking the password if it is shown anyway, when I type it? Is there a possibility to do it Unix style and don't even show the password, while typing it?
While you tagged your question with spring-shell, there is an open issue for support of masked (password) options.