简体   繁体   English

JMeter 中需要 407 身份验证

[英]407 authenticationrequired in JMeter

I work in a company where we use a proxy to access any browser website.我在一家公司工作,我们使用代理访问任何浏览器网站。

We would like to start API testing with JMeter, but have a problem.我们想用 JMeter 开始 API 测试,但是有一个问题。

Whenever I try to add an API call to petstore.swagger.io/v2/pet/10, for example, and put in the proxy details in the "Advanced" section of the HTTP request + adding an HTTP authorization manager with Username + Password, it still gives me a "407 Authenticationrequired" error back.例如,每当我尝试向 petstore.swagger.io/v2/pet/10 添加 API 调用,并在 HTTP 请求的“高级”部分中输入代理详细信息时 + 添加带有用户名 + 密码的 HTTP 授权管理器,它仍然给我一个“407 Authenticationrequired”错误。

Request headers:请求头:

JMeter - 请求标头

Response headers:响应头:

JMeter - 响应头

In the information I have also it's that the proxy is "Ruleset Name: Authentication with Kerberos and NTLM Fallback".在我的信息中,代理是“规则集名称:使用 Kerberos 和 NTLM 回退进行身份验证”。

This is quite a problem if I'd like to test internal APIs with any authorization on it.如果我想测试具有任何授权的内部 API,这是一个相当大的问题。

HTTP Status code 407 means that proxy authentication required, it seems that you're using a corporate proxy to access the application under test and this proxy requires credentials.HTTP 状态代码 407表示需要代理身份验证,您似乎正在使用公司代理访问被测应用程序,并且此代理需要凭据。

You have 2 options of passing the proxy credentials to JMeter:您有 2 个选项可以将代理凭据传递给 JMeter:

  1. Command-line arguments like: 命令行参数,如:

     jmeter -H my.proxy.server -P 8000 -u username -a password
  2. JMeter System properties (you can put these lines to system.properties file JMeter 系统属性(您可以将这些行放入system.properties文件

    http.proxyUser=username http.proxyPass=password

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM