AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

NTLM Authentication

Ein Thema von user0815 · begonnen am 11. Sep 2017 · letzter Beitrag vom 24. Jul 2021
 
Benutzerbild von user0815
user0815

Registriert seit: 5. Okt 2007
331 Beiträge
 
Delphi XE2 Professional
 
#1

NTLM Authentication

  Alt 11. Sep 2017, 11:28
Hallo,
ich soll mich per NTLM Authentication mit einem Server verbinden um Daten zu erhalten.
Rufe ich die URL als einfachen HTTP Request auf, so erhalte ich vom Server:

Content-Type: text/html
Server: Microsoft-IIS/7.0
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET

HTTP-Authentifizierungsschemen

So wie ich es bis jetzt mache funktioniert es nicht (kann Änderungen hier vor Ort leider auch nicht testen):

Delphi-Quellcode:
procedure TFormMain.SendXmlOrderRequest(var XMLDoc: IXMLDocument; Url: String);
var
  Response: String;
  Send: TStringStream;
begin
    Send := TStringStream.Create(Utf8Encode(XMLDoc.Xml.Text));

    IdHTTP.Request.BasicAuthentication := false;
    IdHTTP.Request.Username := '';
    IdHTTP.Request.Password := '';

    IdHTTP.Request.Host := 'devap3';
    IdHTTP.Request.ContentType := 'text/xml';
    IdHTTP.Request.Charset := 'utf-8';
    IdHTTP.Request.AcceptCharSet := 'utf-8';
    IdHTTP.Request.ContentLength := Send.Size;
    IdHTTP.Request.CustomHeaders.Values['SOAPAction'] := 'http://tempuri.org/CheckOrder';

    IdHTTP.HTTPOptions := [hoForceEncodeParams, hoInProcessAuth];
    IdHTTP.ProtocolVersion := pv1_1;
   
    try
      Response := IdHTTP.Post(Url, Send);
    except
      on E: Exception do
      begin
      MemoDebug.Lines.Append('Exception HTTP: ' + E.Message);
      // erhalte dies als Ausgabe
      // Exception HTTP: Operation abgebrochen
      end;
    end;
    IdHTTP.Disconnect;   
end;

procedure TFormMain.IdHTTPAuthorization(Sender: TObject; Authentication: TIdAuthentication; var Handled: Boolean);
begin
  Authentication.Username := FUsername;
  Authentication.Password := FPassword;

  MemoDebug.Lines.Append('onAuthorization: ' + Authentication.Authentication);
  // erhalte dies als Ausgabe
  // onAuthorization: NTLM TlRMTVNTUAAB7AAAB7IAAAgACAAgAA7ACgAKACgAAABET00wOTgxMERBREEwOTgxMDM=

  Handled := true;
end;

procedure TFormMain.IdHTTPSelectAuthorization(Sender: TObject; var AuthenticationClass: TIdAuthenticationClass;
  AuthInfo: TIdHeaderList);
begin
  AuthenticationClass := TIdNTLMAuthentication;
end;
Kann jemand erkennen was ich falsche mache?
Hat jemand evtl. ein funktionierendes Beispiel?

Grüße
user0815
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:47 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz