Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsISupports.idl" |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * A object that hold authentication information. The caller of |
michael@0 | 9 | * nsIAuthPrompt2::promptUsernameAndPassword or |
michael@0 | 10 | * nsIAuthPrompt2::promptPasswordAsync provides an object implementing this |
michael@0 | 11 | * interface; the prompt implementation can then read the values here to prefill |
michael@0 | 12 | * the dialog. After the user entered the authentication information, it should |
michael@0 | 13 | * set the attributes of this object to indicate to the caller what was entered |
michael@0 | 14 | * by the user. |
michael@0 | 15 | */ |
michael@0 | 16 | [scriptable, uuid(0d73639c-2a92-4518-9f92-28f71fea5f20)] |
michael@0 | 17 | interface nsIAuthInformation : nsISupports |
michael@0 | 18 | { |
michael@0 | 19 | /** @name Flags */ |
michael@0 | 20 | /* @{ */ |
michael@0 | 21 | /** |
michael@0 | 22 | * This dialog belongs to a network host. |
michael@0 | 23 | */ |
michael@0 | 24 | const uint32_t AUTH_HOST = 1; |
michael@0 | 25 | |
michael@0 | 26 | /** |
michael@0 | 27 | * This dialog belongs to a proxy. |
michael@0 | 28 | */ |
michael@0 | 29 | const uint32_t AUTH_PROXY = 2; |
michael@0 | 30 | |
michael@0 | 31 | /** |
michael@0 | 32 | * This dialog needs domain information. The user interface should show a |
michael@0 | 33 | * domain field, prefilled with the domain attribute's value. |
michael@0 | 34 | */ |
michael@0 | 35 | const uint32_t NEED_DOMAIN = 4; |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * This dialog only asks for password information. Authentication prompts |
michael@0 | 39 | * SHOULD NOT show a username field. Attempts to change the username field |
michael@0 | 40 | * will have no effect. nsIAuthPrompt2 implementations should, however, show |
michael@0 | 41 | * its initial value to the user in some form. For example, a paragraph in |
michael@0 | 42 | * the dialog might say "Please enter your password for user jsmith at |
michael@0 | 43 | * server intranet". |
michael@0 | 44 | * |
michael@0 | 45 | * This flag is mutually exclusive with #NEED_DOMAIN. |
michael@0 | 46 | */ |
michael@0 | 47 | const uint32_t ONLY_PASSWORD = 8; |
michael@0 | 48 | |
michael@0 | 49 | /** |
michael@0 | 50 | * We have already tried to log in for this channel |
michael@0 | 51 | * (with auth values from a previous promptAuth call), |
michael@0 | 52 | * but it failed, so we now ask the user to provide a new, correct login. |
michael@0 | 53 | * |
michael@0 | 54 | * @see also RFC 2616, Section 10.4.2 |
michael@0 | 55 | */ |
michael@0 | 56 | const uint32_t PREVIOUS_FAILED = 16; |
michael@0 | 57 | /* @} */ |
michael@0 | 58 | |
michael@0 | 59 | /** |
michael@0 | 60 | * Flags describing this dialog. A bitwise OR of the flag values |
michael@0 | 61 | * above. |
michael@0 | 62 | * |
michael@0 | 63 | * It is possible that neither #AUTH_HOST nor #AUTH_PROXY are set. |
michael@0 | 64 | * |
michael@0 | 65 | * Auth prompts should ignore flags they don't understand; especially, they |
michael@0 | 66 | * should not throw an exception because of an unsupported flag. |
michael@0 | 67 | */ |
michael@0 | 68 | readonly attribute unsigned long flags; |
michael@0 | 69 | |
michael@0 | 70 | /** |
michael@0 | 71 | * The server-supplied realm of the authentication as defined in RFC 2617. |
michael@0 | 72 | * Can be the empty string if the protocol does not support realms. |
michael@0 | 73 | * Otherwise, this is a human-readable string like "Secret files". |
michael@0 | 74 | */ |
michael@0 | 75 | readonly attribute AString realm; |
michael@0 | 76 | |
michael@0 | 77 | /** |
michael@0 | 78 | * The authentication scheme used for this request, if applicable. If the |
michael@0 | 79 | * protocol for this authentication does not support schemes, this will be |
michael@0 | 80 | * the empty string. Otherwise, this will be a string such as "basic" or |
michael@0 | 81 | * "digest". This string will always be in lowercase. |
michael@0 | 82 | */ |
michael@0 | 83 | readonly attribute AUTF8String authenticationScheme; |
michael@0 | 84 | |
michael@0 | 85 | /** |
michael@0 | 86 | * The initial value should be used to prefill the dialog or be shown |
michael@0 | 87 | * in some other way to the user. |
michael@0 | 88 | * On return, this parameter should contain the username entered by |
michael@0 | 89 | * the user. |
michael@0 | 90 | * This field can only be changed if the #ONLY_PASSWORD flag is not set. |
michael@0 | 91 | */ |
michael@0 | 92 | attribute AString username; |
michael@0 | 93 | |
michael@0 | 94 | /** |
michael@0 | 95 | * The initial value should be used to prefill the dialog or be shown |
michael@0 | 96 | * in some other way to the user. |
michael@0 | 97 | * The password should not be shown in clear. |
michael@0 | 98 | * On return, this parameter should contain the password entered by |
michael@0 | 99 | * the user. |
michael@0 | 100 | */ |
michael@0 | 101 | attribute AString password; |
michael@0 | 102 | |
michael@0 | 103 | /** |
michael@0 | 104 | * The initial value should be used to prefill the dialog or be shown |
michael@0 | 105 | * in some other way to the user. |
michael@0 | 106 | * On return, this parameter should contain the domain entered by |
michael@0 | 107 | * the user. |
michael@0 | 108 | * This attribute is only used if flags include #NEED_DOMAIN. |
michael@0 | 109 | */ |
michael@0 | 110 | attribute AString domain; |
michael@0 | 111 | }; |
michael@0 | 112 |