procedure TForm9.IdHTTPProxyAuthorization(Sender: TObject;
Authentication: TIdAuthentication;
var Handled: Boolean);
begin
// First check for NTLM authentication, as you do not need to
// set username and password because Indy will automatically
// handle passing your Windows Domain username and
// password to the proxy server
if Authentication
is TIdSSPINTLMAuthentication
then
begin
Handled := True;
Exit;
end;
Authentication.Username := ProxyUsername;
Authentication.Password := ProxyPassword;
if (Authentication
is TIdDigestAuthentication)
then
begin
TIdDigestAuthentication(Authentication).Method := TIdHTTP(Sender).Request.Method;
TIdDigestAuthentication(Authentication).Uri := TIdHTTP(Sender).URL.URI;
end;
Handled := True;
end;
procedure TForm9.IdHTTPSelectProxyAuthorization(Sender: TObject;
var AuthenticationClass: TIdAuthenticationClass; AuthInfo: TIdHeaderList);
begin
// First check for NTLM authentication
if (AuthInfo.IndexOf('
NTLM') > -1)
then
begin
AuthenticationClass := TIdSSPINTLMAuthentication;
end
// Next check for Basic
else if (AuthInfo.IndexOf('
Basic') > -1)
then
begin
AuthenticationClass := TIdBasicAuthentication;
end
// Then Digest
else if (AuthInfo.IndexOf('
Digest') > 0)
then
begin
AuthenticationClass := TIdDigestAuthentication
end;
end;