2
以下代码正常工作,但AuthPNames
和AuthPolicy
被标记为折旧,我找不到要替换的东西。RESTClient使用ntlm身份验证的正确方法是什么?
import groovyx.net.http.RESTClient
def restClient = new RESTClient(config.server)
restClient.client.credentialsProvider.setCredentials(
AuthScope.ANY,
new NTCredentials(
config.authUsername,
config.authPassword,
config.authWorkstation,
config.authDomain)
)
restClient.client.params.setParameter(
AuthPNames.TARGET_AUTH_PREF,
[AuthPolicy.NTLM]
)
@ArewrewSummer,你在找什么? – Opal 2014-11-23 11:18:37
是的,但是......我无法从文档中找出如何使用RequestConfig和AuthSchemeProvider。 – 2014-11-24 21:44:36
@AndrewSumner,我不知道你为什么不接受答案。你在问*哪些类可以被替换而不是*如何*。答案是:现在不可能。正如你可以在这里看到http://search.maven.org/#artifactdetails%7Corg.codehaus.groovy.modules.http-builder%7Chttp-builder%7C0.7.1%7Cjar,在http-builder的'4.2.1'版本使用了httpcomponents,我提到的类是在'4.3.6'中引入的。您需要用新版本替换旧版本库(如果可能,不知道 - 请注意依赖关系),或者等到http-builder中将使用新版本的库。 – Opal 2014-11-25 07:28:29