Skip to content

Unable to use self signed certificate #75

@miky9090

Description

@miky9090

I have a spring based authorization server running on my pc with self signed certificate.
In this case I'm unable to connect to the authorization server.

I get the following exception:

I/X509Util: Failed to validate the certificate chain, error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

I have created the following controller object with setting the webView's WebViewClient:

AuthorizationUIController controller = new DialogFragmentController(getFragmentManager(), true) {
	@Override
	public String getRedirectUri() throws IOException {
		return REDIRECT_URI;
	}

	@Override
	public boolean isJavascriptEnabledForWebView() {
		return true;
	}

	@Override
	public boolean disableWebViewCache() {
		return false;
	}

	@Override
	public boolean removePreviousCookie() {
		return false;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View oauthLoginLayout = inflater.inflate(R.layout.oauth_login_layout, container, false);
		WebView webView = (WebView) oauthLoginLayout.findViewById(android.R.id.primary);
		if(webView != null) {
			webView.setWebViewClient(new WebViewClient() {
				public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
					handler.proceed();
				}
			});
		}
		return oauthLoginLayout;
	}
};

But this has no effect, because in OAuthDialogFragment's onViewCreated method, the webView's WebViewClient is being set, so my custom WebViewClient is never used.

There should be an option to enable self signed certificates for the webview for testing purposes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions