nsILoginInfo

nsILoginInfo is an object containing information for a login stored by the Login Manager.

To create and manage logins use nsILoginManager.

Please add a summary to this article.
Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)

Inherits from: nsISupports

Implemented by: @mozilla.org/login-manager/loginInfo;1. To create an instance, use:

var loginInfo = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
                .createInstance(Components.interfaces.nsILoginInfo);

Method overview

nsILoginInfo clone();
boolean equals(in nsILoginInfo aLoginInfo);
void init(in AString aHostname, in AString aFormSubmitURL, in AString aHttpRealm, in AString aUsername, in AString aPassword, in AString aUsernameField, in AString aPasswordField);
boolean matches(in nsILoginInfo aLoginInfo, in boolean ignorePassword);

Attributes

Attribute Type Description
formSubmitURL AString The origin, not URL, a form-based login was submitted to. For logins obtained from HTML forms, this field is the action attribute from the form element, with the path removed (for example, "https://www.site.com"). Forms with no action attribute default to submitting to their origin URL, so that is stored here. This field is null for logins attained from protocol authentications and "" means to match against any form action.
hostname AString The origin, not hostname, to which the login applies (for example, "https://www.site.com"). A port number (":123") may be appended.
httpRealm AString The HTTP Realm for which the login was requested. When an HTTP server sends a 401 result, the WWW-Authenticate header includes a realm to identify the "protection space." See RFC 2617. If the result did not include a realm, or it was blank, the hostname is used instead. For logins obtained from HTML forms, this field is null.
password AString The password for the login.
passwordField AString The name attribute for the password input in a form. Non-form logins should specify an empty string ("").
username AString The username for the login.
usernameField AString The name attribute for the username input in a form. Non-form logins should specify an empty string ("").

Methods

clone()

Returns a clone of this login.

nsILoginInfo clone();
Parameters

None.

Return value

An nsILoginInfo containing a clone of the login on which this method was invoked.

equals()

Tests to determine whether this login is exactly equal to another nsILoginInfo object.

boolean equals(
  in nsILoginInfo aLoginInfo
);
Parameters
aLoginInfo
The login to which to compare for equality.
Return value

true if the two logins are exactly equal or false if they're not.

init()

Initializes a newly created nsILoginInfo object.

void init(
  in AString aHostname,
  in AString aFormSubmitURL,
  in AString aHttpRealm,
  in AString aUsername,
  in AString aPassword,
  in AString aUsernameField,
  in AString aPasswordField
);
Parameters
aHostname
The value to assign to the hostname field.
aFormSubmitURL
The value to assign to the formSubmitURL field.
aHttpRealm
The value to assign to the httpRealm field.
aUsername
The value to assign to the username field.
aPassword
The value to assign to the password field.
aUsernameField
The value to assign to the usernameField field.
aPasswordField
The value to assign to the passwordField field.

matches()

Tests to determine whether this login is loosely equivalent to 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.

A blank value indicates the login was stored before bug 360493 was fixed.

boolean matches(
  in nsILoginInfo aLoginInfo,
  in boolean ignorePassword
);
Parameters
aLoginInfo
The login to which to compare for equality.
ignorePassword
If true, do not examine the password value when matching.
Return value

true if the two logins are equivilant or false if they're not.

See also