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