org.apache.subversion.javahl.callback
Interface UserPasswordCallback


public interface UserPasswordCallback

The interface for requesting authentication credentials from the user. Should the javahl bindings need the matching information, these methodes will be called.

This callback can also be used to provide the equivalent of the --no-auth-cache and --non-interactive arguments accepted by the command-line client.


Field Summary
static int AcceptPermanently
          Accept the connection to the server forever.
static int AcceptTemporary
          Accept the connection to the server once.
static int Reject
          Reject the connection to the server.
 
Method Summary
 String askQuestion(String realm, String question, boolean showAnswer)
          ask the user a question where she answers with a text.
 String askQuestion(String realm, String question, boolean showAnswer, boolean maySave)
          Ask the user a question, and (usually) store the auth credential caching preference specified by maySave (used by userAllowedSave()).
 int askTrustSSLServer(String info, boolean allowPermanently)
          If there are problems with the certifcate of the SSL-server, this callback will be used to deside if the connection will be used.
 boolean askYesNo(String realm, String question, boolean yesIsDefault)
          ask the user a yes/no question
 String getPassword()
          retrieve the password entered during the prompt call
 String getUsername()
          retrieve the username entered during the prompt call
 boolean prompt(String realm, String username)
          Ask the user for username and password The entered username/password is retrieved by the getUsername getPasswort methods.
 boolean prompt(String realm, String username, boolean maySave)
          Request a user name and password from the user, and (usually) store the auth credential caching preference specified by maySave (used by userAllowedSave()).
 boolean userAllowedSave()
           
 

Field Detail

Reject

static final int Reject
Reject the connection to the server.

See Also:
Constant Field Values

AcceptTemporary

static final int AcceptTemporary
Accept the connection to the server once.

See Also:
Constant Field Values

AcceptPermanently

static final int AcceptPermanently
Accept the connection to the server forever.

See Also:
Constant Field Values
Method Detail

askTrustSSLServer

int askTrustSSLServer(String info,
                      boolean allowPermanently)
If there are problems with the certifcate of the SSL-server, this callback will be used to deside if the connection will be used.

Parameters:
info - the probblems with the certificate.
allowPermanently - if AcceptPermantly is a legal answer
Returns:
one of Reject/AcceptTemporary/AcceptPermanently

prompt

boolean prompt(String realm,
               String username)
Ask the user for username and password The entered username/password is retrieved by the getUsername getPasswort methods.

Parameters:
realm - for which server realm this information is requested.
username - the default username
Returns:
Whether the prompt for authentication credentials was successful (e.g. in a GUI application whether the dialog box was canceled).

askYesNo

boolean askYesNo(String realm,
                 String question,
                 boolean yesIsDefault)
ask the user a yes/no question

Parameters:
realm - for which server realm this information is requested.
question - question to be asked
yesIsDefault - if yes should be the default
Returns:
the answer

askQuestion

String askQuestion(String realm,
                   String question,
                   boolean showAnswer)
ask the user a question where she answers with a text.

Parameters:
realm - for which server realm this information is requested.
question - question to be asked
showAnswer - if the answer is shown or hidden
Returns:
the entered text or null if canceled

getUsername

String getUsername()
retrieve the username entered during the prompt call

Returns:
the username

getPassword

String getPassword()
retrieve the password entered during the prompt call

Returns:
the password

prompt

boolean prompt(String realm,
               String username,
               boolean maySave)
Request a user name and password from the user, and (usually) store the auth credential caching preference specified by maySave (used by userAllowedSave()). Applications wanting to emulate the behavior of --non-interactive will implement this method in a manner which does not require user interaction (e.g. a no-op which assumes pre-cached auth credentials).

Parameters:
realm - The realm from which the question originates.
username - The name of the user in realm.
maySave - Whether caching of credentials is allowed. Usually affects the return value of the userAllowedSave() method.
Returns:
Whether the prompt for authentication credentials was successful (e.g. in a GUI application whether the dialog box was canceled).

askQuestion

String askQuestion(String realm,
                   String question,
                   boolean showAnswer,
                   boolean maySave)
Ask the user a question, and (usually) store the auth credential caching preference specified by maySave (used by userAllowedSave()). Applications wanting to emulate the behavior of --non-interactive will implement this method in a manner which does not require user interaction (e.g. a no-op).

Parameters:
realm - The realm from which the question originates.
question - The text of the question.
showAnswer - Whether the answer may be displayed.
maySave - Whether caching of credentials is allowed. Usually affects the return value of the userAllowedSave() method.
Returns:
answer as entered or null if canceled

userAllowedSave

boolean userAllowedSave()
Returns:
Whether the caller allowed caching of credentials the last time prompt(String, String, boolean) was called. Applications wanting to emulate the behavior of --no-auth-cache will probably always return false.