blob: 5353bc6983ee7002eddb87c77e5ff44dbed6dc6d [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.webkit;
18
Ignacio Solla451e3382014-11-10 10:35:54 +000019import android.annotation.SystemApi;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.os.Handler;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021
22/**
Steve Block46ce1db2012-07-17 16:43:00 +010023 * Represents a request for HTTP authentication. Instances of this class are
24 * created by the WebView and passed to
25 * {@link WebViewClient#onReceivedHttpAuthRequest}. The host application must
26 * call either {@link #proceed} or {@link #cancel} to set the WebView's
27 * response to the request.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028 */
29public class HttpAuthHandler extends Handler {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030
31 /**
Ben Murdoch2433fe92012-08-22 19:46:45 +010032 * @hide Only for use by WebViewProvider implementations.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033 */
Ignacio Solla451e3382014-11-10 10:35:54 +000034 @SystemApi
Ben Murdoch2433fe92012-08-22 19:46:45 +010035 public HttpAuthHandler() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036 }
37
38 /**
Steve Block46ce1db2012-07-17 16:43:00 +010039 * Gets whether the credentials stored for the current host (i.e. the host
40 * for which {@link WebViewClient#onReceivedHttpAuthRequest} was called)
41 * are suitable for use. Credentials are not suitable if they have
42 * previously been rejected by the server for the current request.
43 *
44 * @return whether the credentials are suitable for use
Jonathan Dixon47aaba32012-11-30 16:32:17 -080045 * @see WebView#getHttpAuthUsernamePassword
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046 */
47 public boolean useHttpAuthUsernamePassword() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048 return false;
49 }
50
51 /**
Steve Block46ce1db2012-07-17 16:43:00 +010052 * Instructs the WebView to cancel the authentication request.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053 */
Iain Merrick10229b22010-08-31 11:57:15 +010054 public void cancel() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055 }
56
57 /**
Steve Block46ce1db2012-07-17 16:43:00 +010058 * Instructs the WebView to proceed with the authentication with the given
59 * credentials. Credentials for use with this method can be retrieved from
60 * the WebView's store using {@link WebView#getHttpAuthUsernamePassword}.
Steve Blockc877c6b2010-03-12 18:49:48 +000061 */
Iain Merrick10229b22010-08-31 11:57:15 +010062 public void proceed(String username, String password) {
Steve Blockc6a90a52010-03-25 15:38:04 +000063 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064}