次の方法で共有


WebViewDatabase.SetHttpAuthUsernamePassword Method

Definition

Stores HTTP authentication credentials for a given host and realm to the WebViewDatabase instance.

[Android.Runtime.Register("setHttpAuthUsernamePassword", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", "GetSetHttpAuthUsernamePassword_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Handler", ApiSince=26)]
public abstract void SetHttpAuthUsernamePassword (string? host, string? realm, string? username, string? password);
[<Android.Runtime.Register("setHttpAuthUsernamePassword", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", "GetSetHttpAuthUsernamePassword_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Handler", ApiSince=26)>]
abstract member SetHttpAuthUsernamePassword : string * string * string * string -> unit

Parameters

host
String

the host to which the credentials apply

realm
String

the realm to which the credentials apply

username
String

the username

password
String

the password

Attributes

Remarks

Stores HTTP authentication credentials for a given host and realm to the WebViewDatabase instance.

To use HTTP authentication, the embedder application has to implement WebViewClient#onReceivedHttpAuthRequest, and call HttpAuthHandler#proceed with the correct username and password.

The embedder app can get the username and password any way it chooses, and does not have to use WebViewDatabase.

Notes: <li> WebViewDatabase is provided only as a convenience to store and retrieve http authentication credentials. WebView does not read from it during HTTP authentication. </li> <li> WebView does not provide a special mechanism to clear HTTP authentication credentials for implementing client logout. The client logout mechanism should be implemented by the Web site designer (such as server sending a HTTP 401 for invalidating credentials). </li>

Java documentation for android.webkit.WebViewDatabase.setHttpAuthUsernamePassword(java.lang.String, java.lang.String, java.lang.String, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to