![](/img/trans.png)
[英]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.