summaryrefslogtreecommitdiffstats
path: root/toolkit/components/passwordmgr/nsILoginInfo.idl
blob: d1e8526b27f32dbe5e25df3c1ba6189732f91a00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#include "nsISupports.idl"

/**
 * An object containing information for a login stored by the
 * password manager.
 */
[scriptable, uuid(c41b7dff-6b9b-42fe-b78d-113051facb05)]
interface nsILoginInfo : nsISupports {
  /**
   * A string to display to the user for the origin which includes the httpRealm,
   * where applicable.
   * e.g. "site.com", "site.com:1234", or "site.com (My Secure Realm)"
   */
  readonly attribute AString displayOrigin;

  /**
   * The origin the login applies to.
   *
   * For example,
   * "https://site.com", "http://site.com:1234", "ftp://ftp.site.com",
   * "moz-proxy://127.0.0.1:8888, "chrome://FirefoxAccounts", "file://".
   */
  attribute AString origin;

  /**
   * The origin the login applies to, incorrectly called a hostname.
   * @deprecated in favor of `origin`
   */
  attribute AString hostname;

  /**
   * The origin a form-based login was submitted to.
   *
   * For logins obtained from HTML forms, this field is the origin of the |action|
   * attribute from the |form| element. For
   * example "http://www.site.com". [Forms with no |action| attribute
   * default to submitting to their origin URL, so we store that.]
   *
   * For logins obtained from a HTTP or FTP protocol authentication,
   * this field is NULL.
   */
  attribute AString formActionOrigin;

  /**
   * The origin a form-based login was submitted to, incorrectly referred to as a URL.
   * @deprecated in favor of `formActionOrigin`
   */
  attribute AString formSubmitURL;

  /**
   * The HTTP Realm a login was requested for.
   *
   * When an HTTP server sends a 401 result, the WWW-Authenticate
   * header includes a realm to identify the "protection space." See
   * RFC2617. If the response sent has a missing or blank realm, the
   * hostname is used instead.
   *
   * For logins obtained from HTML forms, this field is NULL.
   */
  attribute AString httpRealm;

  /**
   * The username for the login.
   */
  attribute AString username;

  /**
   * The |name| attribute for the username input field.
   *
   * For logins obtained from a HTTP or FTP protocol authentication,
   * this field is an empty string.
   *
   * @note This attribute is currently saved but not used.
   */
  attribute AString usernameField;

  /**
   * The password for the login.
   */
  attribute AString password;

  /**
   * The |name| attribute for the password input field.
   *
   * For logins obtained from a HTTP or FTP protocol authentication,
   * this field is an empty string.
   *
   * @note This attribute is currently saved but not used.
   */
  attribute AString passwordField;

  /**
   * Unknown fields this client doesn't know about but will be roundtripped
   * for other clients to prevent data loss
   */
  attribute AString unknownFields;

  /**
   * True if the login has ever been synced at some point.
   */
  attribute boolean everSynced;

  /**
   * A counter used to indicate that syncing is occuring. It will get restored to 0
   * once syncing is complete.
   */
  attribute long syncCounter;

  /**
   * Initialize a newly created nsLoginInfo object.
   *
   * The arguments are the fields for the new object.
   */
  void init(in AString aOrigin,
            in AString aFormActionOrigin, in AString aHttpRealm,
            in AString aUsername,      in AString aPassword,
            [optional] in AString aUsernameField, [optional] in AString aPasswordField);

  /**
   * Test for strict equality with another nsILoginInfo object.
   *
   * @param aLoginInfo
   *        The other object to test.
   */
  boolean equals(in nsILoginInfo aLoginInfo);

  /**
   * Test for loose equivalency with another nsILoginInfo object. The
   * passwordField and usernameField values are ignored, and the password
   * values may be optionally ignored. If one login's formSubmitURL is an
   * empty string (but not null), it will be treated as a wildcard. [The
   * blank value indicates the login was stored before bug 360493 was fixed.]
   *
   * @param aLoginInfo
   *        The other object to test.
   * @param ignorePassword
   *        If true, ignore the password when checking for match.
   */
  boolean matches(in nsILoginInfo aLoginInfo, in boolean ignorePassword);

  /**
   * Create an identical copy of the login, duplicating all of the login's
   * nsILoginInfo and nsILoginMetaInfo properties.
   *
   * This allows code to be forwards-compatible, when additional properties
   * are added to nsILoginMetaInfo (or nsILoginInfo) in the future.
   */
  nsILoginInfo clone();
};