gpt4 book ai didi

Sharepoint 在线服务的 Java NTLM 身份验证出现 401 错误

转载 作者:行者123 更新时间:2023-12-01 17:00:11 30 4
gpt4 key购买 nike

我尝试使用下面的代码从客户端共享点服务(2013)获取列表,它是一个 https(无效证书),我已经下载了相同的证书并安装在 cacets 中。每次我都会收到以下响应

    try{
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
DefaultHttpClient httpClient = new DefaultHttpClient(params);
httpClient.getAuthSchemes().register("ntlm", new NTLMSchemeFactory());
httpClient.getCredentialsProvider().setCredentials(AuthScope.ANY, new
NTCredentials("username", "passwrd", "host", "domain"));
HttpPut request = new HttpPut("https://domain/_api/get..");
request.setHeader("Content-Type", "application/json;odata=verbose");
request.setHeader("Accept", "application/json;odata=verbose");

System.out.println(httpClient.execute(request));
}catch(Exception e){
throw e;
}


RESPONSE

HTTP/1.1 401 Unauthorized [Server: Microsoft-IIS/8.5,
SPRequestGuid: 6ecb4d9f-9884-c0ba-7e4e-eed562a7e616,
request-id: 6ecb4d9f-9884-c0ba-7e4e-eed562a7e616,
X-FRAME-OPTIONS: SAMEORIGIN,
SPRequestDuration: 4,
SPIisLatency: 0,
WWW-Authenticate: NTLM,
X-Powered-By: ASP.NET,
MicrosoftSharePointTeamServices: 15.0.0.5172,
X-Content-Type-Options: nosniff,
X-MS-InvokeApp: 1;
RequireReadOnly,
Date: Thu,
30 Apr 2020 10:02:57 GMT,
Content-Length: 0] org.apache.http.conn.BasicManagedEntity@679b62af

最佳答案

我找到了解决方案这是因为端口和主机名

关于Sharepoint 在线服务的 Java NTLM 身份验证出现 401 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61521019/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com