Java Code Examples for android.webkit.SslErrorHandler#proceed()

The following examples show how to use android.webkit.SslErrorHandler#proceed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebViewActivity.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
@Override
public void onReceivedSslError(final WebView view, final SslErrorHandler handler, final SslError error) {
    int primaryError = error.getPrimaryError();
    String url = error.getUrl();
    SslCertificate cert = error.getCertificate();
    mLogger.warning("onReceivedSslError: error = " + primaryError
            + ", url = " + url + ", certificate = " + cert);

    if (primaryError == SslError.SSL_UNTRUSTED && url != null && cert != null) {
        SslCertificate.DName subjectName = cert.getIssuedTo();
        if (subjectName != null
                && "localhost".equals(subjectName.getCName())
                && url.startsWith("https://localhost") ) {
            handler.proceed();
            mLogger.warning("SSL Proceeded: url = " + url);
            return;
        }
    }
    handler.cancel();
    mLogger.severe("SSL Canceled: url = " + url);
}
 
Example 2
Source File: CordovaWebViewClient.java    From L.TileLayer.Cordova with MIT License 6 votes vote down vote up
/**
 * Notify the host application that an SSL error occurred while loading a resource.
 * The host application must call either handler.cancel() or handler.proceed().
 * Note that the decision may be retained for use in response to future SSL errors.
 * The default behavior is to cancel the load.
 *
 * @param view          The WebView that is initiating the callback.
 * @param handler       An SslErrorHandler object that will handle the user's response.
 * @param error         The SSL error object.
 */
@TargetApi(8)
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {

    final String packageName = this.cordova.getActivity().getPackageName();
    final PackageManager pm = this.cordova.getActivity().getPackageManager();

    ApplicationInfo appInfo;
    try {
        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
            // debug = true
            handler.proceed();
            return;
        } else {
            // debug = false
            super.onReceivedSslError(view, handler, error);
        }
    } catch (NameNotFoundException e) {
        // When it doubt, lock it out!
        super.onReceivedSslError(view, handler, error);
    }
}
 
Example 3
Source File: CordovaWebViewClient.java    From CordovaYoutubeVideoPlayer with MIT License 6 votes vote down vote up
/**
 * Notify the host application that an SSL error occurred while loading a resource.
 * The host application must call either handler.cancel() or handler.proceed().
 * Note that the decision may be retained for use in response to future SSL errors.
 * The default behavior is to cancel the load.
 *
 * @param view          The WebView that is initiating the callback.
 * @param handler       An SslErrorHandler object that will handle the user's response.
 * @param error         The SSL error object.
 */
@TargetApi(8)
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {

    final String packageName = this.cordova.getActivity().getPackageName();
    final PackageManager pm = this.cordova.getActivity().getPackageManager();

    ApplicationInfo appInfo;
    try {
        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
            // debug = true
            handler.proceed();
            return;
        } else {
            // debug = false
            super.onReceivedSslError(view, handler, error);
        }
    } catch (NameNotFoundException e) {
        // When it doubt, lock it out!
        super.onReceivedSslError(view, handler, error);
    }
}
 
Example 4
Source File: SystemWebViewClient.java    From keemob with MIT License 6 votes vote down vote up
/**
 * Notify the host application that an SSL error occurred while loading a resource.
 * The host application must call either handler.cancel() or handler.proceed().
 * Note that the decision may be retained for use in response to future SSL errors.
 * The default behavior is to cancel the load.
 *
 * @param view          The WebView that is initiating the callback.
 * @param handler       An SslErrorHandler object that will handle the user's response.
 * @param error         The SSL error object.
 */
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {

    final String packageName = parentEngine.cordova.getActivity().getPackageName();
    final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager();

    ApplicationInfo appInfo;
    try {
        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
            // debug = true
            handler.proceed();
            return;
        } else {
            // debug = false
            super.onReceivedSslError(view, handler, error);
        }
    } catch (NameNotFoundException e) {
        // When it doubt, lock it out!
        super.onReceivedSslError(view, handler, error);
    }
}
 
