代码之家  ›  专栏  ›  技术社区  ›  Adam Driscoll

NTLMv2 HTTP身份验证Java

  •  1
  • Adam Driscoll  · 技术社区  · 14 年前

        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());
          }
        }
    

    chart 在JRE 6中应该支持NTLMv2。我的困惑在于这是在Android上运行的。在堆栈跟踪中 getOutputStream 我看到的是 HttpURLConnection 被引用。

    不管怎样,我想知道这是如何在Java中实现的,而不仅仅是Android。

    1 回复  |  直到 9 年前
        1
  •  1
  •   Maciej Pigulski    14 年前

    它没有实现。查看此问题: http://code.google.com/p/android/issues/detail?id=4962 . 还要考虑到Android不是jre6,而是标准Java的修改版。