【问题标题】:NTLMv2 HTTP Authentication JavaNTLMv2 HTTP 身份验证 Java
【发布时间】:2010-10-06 05:46:07
【问题描述】:

我很困惑这应该如何工作。我试过使用这样的东西:

    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。

【问题讨论】:

    标签: java android httpurlconnection ntlmv2


    【解决方案1】:

    未实施。看看这个问题:http://code.google.com/p/android/issues/detail?id=4962。还要考虑 Android 不是 JRE 6 的事实,它是标准 Java 的修改版本。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多