[英]What is the difference between Integrated Security = True and Integrated Security = SSPI?
[英]INDY TIdHttp Integrated Security authentication issue with SSPI
我正在嘗試調用IIS上托管的Web服務,並應用了Windows身份驗證安全性。
我正在使用帶有INDY 10的Delphi XE和TIdHttp組件。
如果我傳入有效的用戶名和密碼,我可以成功調用Web服務,但我想使用Integrated Security,以便它自動使用來自調用線程的憑據,並且不需要用戶手動輸入其詳細信息。
我在uses子句中包含了IdAuthenticationSSPI,並將http請求調用為:
IdHttp1.Request.BasicAuthentication := False;
IdHttp1.HTTPOptions := [hoInProcessAuth];
// IdHttp1.Request.Username := '...'; // including this works
// IdHttp1.Request.Password := '...'; // including this works
IdHttp1.Get(myURL, myOutputStream);
我的理解是,如果沒有傳遞憑證,它將使用IdAuthenticationSSPI模擬調用線程的用戶。
我在atozedsoftware.newsgroups網站上看到了一些評論,建議這是可能的,但不幸的是我收到了“HTTP / 1.1 401 Unauthorized”。
有沒有人有什么建議?
根據Remy Lebeau的評論,在修復已知問題之前,看起來這是不可能的。
我已經用另一種方式解決了我的問題,我會在這里發布,以防其他人感興趣。
首先,我導入了WinHTTP類型庫(C:\\ Windows \\ system32 \\ winhttp.dll)並將WinHttp_TLB添加到uses子句中。
然后我用它像這樣:
var
http: IWinHttpRequest;
url: String;
begin
url := 'my web service';
http := CoWinHttpRequest.Create;
try
http.SetAutoLogonPolicy(0); // Enable SSO
http.Open('GET', url, False);
http.Send(EmptyParam);
ShowMessage(http.ResponseText);
finally
http := nil;
end;
end;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.