1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
10 [scriptable
, uuid(358089f9
-ee4b
-4711-82fd
-bcd07fc62061
)]
11 interface nsIAuthPrompt
: nsISupports
13 const uint32_t SAVE_PASSWORD_NEVER
= 0;
14 const uint32_t SAVE_PASSWORD_FOR_SESSION
= 1;
15 const uint32_t SAVE_PASSWORD_PERMANENTLY
= 2;
18 * Puts up a text input dialog with OK and Cancel buttons.
19 * Note: prompt uses separate args for the "in" and "out" values of the
20 * input field, whereas the other functions use a single inout arg.
21 * @param dialogText The title for the dialog.
22 * @param text The text to display in the dialog.
23 * @param passwordRealm The "realm" the password belongs to: e.g.
24 * ldap://localhost/dc=test
25 * @param savePassword One of the SAVE_PASSWORD_* options above.
26 * @param defaultText The default text to display in the text input box.
27 * @param result The value entered by the user if OK was
29 * @return true for OK, false for Cancel
31 boolean prompt
(in wstring dialogTitle
,
33 in wstring passwordRealm
,
34 in uint32_t savePassword
,
35 in wstring defaultText
,
39 * Puts up a username/password dialog with OK and Cancel buttons.
40 * @param dialogText The title for the dialog.
41 * @param text The text to display in the dialog.
42 * @param passwordRealm The "realm" the password belongs to: e.g.
43 * ldap://localhost/dc=test
44 * @param savePassword One of the SAVE_PASSWORD_* options above.
45 * @param user The username entered in the dialog.
46 * @param pwd The password entered by the user if OK was
48 * @return true for OK, false for Cancel
50 boolean promptUsernameAndPassword
(in wstring dialogTitle
,
52 in wstring passwordRealm
,
53 in uint32_t savePassword
,
58 * Puts up an async username/password dialog with OK and Cancel buttons.
59 * @param dialogText The title for the dialog.
60 * @param text The text to display in the dialog.
61 * @param passwordRealm The "realm" the password belongs to: e.g.
62 * ldap://localhost/dc=test
63 * @param savePassword One of the SAVE_PASSWORD_* options above.
64 * @param user The username entered in the dialog.
65 * @param pwd The password entered by the user if OK was
67 * @return promise resolving to true for OK, false for Cancel
69 Promise asyncPromptUsernameAndPassword
(in wstring dialogTitle
,
71 in wstring passwordRealm
,
72 in uint32_t savePassword
,
77 * Puts up a password dialog with OK and Cancel buttons.
78 * @param dialogText The title for the dialog.
79 * @param text The text to display in the dialog.
80 * @param passwordRealm The "realm" the password belongs to: e.g.
81 * ldap://localhost/dc=test. If a username is
82 * specified (http://user@site.com) it will be used
83 * when matching existing logins or saving new ones.
84 * If no username is specified, only password-only
85 * logins will be matched or saved.
86 * Note: if a username is specified, the username
88 * @param savePassword One of the SAVE_PASSWORD_* options above.
89 * @param pwd The password entered by the user if OK was
91 * @return true for OK, false for Cancel
93 boolean promptPassword
(in wstring dialogTitle
,
95 in wstring passwordRealm
,
96 in uint32_t savePassword
,
100 * Puts up an async password dialog with OK and Cancel buttons.
101 * @param dialogText The title for the dialog.
102 * @param text The text to display in the dialog.
103 * @param passwordRealm The "realm" the password belongs to: e.g.
104 * ldap://localhost/dc=test. If a username is
105 * specified (http://user@site.com) it will be used
106 * when matching existing logins or saving new ones.
107 * If no username is specified, only password-only
108 * logins will be matched or saved.
109 * Note: if a username is specified, the username
111 * @param savePassword One of the SAVE_PASSWORD_* options above.
112 * @param pwd The password entered by the user if OK was
114 * @return promise resolving to true for OK, false for Cancel
116 Promise asyncPromptPassword
(in wstring dialogTitle
,
118 in wstring passwordRealm
,
119 in uint32_t savePassword
,