TFS Java API - 身份验证问题 [英] TFS Java API - Authentication Issue
问题描述
我正在尝试通过 Java SDK (TFS-SDK-12.0.1) 进行身份验证,但无法通过.任何帮助将不胜感激.下面是我的代码:
I am trying to authentication through Java SDK (TFS-SDK-12.0.1) but not able to get through. Any help will be highly appreciated. Below is my code:
URI serverURI = new URI("http://localhost:8080/tfs");///DefaultCollection");
//Credentials credentials = new DefaultNTCredentials();
Credentials credentials = new UsernamePasswordCredentials("username", "GWt@try");
System.out.println("Trying to connect..");
SnippetsSamplesConnectionAdvisor connectionAdvisor = new SnippetsSamplesConnectionAdvisor(null);
//TFSTeamProjectCollection tpc = new TFSTeamProjectCollection(serverURI, credentials);
TFSTeamProjectCollection tpc = new TFSTeamProjectCollection(URIUtils.newURI("http://localhost:8080/tfs"), credentials, connectionAdvisor);
WorkItemClient workItemClient = tpc.getWorkItemClient();
你可以忽略注释行,它只是告诉你,我也尝试过这些选项.尝试 UsernamePasswordCredentials 时出现以下异常:
You can ignore the commented lines, its there just to tell you guyz that I've tried those options as well. I am getting the following exception when I try UsernamePasswordCredentials:
Trying to connect..
WARN [main] TFSTeamProjectCollection - Error getting data provider
com.microsoft.tfs.core.httpclient.auth.AuthenticationSecurityException: Basic credentials are only supported over HTTPS secured connections.
当我使用 DefaultNTCredentials 时的以下内容:
And the following when I use DefaultNTCredentials:
Trying to connect..
WARN [main] HttpMethodDirector - Unable to respond to any of these challenges: {basic=Basic realm="localhost"}
WARN [main] TFSTeamProjectCollection - Error getting data provider
com.microsoft.tfs.core.exceptions.TFSUnauthorizedException: Access denied connecting to TFS server http://localhost:8080/ (authenticating as White-Rabbit\Sumukh)
我的最终目标是连接到 TFS 服务器并更新/创建工作项.任何指针?请帮忙.
My end goal is to connect to TFS Server and update/create work items. Any pointers? Please help.
我可以通过UI连接TFS,请点击以下链接查看截图:http://grab.by/xnlU
I can connect to TFS through UI, please click on the following link to see the screenshot: http://grab.by/xnlU
推荐答案
转到管理.在设置选项卡下,允许备用身份验证凭据
Go to Administration. Under settings Tab, Allow Alternate authentication credentials
这篇关于TFS Java API - 身份验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!