1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Original Code is mozilla.org Necko code.
16 * The Initial Developer of the Original Code is
17 * Christian Biesinger <cbiesinger@web.de>.
18 * Portions created by the Initial Developer are Copyright (C) 2006
19 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include
"nsISupports.idl"
40 interface nsIAuthPromptCallback
;
42 interface nsICancelable
;
43 interface nsIAuthInformation
;
46 * An interface allowing to prompt for a username and password. This interface
47 * is usually acquired using getInterface on notification callbacks or similar.
48 * It can be used to prompt users for authentication information, either
49 * synchronously or asynchronously.
51 [scriptable
, uuid(447fc780
-1d28
-412a
-91a1
-466d48129c65
)]
52 interface nsIAuthPrompt2
: nsISupports
54 /** @name Security Levels */
57 * The password will be sent unencrypted. No security provided.
59 const PRUint32 LEVEL_NONE
= 0;
61 * Password will be sent encrypted, but the connection is otherwise
64 const PRUint32 LEVEL_PW_ENCRYPTED
= 1;
66 * The connection, both for password and data, is secure.
68 const PRUint32 LEVEL_SECURE
= 2;
72 * Requests a username and a password. Implementations will commonly show a
73 * dialog with a username and password field, depending on flags also a
77 * The channel that requires authentication.
79 * One of the level constants from above. See there for descriptions
82 * Authentication information object. The implementation should fill in
83 * this object with the information entered by the user before
87 * Authentication can proceed using the values in the authInfo
90 * Authentication should be cancelled, usually because the user did
91 * not provide username/password.
93 * @note Exceptions thrown from this function will be treated like a
94 * return value of false.
96 boolean promptAuth
(in nsIChannel aChannel
,
98 in nsIAuthInformation authInfo
);
101 * Asynchronously prompt the user for a username and password.
102 * This has largely the same semantics as promptUsernameAndPassword(),
103 * but must return immediately after calling and return the entered
104 * data in a callback.
106 * If the user closes the dialog using a cancel button or similar,
107 * the callback's nsIAuthPromptCallback::onAuthCancelled method must be
109 * Calling nsICancelable::cancel on the returned object SHOULD close the
110 * dialog and MUST call nsIAuthPromptCallback::onAuthCancelled on the provided
113 * @throw NS_ERROR_NOT_IMPLEMENTED
114 * Asynchronous authentication prompts are not supported;
115 * the caller should fall back to promptUsernameAndPassword().
117 nsICancelable asyncPromptAuth
(in nsIChannel aChannel
,
118 in nsIAuthPromptCallback aCallback
,
119 in nsISupports aContext
,
121 in nsIAuthInformation authInfo
);