我可以访问由公司SAML进行身份验证的共享点。我必须连接到URL https://xyz.sharepoint.com/teams/x/y/z/teams.aspx,并且必须从此页面下载文件。我已经使用下面的代码进行连接,并且正在获取HTTP / 1.1 403 Forbidden
公共类SharePointAuthenticator {
private static final String ASIAPACIFIC_HPQCORP_NET = "asiapacific.hpqcorp.net";
public static void main(String[] args) throws Exception {
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
new AuthScope(AuthScope.ANY),
new NTCredentials("ntusername", "password", "http://localhost", "domain"));
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCredentialsProvider(credsProvider)
.build();
try {
System.out.println("Inside try");
HttpGet httpget = new HttpGet("https://xyz.sharepoint.com/teams/myapps/_api/web");
System.out.println("Executing request " + httpget.getRequestLine());
CloseableHttpResponse response = httpclient.execute(httpget);
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
EntityUtils.consume(response.getEntity());
} finally {
response.close();
}
} finally {
httpclient.close();
}
}
}
禁止使用HTTP / 1.1 403
请问这里有什么问题吗?