3

I have a WebView embedded in my application. I am trying to view a webpage that uses NTLM authentication. How can I perform the NTLM authentication using the WebView and view this page?

I was successfully able to authenticate to this page using DefaultHttpClient and the JCIFS Library. But how can I do it for the WebView?

MediumOne
  • 804
  • 3
  • 11
  • 28

2 Answers2

1

It has been two years since I asked this question. In the meantime, I figured out the answer to this question -

WebView supports NTLM authentication out-of-the-box. The onReceivedHttpAuthRequest callback in WebViewClient has a method parameter a method parameter named handler. This is of the type HttpAuthHandler. handler.proceed(username, password) will automatically authenticate to the web server using NTLM protocol. This handler abstracts the authentication protocol used. Both Basic and NTLM authentication work using the same line of code.

MediumOne
  • 804
  • 3
  • 11
  • 28
  • How to download a ntlm proteted file. Ever encountered about these type of requirement ? – Akash Jan 06 '20 at 11:30
  • You can use Apache HTTPClient to download files that require NTLM authentication. Apache HTTPClient supports NTLM authentication since 4.2.3. You can use the latest version. Reference - https://hc.apache.org/httpcomponents-client-4.5.x/ntlm.html – MediumOne Jan 11 '20 at 05:12
0

I'm having the same problem! There is another indirect way. You get the HttpResponse and then save the html file to the internal storage and then load the file into the WebView. I never tried this before, though.