1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 *
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/
8 *
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
12 * License.
13 *
14 * The Original Code is mozilla.org code.
15 *
16 * The Initial Developer of the Original Code is Mozilla Corporation.
17 * Portions created by the Initial Developer are Copyright (C) 2007
18 * the Initial Developer. All Rights Reserved.
19 *
20 * Contributor(s):
21 * Justin Dolske <dolske@mozilla.com> (original author)
22 *
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
34 *
35 * ***** END LICENSE BLOCK ***** */
36
37
38 #include "nsISupports.idl"
39
40 [scriptable, uuid(9c87a9bd-bf8b-4fae-bdb8-70513b2877df)]
41
42 /**
43 * An object containing information for a login stored by the
44 * password manager.
45 */
46 interface nsILoginInfo : nsISupports {
47 /**
48 * The hostname the login applies to.
49 *
50 * The hostname should be formatted as an URL. For example,
51 * "https://site.com", "http://site.com:1234", "ftp://ftp.site.com".
52 */
53 attribute AString hostname;
54
55 /**
56 * The URL a form-based login was submitted to.
57 *
58 * For logins obtained from HTML forms, this field is the |action|
59 * attribute from the |form| element, with the path removed. For
60 * example "http://www.site.com". [Forms with no |action| attribute
61 * default to submitting to their origin URL, so we store that.]
62 *
63 * For logins obtained from a HTTP or FTP protocol authentication,
64 * this field is NULL.
65 */
66 attribute AString formSubmitURL;
67
68 /**
69 * The HTTP Realm a login was requested for.
70 *
71 * When an HTTP server sends a 401 result, the WWW-Authenticate
72 * header includes a realm to identify the "protection space." See
73 * RFC2617. If the response sent has a missing or blank realm, the
74 * hostname is used instead.
75 *
76 * For logins obtained from HTML forms, this field is NULL.
77 */
78 attribute AString httpRealm;
79
80 /**
81 * The username for the login.
82 */
83 attribute AString username;
84
85 /**
86 * The |name| attribute for the username input field.
87 *
88 * For logins obtained from a HTTP or FTP protocol authentication,
89 * this field is NULL.
90 */
91 attribute AString usernameField;
92
93 /**
94 * The password for the login.
95 */
96 attribute AString password;
97
98 /**
99 * The |name| attribute for the password input field.
100 *
101 * For logins obtained from a HTTP or FTP protocol authentication,
102 * this field is NULL.
103 */
104 attribute AString passwordField;
105
106 /**
107 * Initialize a newly created nsLoginInfo object.
108 *
109 * The arguments are the fields for the new object.
110 */
111 void init(in AString aHostname,
112 in AString aFormSubmitURL, in AString aHttpRealm,
113 in AString aUsername, in AString aPassword,
114 in AString aUsernameField, in AString aPasswordField);
115
116 /**
117 * Test for strict equality with another nsILoginInfo object.
118 *
119 * @param aLoginInfo
120 * The other object to test.
121 */
122 boolean equals(in nsILoginInfo aLoginInfo);
123
124 /**
125 * Test for loose equivalency with another nsILoginInfo object. The
126 * passwordField and usernameField values are ignored, and the password
127 * values may be optionally ignored. If one login's formSubmitURL is an
128 * empty string (but not null), it will be treated as a wildcard. [The
129 * blank value indicates the login was stored before bug 360493 was fixed.]
130 *
131 * @param aLoginInfo
132 * The other object to test.
133 * @param ignorePassword
134 * If true, ignore the password when checking for match.
135 */
136 boolean matches(in nsILoginInfo aLoginInfo, in boolean ignorePassword);
137 };
138
139 %{C++
140
141 #define NS_LOGININFO_CONTRACTID "@mozilla.org/login-manager/loginInfo;1"
142
143 %}