簡體   English   中英

QAF:使用 NTLM 請求運行腳本時出現“401 未經授權:訪問被拒絕”

[英]QAF: '401 Unauthorized: Access is denied' when running script with NTLM request

我已經實現了 NTLMAuthClient 類

rest.client.impl=com.qmetry.qaf.automation.ws.client.NTLMAuthClient

進入項目屬性,但仍然出現上述錯誤。

這是我正在使用的 JSON 請求模板,我不確定該結構是否是導致錯誤的原因:

{
    "headers":
    {
        "Authorization":
        [
            {
                "username": "${ntlm.user}",
                "password": "${ntlm.password}"
            },
            {
                "domain": "${ntlm.domain}"
            }
        ],
        "Content-Type":"application/json"
    },
    
    "endPoint": "",
    "baseUrl": "${base_url}/api/data/v4/contacts(integrationkey='${clientNumber}')",
    "method": "PATCH",
    
    "body":
    {
        "userid": ""
    }
}

這是 QMetry 報告的回應:

要求

客戶端出站請求PATCH https://xxxx.com/CRMDEV2/api/data/v4/contacts(integrationkey='xxxx')授權:[{username=xxxx, password=xxxx}, {domain=xxxx}] 內容- 類型:應用程序/json {"userid":""}

回應

客戶端入站響應 401 REQ_ID:3d391170-40d7-4ea6-80ca-2531a7fe73ff 服務器:WWW-Authenticate:NTLM WWW-Authenticate:Negotiate Set-Cookie:ReqClientId=21490c2c-bdfe-4c00bb480131ca 到期=周四,2071 年 10 月 22 日 11:59:11 GMT; 路徑=/; 安全的; HttpOnly 內容長度:49 日期:2021 年 10 月 22 日星期五 11:59:11 GMT 內容類型:文本/普通 HTTP 錯誤 401 - 未經授權:訪問被拒絕

感謝幫助。

我使用的 QAF 和 Selenium 版本:

QAF 版本:2.1.14

硒:3.141.59

請參閱NTLMAuthClient java-doc 您應該嘗試提供NTLMAuthClient使用的屬性,而不是請求調用標頭中的授權。

NTLMAuthClient類使用以下屬性:

ntlm.user - The user name. This should not include the domain to authenticate with. For example: "user" is correct whereas "DOMAIN\\user" is not.
ntlm.password - The password
ntlm.workstation - workstation (default is blank) The workstation the authentication request is originating from. Essentially, the computer name for this machine.
ntlm.domain- domain The domain to authenticate within (default is blank). 
#register NTLMAuthClient
rest.client.impl=com.qmetry.qaf.automation.ws.client.NTLMAuthClient

在您的屬性文件中設置上述屬性,然后在請求調用標頭中未經授權嘗試。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM