NTLM Authentication using rest api

Is it possible to use REST with NTLM authentication? I am using teamcity 7.1.

4 comments
Comment actions Permalink

Hi Pins,

Yes, it should be possible once the client supports it.

Please use REST API URLs without "httpAuth" in them.

0
Comment actions Permalink

Thanks for the info.

I tried using cURL / RestSharp and .Net WebClient however it is not working and sending back the teamcity Login page HTML.

cURL

-------

curl.exe --ntlm  --url http://teamcityUrl/app/rest/buildTypes

RestSharp

---------------

string _baseUrl=http://server:90/;

IRestClient _client = new RestClient(_baseUrl);

_client.Authenticator = new NtlmAuthenticator(CredentialCache.DefaultNetworkCredentials);
var request = new RestRequest("app/rest/buildTypes", Method.GET);


.Net WebClient
----------------------
string _baseUrl=http://server:90/;
WebClient _wclient = new WebClient();
_wclient.BaseAddress = _baseUrl;
_wclient.UseDefaultCredentials = true;
var content = _wclient.DownloadString("app/rest/buildTypes");



Can you please suggest what I am doing wrong or any server config that I need to change.

0
Comment actions Permalink

Hi Pins,

I just tried this with curl: curl -L -v -u USER --ntlm http://TEAMCITY_URL/app/rest/server/builds/ (this requires NTLM support in curl ("NTLM" appears in "curl -V" call) and also password typed in the command prompt, not sure if curl supports other ways to NTLM)
Anyway, in TeamCity 8.0.x it does not work with: http://youtrack.jetbrains.com/issue/TW-33608
Seems, we will need to wait until the issue is fixed.
Until then you will probably need to use HTTP BASIC authentication (https is recommended).

0
Comment actions Permalink

Thanks a lot..

0

Please sign in to leave a comment.