CLI 용 Spring Shell을 사용하고 있으며 입력 행에서 암호를 읽고 싶습니다. 이러한 목적 스프링 쉘의 는 jline을 가지고, 그래서 공식 문서를 사용하여 [1] jline의 다음과 같은 제안 :JLine으로 비밀번호를 완전히 마스킹 할 수 있습니까?
mysecretpassword << entered by myself
**************** << masking from jline
My password is: mysecretpassword << my output
그래서 내 질문 : 그것은 다음과 같습니다 응용 프로그램을 시작할 때
public static void main(String[] args) throws IOException {
String password = new ConsoleReader().readLine('*');
System.out.println("My password is: "+password);
}
암호를 입력 할 때 표시되는 경우 암호를 마스킹하는 목적은 무엇입니까? 유닉스 스타일을 할 가능성이 있으며 타이핑 할 때 암호를 보여주지 않습니까?
[1] http://jline.sourceforge.net/#installation
감사 (
UserInput.prompt()
참조). –