2

I am using JSOUP for crawling on pages that are behind Kerberos. In JSoup I have to hardcode my ID and Password to gain access to the webpage and read the contents. I want to know a way by which I don’t have to hardcode the credentials but rather (somehow) redirect it to the user’s screen asking for login details. Here is the code I currently have.

String login = username + ":" + password;
final String base64login = new String(Base64.encodeBase64(login.getBytes()));
Document doc = Jsoup.connect(url).timeout(0).header("Authorization", "Basic " + base64login).get();
Yahoo
  • 4,093
  • 17
  • 59
  • 85

1 Answers1

0

If you're running from the commande line, you can do acheive your goal like this:

Console console = System.console();
String login = console.readLine("Login: ");
char[] password = console.readPassword("Password: ");
Stephan
  • 41,764
  • 65
  • 238
  • 329