android.webkit.SslErrorHandler Java Examples
The following examples show how to use
android.webkit.SslErrorHandler.
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: WebPlayerView.java From unity-ads-android with Apache License 2.0 | 6 votes |
@TargetApi(14) @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { // Don't call shouldCallSuper("onReceivedSslError") to ensure // we always rely on the default behavior. Otherwise it is // possible Google might reject the app as an unsafe implementation. // https://support.google.com/faqs/answer/7071387?hl=en super.onReceivedSslError(view, handler, error); DeviceLog.error("Received SSL error for '%s': %s", error.getUrl(), error.toString()); if (shouldSendEvent("onReceivedSslError")) { String url = ""; if (error != null) { url = error.getUrl(); } WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.WEBPLAYER, WebPlayerEvent.SSL_ERROR, url, viewId); } }
Example #2
Source File: WebViewActivity.java From Bailan with Apache License 2.0 | 6 votes |
@Override protected void initView() { String name = getIntent().getStringExtra("name"); String url = getIntent().getStringExtra("url"); //设置沉浸式状态栏 setStatus(); iv_search.setVisibility(View.VISIBLE); //设置沉浸式状态栏背景 bar_layout.setBackgroundResource(R.color.black_alpha_5); title_text.setText(name); wv.setWebViewClient(new WebViewClient() { @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { super.onReceivedSslError(view, handler, error); handler.proceed(); } }); wv.getSettings().setJavaScriptEnabled(true); wv.loadUrl(url); }
Example #3
Source File: CordovaWebViewClient.java From reader with MIT License | 6 votes |
/** * 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 a2cardboard with Apache License 2.0 | 6 votes |
/** * 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 = 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: SystemWebViewClient.java From ultimate-cordova-webview-app with MIT License | 6 votes |
/** * 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 = 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 #6
Source File: CordovaWebViewClient.java From reader with MIT License | 6 votes |
/** * 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 #7
Source File: FocusWebViewClient.java From focus-android with Mozilla Public License 2.0 | 6 votes |
@Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { handler.cancel(); if (callback != null) { callback.onSecurityChanged(error.getCertificate() != null, null, (error.getCertificate() != null) ? error.getCertificate().getIssuedBy().getOName() : null); } // WebView can try to load the favicon for a bad page when you set a new URL. If we then // loadErrorPage() again, WebView tries to load the favicon again. We end up in onReceivedSSlError() // again, and we get an infinite loop of reloads (we also erroneously show the favicon URL // in the toolbar, but that's less noticeable). Hence we check whether this error is from // the desired page, or a page resource: if (error.getUrl().equals(currentPageURL)) { TelemetryWrapper.sslErrorEvent(true, error); ErrorPage.loadErrorPage(view, error.getUrl(), WebViewClient.ERROR_FAILED_SSL_HANDSHAKE); } else { TelemetryWrapper.sslErrorEvent(false, error); } }
Example #8
Source File: SystemWebViewClient.java From keemob with MIT License | 6 votes |
/** * 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 #9
Source File: SystemWebViewClient.java From keemob with MIT License | 6 votes |
/** * 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 #10
Source File: SslUntrustedCertDialog.java From Cirrus_depricated with GNU General Public License v2.0 | 6 votes |
public static SslUntrustedCertDialog newInstanceForFullSslError(X509Certificate cert, SslError error, SslErrorHandler handler) { if (cert == null) { throw new IllegalArgumentException("Trying to create instance with parameter cert == null"); } if (error == null) { throw new IllegalArgumentException("Trying to create instance with parameter error == null"); } if (handler == null) { throw new IllegalArgumentException("Trying to create instance with parameter handler == null"); } SslUntrustedCertDialog dialog = new SslUntrustedCertDialog(); dialog.m509Certificate = cert; dialog.mHandler = handler; dialog.mErrorViewAdapter = new SslErrorViewAdapter(error); dialog.mCertificateViewAdapter = new X509CertificateViewAdapter(cert); return dialog; }
Example #11
Source File: FocusWebViewClient.java From firefox-echo-show with Mozilla Public License 2.0 | 6 votes |
@Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { handler.cancel(); // WebView can try to load the favicon for a bad page when you set a new URL. If we then // loadErrorPage() again, WebView tries to load the favicon again. We end up in onReceivedSSlError() // again, and we get an infinite loop of reloads (we also erroneously show the favicon URL // in the toolbar, but that's less noticeable). Hence we check whether this error is from // the desired page, or a page resource: if (error.getUrl().equals(currentPageURL)) { TelemetryWrapper.sslErrorEvent(true, error); ErrorPage.loadErrorPage(view, error.getUrl(), WebViewClient.ERROR_FAILED_SSL_HANDSHAKE); } else { TelemetryWrapper.sslErrorEvent(false, error); } }
Example #12
Source File: WebViewActivity.java From Bailan with Apache License 2.0 | 6 votes |
@Override protected void initView() { String name = getIntent().getStringExtra("name"); String url = getIntent().getStringExtra("url"); //设置沉浸式状态栏 setStatus(); iv_search.setVisibility(View.VISIBLE); //设置沉浸式状态栏背景 bar_layout.setBackgroundResource(R.color.black_alpha_5); title_text.setText(name); wv.setWebViewClient(new WebViewClient() { @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { super.onReceivedSslError(view, handler, error); handler.proceed(); } }); wv.getSettings().setJavaScriptEnabled(true); wv.loadUrl(url); }
Example #13
Source File: SystemWebViewClient.java From cordova-plugin-app-update-demo with MIT License | 6 votes |
/** * 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 = 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 #14
Source File: WebViewActivity.java From DeviceConnect-Android with MIT License | 6 votes |
@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 #15
Source File: CordovaWebViewClient.java From L.TileLayer.Cordova with MIT License | 6 votes |
/** * 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 #16
Source File: SystemWebViewClient.java From xmall with MIT License | 6 votes |
/** * 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 = 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 #17
Source File: SystemWebViewClient.java From BigDataPlatform with GNU General Public License v3.0 | 6 votes |
/** * 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 = 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 #18
Source File: Web3ViewClient.java From alpha-wallet-android with MIT License | 6 votes |
@Override public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { AWalletAlertDialog aDialog = new AWalletAlertDialog(context); aDialog.setTitle(R.string.title_dialog_error); aDialog.setIcon(AWalletAlertDialog.ERROR); aDialog.setMessage(R.string.ssl_cert_invalid); aDialog.setButtonText(R.string.dialog_approve); aDialog.setButtonListener(v -> { handler.proceed(); aDialog.dismiss(); }); aDialog.setSecondaryButtonText(R.string.action_cancel); aDialog.setButtonListener(v -> { handler.cancel(); aDialog.dismiss(); }); aDialog.show(); }
Example #19
Source File: WebDialog.java From Abelana-Android with Apache License 2.0 | 5 votes |
@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 #20
Source File: ShareWeiboWebViewClient.java From letv with Apache License 2.0 | 5 votes |
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { if (this.mCallBack != null) { this.mCallBack.onReceivedSslErrorCallBack(view, handler, error); } handler.cancel(); this.mShareRequestParam.sendSdkErrorResponse(this.mAct, "ReceivedSslError"); WeiboSdkBrowser.closeBrowser(this.mAct, this.mShareRequestParam.getAuthListenerKey(), null); }
Example #21
Source File: WebGuiActivity.java From syncthing-android with Mozilla Public License 2.0 | 5 votes |
/** * Catch (self-signed) SSL errors and test if they correspond to Syncthing's certificate. */ @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { try { int sdk = android.os.Build.VERSION.SDK_INT; if (sdk < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // The mX509Certificate field is not available for ICS- devices Log.w(TAG, "Skipping certificate check for devices <ICS"); handler.proceed(); return; } // Use reflection to access the private mX509Certificate field of SslCertificate SslCertificate sslCert = error.getCertificate(); Field f = sslCert.getClass().getDeclaredField("mX509Certificate"); f.setAccessible(true); X509Certificate cert = (X509Certificate)f.get(sslCert); if (cert == null) { Log.w(TAG, "X509Certificate reference invalid"); handler.cancel(); return; } cert.verify(mCaCert.getPublicKey()); handler.proceed(); } catch (NoSuchFieldException|IllegalAccessException|CertificateException| NoSuchAlgorithmException|InvalidKeyException|NoSuchProviderException| SignatureException e) { Log.w(TAG, e); handler.cancel(); } }
Example #22
Source File: SslUntrustedCertDialog.java From Cirrus_depricated with GNU General Public License v2.0 | 5 votes |
public static SslUntrustedCertDialog newInstanceForEmptySslError(SslError error, SslErrorHandler handler) { if (error == null) { throw new IllegalArgumentException("Trying to create instance with parameter error == null"); } if (handler == null) { throw new IllegalArgumentException("Trying to create instance with parameter handler == null"); } SslUntrustedCertDialog dialog = new SslUntrustedCertDialog(); dialog.mHandler = handler; dialog.mErrorViewAdapter = new SslErrorViewAdapter(error); dialog.mCertificateViewAdapter = new SslCertificateViewAdapter(error.getCertificate()); return dialog; }
Example #23
Source File: WebDialog.java From barterli_android with Apache License 2.0 | 5 votes |
@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 #24
Source File: WebViewClientDelegate.java From AgentWeb with Apache License 2.0 | 5 votes |
@Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { if (mDelegate != null) { mDelegate.onReceivedSslError(view, handler, error); return; } super.onReceivedSslError(view, handler, error); }
Example #25
Source File: AuthActivity.java From letv with Apache License 2.0 | 5 votes |
public final void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) { if (this.a.g) { sslErrorHandler.proceed(); this.a.g = false; return; } this.a.runOnUiThread(new e(this, sslErrorHandler)); }
Example #26
Source File: H5PayActivity.java From letv with Apache License 2.0 | 5 votes |
public final void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) { if (this.a.e) { sslErrorHandler.proceed(); this.a.e = false; return; } this.a.runOnUiThread(new h(this, sslErrorHandler)); }
Example #27
Source File: H5AuthActivity.java From letv with Apache License 2.0 | 5 votes |
public final void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) { if (this.a.d) { sslErrorHandler.proceed(); this.a.d = false; return; } this.a.runOnUiThread(new c(this, sslErrorHandler)); }
Example #28
Source File: LetvOpenIDOAuthLoginActivity.java From letv with Apache License 2.0 | 5 votes |
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 #29
Source File: WebViewFragment.java From arcusandroid with Apache License 2.0 | 5 votes |
@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 #30
Source File: HongKongLoginWebview.java From letv with Apache License 2.0 | 5 votes |
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { if (HongKongLoginWebview.this.baseUrl.contains(LetvUtils.WEB_INNER_FLAG) || !LetvConfig.getPcode().equals("010110016")) { handler.proceed(); } else { handler.cancel(); } }