Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsILoginManager

このページは翻訳中です。
翻訳作業に参加する場合は、履歴にある翻訳者と連絡·調整してください。

nsIPasswordManager に替わり Firefox 3 では nsILoginManager がパスワードマネージャーのインターフェイスとして使われます。

使用例については Using nsILoginManager をご覧ください。


Please add a summary to this article.
  最終更新: Gecko 1.9 (Firefox 3)

Inherits from: nsILoginManager

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

var loginManager = Components.classes["@mozilla.org/login-manager;1"]
                   .getService(Components.interfaces.nsILoginManager);

Method overview

void addLogin(in nsILoginInfo aLogin);
void removeLogin(in nsILoginInfo aLogin);
void modifyLogin(in nsILoginInfo oldLogin, in nsILoginInfo newLogin);
void removeAllLogins();
void getAllLogins(out unsigned long count, [retval, array, size_is(count)] out nsILoginInfo logins);
void getAllDisabledHosts(out unsigned long count, [retval, array, size_is(count)] out wstring hostnames);
boolean getLoginSavingEnabled(in AString aHost);
void setLoginSavingEnabled(in AString aHost, in boolean isEnabled);
void findLogins(out unsigned long count, in AString aHostname, in AString aActionURL, in AString aHttpRealm, [retval, array, size_is(count)] out nsILoginInfo logins);
unsigned long countLogins(in AString aHostName, in AString aActionURL, in AString aHttpRealm,);
nsIAutoCompleteResult autoCompleteSearch(in AString aSearchString, in nsIAutoCompleteResult aPreviousResult, in nsIDOMHTMLInputElement aElement);

メソッド

addLogin()

新しいログイン情報をログインマネージャーに保存します。

 void addLogin(
   in nsILoginInfo aLogin
 );
Parameters
aLogin
The login to store.

removeLogin()

ログインマネージャーからログイン情報を削除します。

 void removeLogin(
   in nsILoginInfo aLogin
 );
Parameters
aLogin
The login to remove from the Login Manager.

modifyLogin()

既存のログイン情報を修正し上書きします。

 void modifyLogin(
   in nsILoginInfo oldLogin,
   in nsILoginInfo newLogin
 );
Parameters
oldLogin
The login to be updated.
newLogin
The login information to replace the oldLogin with.

removeAllLogins()

ログインマネージャーに保存されているすべてのログイン情報を削除します。この動作はマスターパスワードによる保護を無視します。

 void removeAllLogins();
Parameters

None.

getAllLogins()

ログインマネージャーに保存されているすべてのログイン情報を配列として返します。

 void getAllLogins(
   out unsigned long count,
   [retval, array, size_is(count)] out nsILoginInfo logins
 );
Parameters
count
The number of elements in the returned array. JavaScript callers can simply use the array's length property and supply a dummy argument for this parameter.
logins
An array of nsILoginInfo objects containing all the logins the Login Manager has on record.
Remarks

このメソッドは JavaScript から次のように呼ぶことができます:

 var logins = myLoginMgr.getAllLogins({});

logins にはログイン情報が配列形式で戻されます。

getAllDisabledHosts()

ログイン情報の保存が無効に設定されているホストの一覧を返します。

 void getAllDisabledHosts(
   out unsigned long count,
   [retval, array, size_is(count)] out wstring hostnames
 );
Parameters
count
The number of elements in the returned array. JavaScript callers can simply use the array's length property and supply a dummy argument for this parameter.
hostnames
An array of hostname strings in URL format without a pathname. For example: "https://www.site.com".
Remarks

You can call this method from JavaScript like this:

 var disabledHosts = myLoginMgr.getAllDisabledHosts({});

getLoginSavingEnabled()

指定されたホストでログイン情報を保存可能かどうかを返します。

 boolean getLoginSavingEnabled(
   in AString aHost
 );
Parameters
aHost
The hostname to check. This argument should be in the origin URL format, with no pathname. For example: "https://www.site.com".
戻り値

ホストがログイン情報を保存できる場合は treu を、そうでない場合は false を返します。

setLoginSavingEnabled()

Enables or disables storing logins for a specified host. When login storing is disabled, the Login Manager won't prompt the user to store logins for that host. Existing logins are not affected.

 void setLoginSavingEnabled(
   in AString aHost,
   in boolean isEnabled
 );
Parameters
aHost
The hostname to adjust the setting for. This argument should be in the origin URL format, with no pathname. For example: "https://www.site.com".
isEnabled
If true, login saving is enabled for the specified host. If false, login saving is disabled.

findLogins()

Searches for logins matching the specified criteria. Called when looking for logins that might be applicable to a given form or authentication request.

 void findLogins(
   out unsigned long count,
   in AString aHostname,
   in AString aActionURL,
   in AString aHttpRealm,
   [retval, array, size_is(count)] out nsILoginInfo logins
 );
Parameters
count
The number of elements in the returned array. JavaScript callers can simply use the array's length property and supply a dummy argument for this parameter.
aHostname
The hostname to which to restrict searches. When looking for form logins, this argument should be in origin HTML format, with no pathname. For protocol logins, such as http or ftp, it should be the hostname with the port number appended, such as "www.bar.com:443".
aActionURL
For form logins, this parameter should specify the URL to which the form will be submitted. For protocol logins, specify null.
aHttpRealm
For protocol logins, specify the HTTP Realm for which the login applies; this is obtained from the WWW-Authenticate header (see RFC 2617). For form logins, this parameter should be null.
logins
An array of nsILoginInfo objects.
Remarks

This method can be called from JavaScript like this:

 var logins = myLoginMgr.findLogins({}, hostname, ...);

countLogins()

Returns the number of logins matching the specified criteria. Called when only the number of logins is needed, and not the actual logins (which avoids prompting the user for a Master Password, as the logins don't need to be decrypted).

 unsigned login countLogins(
   in AString aHostname,
   in AString aActionURL,
   in AString aHttpRealm,
 );
Parameters
aHostname
The hostname to which to restrict searches. When looking for form logins, this argument should be in origin HTML format, with no pathname. For protocol logins, such as http or ftp, it should be the hostname with the port number appended, such as "www.bar.com:443".
aActionURL
For form logins, this parameter should specify the URL to which the form will be submitted. To match any form login, specify "" (empty string). To not match any form logins (eg, when interested in protocol logins only), specify null.
aHttpRealm
For protocol logins, specify the HTTP Realm for which the login applies; this is obtained from the WWW-Authenticate header (see RFC 2617). To match any protocol login, specify "" (empty string). To not match any protocol logins (eg, when interested in form logins only), specify null.

 

autoCompleteSearch()

Generates results for a user field autocomplete menu.

註: This method is provided for use only by the FormFillController, which calls it directly. It should not be used for any other purpose, so no specific usage documentation is provided here.

Remarks

Fill this out.

See also

nsILoginInfo, Using nsILoginManager

ドキュメントのタグと貢献者

 このページの貢献者: teoli, saneyuki_s, Potappo, Norah
 最終更新者: teoli,