PasswordAuthentication

I wanted to try and add some sort of password authentication to some code I have but im not sure how the user name and password is requested. There is a PasswordAuthentication class that holds a user name as a string and a password as a character array. Now the Authenticator class has some methods that return an instance of a PasswordAuthentication class which I am asuming is initialized with the user name and password but by what means is the user name and password requested?

Here is one of the methods within the Authenticator class that returns a PasswordAuthentication instance.

PasswordAuthentication requestPasswordAuthentication(InetAddress addr,int port, String protocol, String prompt, String scheme)

What is the prompt and scheme? Thanks.

[812 byte] By [BouncingSoula] at [2007-10-1 23:18:09]
# 1

are you trying to do password authentication over HTTP?

that's really what the Authenticator class is designed for. if you're doing generic username/password gathering, the javax.security.auth.callback.CallbackHandler (and corresponding Name/PasswordCallback classes) may be more appropriate.

the prompt for Authenticator is intended to be displayed to the user to give them some contextual information for what username/password is being requested. scheme is the HTTP authentication scheme, like basic or digest.

charlie.laia at 2007-7-15 14:05:47 > top of Java-index,Security,Other Security APIs, Tools, and Issues...