java 如何让 HttpClient 使用 Kerberos?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11080741/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 03:42:21  来源:igfitidea点击:

How to make HttpClient use Kerberos?

javakerberosapache-commons-httpclient

提问by Nicolas Raoul

HttpClientis a Java library to browse websites.
I want to use it with Kerberos. The Kerberos part of HttpClient's documentationmostly says:

HttpClient是一个用于浏览网站的 Java 库。
我想将它与Kerberos一起使用。HttpClient 文档Kerberos 部分主要说:

The best way to start is to grab the KerberosHttpClient.java file in examples and try and get it to work.

最好的开始方法是获取示例中的 KerberosHttpClient.java 文件并尝试让它工作。

However, KerberosHttpClient.javais nowhere to be found (source, binaries, doc)
It is difficult to do anything without this file.

然而,KerberosHttpClient.java无处可寻(源代码二进制文件文档
没有这个文件就很难做任何事情。

Where can I find KerberosHttpClient.java?
Or is there a better document explaining how to use HttpClient with Kerberos?

我在哪里可以找到KerberosHttpClient.java
或者是否有更好的文档解释如何将 HttpClient 与 Kerberos 一起使用?

采纳答案by Yves Martin

In sourcesyou will find the file ClientKerberosAuthentication.javawith that example.

源代码中,您将找到ClientKerberosAuthentication.java带有该示例的文件。

httpcomponents-client-4.2/httpclient/src/examples/org/apache/http/examples/client/ClientKerberosAuthentication.java

By the way, setting up Kerberos authentication requires many steps at KDC side (ActiveDirectory I guess) and HTTP server side too. I recommend you this generic server setup documentationeven if targeting mod_auth_kerb, it addresses concepts and troubleshooting required to achieve the job.

顺便说一句,设置 Kerberos 身份验证需要在 KDC 端(我猜是 ActiveDirectory)和 HTTP 服务器端执行许多步骤。即使针对 mod_auth_kerb,我也建议您使用此通用服务器设置文档,它解决了完成工作所需的概念和故障排除。