1
我很困惑這應該如何工作。我試過用這樣的東西:NTLMv2 HTTP驗證Java
con = (HttpURLConnection) url2.openConnection();
con.setReadTimeout(10000);
con.setInstanceFollowRedirects(true);
con.setAllowUserInteraction(true);
con.setDoOutput(true);
con.setDoInput(true);
Authenticator.setDefault(new MyAuthenticator());
con.connect();
class MyAuthenticator extends Authenticator {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("myUser", "MyPassword".toCharArray());
}
}
我得到了401這個方法返回的錯誤,所以顯然我錯過了這一點。根據這chart NTLMv2應該在JRE 6中得到支持。我的困惑在於這是在Android上運行的事實。在來自getOutputStream
拋出異常的堆棧跟蹤中,我看到被引用的HttpURLConnection
的Apache實現。
從我在研究中發現的情況來看,由於授權問題,Apache無法包含NTLMv2協議。這就是爲什麼它不適用於Android?
無論哪種方式,我想知道這將如何在Java中完成,而不僅僅是Android。
哎。謝啦! – 2010-10-06 16:11:03
實際上可以使用JCIFS庫:http://csharpening.net/blog/?p=271 – 2010-11-30 01:45:17