nsISupports
Last changed in Gecko 1.9 (Firefox 3)This interface is usually acquired using getInterface on notification callbacks or similar. It can be used to prompt users for authentication information, either synchronously or asynchronously.
This interface is implemented by @mozilla.org/login-manager/prompter;1
. To create an instance, use:
var authPrompt2 = Components.classes["@mozilla.org/login-manager/prompter;1"]
.createInstance(Components.interfaces.nsIAuthPrompt2);
nsICancelable asyncPromptAuth(in nsIChannel aChannel, in nsIAuthPromptCallback aCallback, in nsISupports aContext, in PRUint32 level, in nsIAuthInformation authInfo); |
boolean promptAuth(in nsIChannel aChannel, in PRUint32 level, in nsIAuthInformation authInfo); |
Constant | Value | Description |
LEVEL_NONE |
0 |
The password will be sent unencrypted. No security provided. |
LEVEL_PW_ENCRYPTED |
1 |
Password will be sent encrypted, but the connection is otherwise insecure. |
LEVEL_SECURE |
2 |
The connection, both for password and data, is secure. |
Asynchronously prompt the user for a username and password. This has largely the same semantics as nsIAuthPrompt.promptUsernameAndPassword()
, but must return immediately after calling and return the entered data in a callback.
If the user closes the dialog using a cancel button or similar, the callback's nsIAuthPromptCallback.onAuthCancelled()
method must be called. Calling nsICancelable.cancel()
on the returned object should close the dialog and must call nsIAuthPromptCallback.onAuthCancelled()
on the provided callback.
This implementation may:
nsICancelable asyncPromptAuth( in nsIChannel aChannel, in nsIAuthPromptCallback aCallback, in nsISupports aContext, in PRUint32 level, in nsIAuthInformation authInfo );
aChannel
aCallback
aContext
level
authInfo
Requests a username and a password. Implementations will commonly show a dialog with a username and password field, depending on flags also a domain field.
false
.boolean promptAuth( in nsIChannel aChannel, in PRUint32 level, in nsIAuthInformation authInfo );
aChannel
level
authInfo
false
, authentication should be cancelled, usually because the user did not provide username/password. true
, authentication can proceed using the values in the authInfo object.