Confirmed users
195
edits
m (→Wallet/Satchel) |
(update per final changes) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 16: | Line 16: | ||
/** | /** | ||
* A object that hold authentication information. The caller of | * A object that hold authentication information. The caller of | ||
* promptUsernameAndPassword or promptPasswordAsync provides an object | * nsIAuthPrompt2::promptUsernameAndPassword or | ||
* | * nsIAuthPrompt2::promptPasswordAsync provides an object implementing this | ||
* interface; the prompt implementation can then read the values here to prefill | |||
* the dialog. After the user entered the authentication information, it should | |||
* set the attributes of this object to indicate to the caller what was entered | |||
* by the user. | |||
*/ | */ | ||
[scriptable, uuid(0d73639c-2a92-4518-9f92-28f71fea5f20)] | [scriptable, uuid(0d73639c-2a92-4518-9f92-28f71fea5f20)] | ||
Line 50: | Line 51: | ||
* for user jsmith at server intranet". | * for user jsmith at server intranet". | ||
* | * | ||
* This flag is mutually exclusive with NEED_DOMAIN. | * This flag is mutually exclusive with #NEED_DOMAIN. | ||
*/ | */ | ||
const PRUint32 ONLY_PASSWORD = 8; | const PRUint32 ONLY_PASSWORD = 8; | ||
Line 59: | Line 60: | ||
* above. | * above. | ||
* | * | ||
* It is possible that neither AUTH_HOST nor AUTH_PROXY are set. | * It is possible that neither #AUTH_HOST nor #AUTH_PROXY are set. | ||
* | * | ||
* Implementations should ignore flags they don't understand; especially, they | * Implementations should ignore flags they don't understand; especially, they | ||
Line 65: | Line 66: | ||
*/ | */ | ||
readonly attribute unsigned long flags; | readonly attribute unsigned long flags; | ||
/** | |||
* The server-supplied realm of the authentication as defined in RFC 2617. | |||
* Can be the empty string if the protocol does not support realms. | |||
* Otherwise, this is a human-readable string like "Secret files". | |||
*/ | |||
readonly attribute AString realm; | |||
/** | |||
* The authentication scheme used for this request, if applicable. If the | |||
* protocol for this authentication does not support schemes, this will be | |||
* the empty string. Otherwise, this will be a string such as "basic" or | |||
* "digest". This string will always be in lowercase. | |||
*/ | |||
readonly attribute AUTF8String authenticationScheme; | |||
/** | /** | ||
Line 72: | Line 88: | ||
* the user. | * the user. | ||
*/ | */ | ||
attribute AString | attribute AString username; | ||
/** | /** | ||
Line 87: | Line 103: | ||
* On return, this parameter should contain the domain entered by | * On return, this parameter should contain the domain entered by | ||
* the user. | * the user. | ||
* This attribute is only used if flags include | * This attribute is only used if flags include #NEED_DOMAIN. | ||
*/ | */ | ||
attribute AString domain; | attribute AString domain; | ||
Line 94: | Line 110: | ||
/** | /** | ||
* Interface for callback methods for the asynchronous nsIAuthPrompt2 method. | * Interface for callback methods for the asynchronous nsIAuthPrompt2 method. | ||
* Callers MUST call exactly one method if promptPasswordAsync | * Callers MUST call exactly one method if nsIAuthPrompt2::promptPasswordAsync | ||
* successfully. They MUST NOT call any method on this interface before | * returns successfully. They MUST NOT call any method on this interface before | ||
* promptPasswordAsync returns. | * promptPasswordAsync returns. | ||
*/ | */ | ||
Line 127: | Line 143: | ||
void onAuthCancelled(in nsISupports aContext, in boolean userCancel); | void onAuthCancelled(in nsISupports aContext, in boolean userCancel); | ||
}; | }; | ||
/** | /** | ||
Line 161: | Line 178: | ||
* @param aChannel | * @param aChannel | ||
* The channel that requires authentication. | * The channel that requires authentication. | ||
* @param level | * @param level | ||
* One of the level constants from above. See there for descriptions | * One of the level constants from above. See there for descriptions | ||
Line 182: | Line 196: | ||
* return value of false. | * return value of false. | ||
*/ | */ | ||
boolean | boolean promptAuth(in nsIChannel aChannel, | ||
in PRUint32 level, | |||
in nsIAuthInformation authInfo); | |||
/** | /** | ||
* Asynchronously prompt the user for a username and password. | * Asynchronously prompt the user for a username and password. | ||
* This has largely the same semantics as promptUsernameAndPassword, | * This has largely the same semantics as promptUsernameAndPassword(), | ||
* but must return immediately after calling and return the entered | * but must return immediately after calling and return the entered | ||
* data in a callback. | * data in a callback. | ||
* | * | ||
* If the user closes the dialog using a cancel button or similar, | * If the user closes the dialog using a cancel button or similar, | ||
* the callback's onAuthCancelled method must be called. | * the callback's nsIAuthPromptCallback::onAuthCancelled method must be | ||
* Calling cancel on the returned object SHOULD close the | * called. | ||
* and MUST call onAuthCancelled on the provided callback. | * Calling nsICancelable::cancel on the returned object SHOULD close the | ||
* dialog and MUST call nsIAuthPromptCallback::onAuthCancelled on the provided | |||
* callback. | |||
* | * | ||
* @throw NS_ERROR_NOT_IMPLEMENTED | * @throw NS_ERROR_NOT_IMPLEMENTED | ||
* Asynchronous authentication prompts are not supported; | * Asynchronous authentication prompts are not supported; | ||
* the caller should fall back to promptUsernameAndPassword | * the caller should fall back to promptUsernameAndPassword(). | ||
*/ | */ | ||
nsICancelable | nsICancelable asyncPromptAuth(in nsIChannel aChannel, | ||
in nsIAuthPromptCallback aCallback, | |||
in nsISupports aContext, | |||
in PRUint32 level, | |||
in nsIAuthInformation authInfo); | |||
}; | }; | ||
Line 219: | Line 234: | ||
* Use nsIRequest instead of nsIChannel? | * Use nsIRequest instead of nsIChannel? | ||
** SOCKS authentication on a raw socket might be a use case | ** SOCKS authentication on a raw socket might be a use case | ||
** But nsIRequest has no obvious place to get something remotely URI-like | |||
* The parameter lists are quite long; group some of the info together on an object? This object could be passed to both functions. | * The parameter lists are quite long; group some of the info together on an object? This object could be passed to both functions. | ||
** It would fix this error: ../../../../../mozilla/netwerk/base/public/nsIAuthPrompt2.idl:106: Error: [domstring], [utf8string], [cstring], [astring] types cannot be used as inout parameters | ** It would fix this error: ../../../../../mozilla/netwerk/base/public/nsIAuthPrompt2.idl:106: Error: [domstring], [utf8string], [cstring], [astring] types cannot be used as inout parameters | ||
Line 239: | Line 255: | ||
*/ | */ | ||
[scriptable, uuid(...)] | [scriptable, uuid(...)] | ||
interface | interface nsIPromptFactory | ||
{ | { | ||
/** | /** | ||
* Returns an object implementing | * Returns an object implementing the specified interface that creates | ||
* parented to aParent. | * prompts parented to aParent. | ||
*/ | */ | ||
void getPrompt(in nsIDOMWindow aParent, in nsIIDRef iid, | |||
[iid_is(iid),retval] out nsQIResult result); | |||
}; | }; | ||
This allows more flexibility than the current interface that wraps an nsIPrompt. | This allows more flexibility than the current interface that wraps an nsIPrompt. | ||
For actually adding the checkbox, nsIPromptService2 will need a method like promptUsernameAndPassword2Checkbox | For actually adding the checkbox, nsIPromptService2 will need a method like promptUsernameAndPassword2Checkbox (I decided on naming it promptAuth) |