如何使用Indy响应摘要访问身份验证

问题描述 投票:0回答:1

我正尝试将响应发送回请求摘要访问身份验证的服务器]

  ....
  FResponseHeader.Text := FResponseText;// received header.
  FResponseHeader.ProcessHeaders;
   ....
  WriteLn(FResponseHeader.WWWAuthenticate); //WWW-Authenticate: Digest realm="xxxx.com", nonce="fq1uvocyzvr17e6a5syproazd5phwdvhvlc5", stale=false, algorithm=MD5, qop="auth"
  LIdAuthentication := TIdDigestAuthentication.Create;
  try
    LIdAuthentication.Username := FUser;
    LIdAuthentication.Password := FPass;
    LIdAuthentication.Uri      := FURI;
    LIdAuthentication.Method   := GetMsgTypeString(FResponseHeader.RequestMethods);
    LIdAuthentication.Params.Values['Authorization'] := FResponseHeader.WWWAuthenticate;
    LIdAuthentication.AuthParams.AddValue('Digest', FResponseHeader.WWWAuthenticate);
    for I := 0 to LIdAuthentication.Steps do
      LIdAuthentication.Next;
    Result := LIdAuthentication.Authentication;
  finally
    LIdAuthentication.Free;
  end;

我从服务器获得了[[401

创建

Authorization Header

的正确方法是什么?
我正在尝试将响应发送回请求摘要访问身份验证的服务器...。FResponseHeader.Text:= FResponseText; //收到的标头。 FResponseHeader.ProcessHeaders; .... ...
delphi indy freepascal
1个回答
0
投票
[TIdDigestAuthentication(和其他TIdAuthentication派生的类)旨在与TIdHTTP一起使用,而不是独立使用。
© www.soinside.com 2019 - 2024. All rights reserved.