Example 5
Source File: WebViewFragment.java    From arcusandroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    Date today = new Date();
    today.setTime(System.currentTimeMillis());
    if(error.getPrimaryError() == SslError.SSL_DATE_INVALID ||
            error.getPrimaryError() == SslError.SSL_IDMISMATCH ||
            error.getPrimaryError() == SslError.SSL_INVALID ||
            error.getPrimaryError() == SslError.SSL_UNTRUSTED) {
        handler.cancel();
    }
    else {
        handler.proceed();
    }
}
 
Example 6
Source File: LetvOpenIDOAuthLoginActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    if (LetvOpenIDOAuthLoginActivity.this.baseUrl.contains(LetvUtils.WEB_INNER_FLAG) || !LetvConfig.getPcode().equals("010110016")) {
        handler.proceed();
    } else {
        handler.cancel();
    }
}
 
Example 7
Source File: WebViewActivity.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    if (BuildConfig.IS_DEBUG) {
        handler.proceed();
        return;
    }
    super.onReceivedSslError(view, handler, error);
    LogUtils.e("WebViewActivity-----onReceivedSslError-------" + error.getUrl());

}
 
Example 8
Source File: WebBrowserActivity.java    From Dashchan with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
	if (Preferences.isVerifyCertificate()) {
		ToastUtils.show(WebBrowserActivity.this, R.string.message_invalid_certificate);
		super.onReceivedSslError(view, handler, error);
	} else {
		handler.proceed();
	}
}
 
Example 9
Source File: WebDialog.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    if (DISABLE_SSL_CHECK_FOR_TESTING) {
        handler.proceed();
    } else {
        super.onReceivedSslError(view, handler, error);

        sendErrorToListener(new FacebookDialogException(null, ERROR_FAILED_SSL_HANDSHAKE, null));
        handler.cancel();
        WebDialog.this.dismiss();
    }
}
 
Example 10
Source File: WebDialog.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    if (DISABLE_SSL_CHECK_FOR_TESTING) {
        handler.proceed();
    } else {
        super.onReceivedSslError(view, handler, error);

        sendErrorToListener(new FacebookDialogException(null, ERROR_FAILED_SSL_HANDSHAKE, null));
        handler.cancel();
        WebDialog.this.dismiss();
    }
}
 
Example 11
Source File: BrowserLayout.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler,
                               SslError error) {
    //忽略证书的错误继续Load页面内容
    handler.proceed();
    //handler.cancel(); // Android默认的处理方式
    //handleMessage(Message msg); // 进行其他处理
    //  super.onReceivedSslError(view, handler, error);
}
 
Example 12
Source File: VenvyWebView.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    if (mIwebViewClient != null) {
        mIwebViewClient.onReceivedSslError(view, handler, error);
    } else {
        handler.proceed();
        super.onReceivedSslError(view, handler, error);
    }
}
 
Example 13
Source File: BrowserView.java    From AndroidProject with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    // 注意一定要去除这行代码,否则设置无效。
    //super.onReceivedSslError(view, handler, error);
    // Android默认的处理方式
    //handler.cancel();
    // 接受所有网站的证书
    handler.proceed();
}
 
Example 14
Source File: LetvWebViewActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    LogInfo.log("LM", "onReceivedSslError");
    if (LetvWebViewActivity.this.baseUrl.contains(LetvUtils.WEB_INNER_FLAG) || !LetvConfig.getPcode().equals("010110016")) {
        handler.proceed();
    } else {
        handler.cancel();
    }
}
 
Example 15
Source File: AccountCreationWebviewHelper8.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    if (bypassSSLErrors) {
        handler.proceed();
    }
}
 
Example 16
Source File: WebPageActivity.java    From TigerVideo with Apache License 2.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {

    handler.proceed();
}
 
Example 17
Source File: AjaxWebView.java    From HaoReader with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    handler.proceed();
}
 
Example 18
Source File: Web3ViewClient.java    From Web3View with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    handler.proceed();
}
 
Example 19
Source File: CompatWebViewClient.java    From Android_Skin_2.0 with Apache License 2.0 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
	// super.onReceivedSslError(view, handler, error);
	// 忽略证书的错误继续Load页面内容
	handler.proceed();// 默认 handler.cancel();
}
 
Example 20
Source File: PopWebViewClient.java    From PoupoLayer with MIT License 4 votes vote down vote up
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    //  super.onReceivedSslError(view, handler, error);
    handler.proceed();// 接受所有网站的证书
}