Double request while making POX REST call using WCF with WebHttpBinding set to Basic Authentication

前端 未结 2 2005
借酒劲吻你
借酒劲吻你 2021-01-15 16:24

Having an issue while making POX REST call using WCF with WebHttpBinding set to Basic Authentication (HttpClientCredentialType.Basic)

Instead of one call from the cl

2条回答
  •  花落未央
    2021-01-15 16:30

    The problem actually lies with those third parties. Per RFC 2617 Basic authentication is done in two calls, just like Digest. The server should respond at the first call with a challenge containing a realm:

    Upon receipt of an unauthorized request for a URI within the
    protection space, the origin server MAY respond with a challenge like
    the following:

      WWW-Authenticate: Basic realm="WallyWorld"
    

    where "WallyWorld" is the string assigned by the server to identify
    the protection space of the Request-URI

    The WCF endpoint will pre-authenticate only subsequent calls after the first one. The very first call made by an appdomain to any resource will not contain the basic header user name and password.

    See also What happened to the PreAuthenticate flag in WCF.

提交回复
热议问题