JMeter 基本身份验证 [英] JMeter Basic Authentication

查看:83
本文介绍了JMeter 基本身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图暗示使用 JMeter 的 Web 服务的基本身份验证过程.但是每次它都会抛出错误 401:Unauthorized.我尝试使用 HTTP 标头管理器向其添加标头授权和值.它仍然不起作用.我也尝试过使用 HTTP 授权管理器.仍然没有运气.有人可以帮忙吗.

I am trying to imply the basic authentication process for a web service using JMeter. But everytime it throws out an error 401:Unauthorized. I tried using the HTTP Header manager to add a header Authorization and value to it. Still it does not work. I have also tried using the HTTP Authorization manager. Still no luck. Can someone help.

推荐答案

我通过调试来自 JMeter 的请求发现 HTTP 授权管理器模块没有正确编码用户名和密码.它在用户名后放置一个换行符.

I've found through debugging requests coming in from JMeter that the HTTP Authorization Manager module doesn't encode the username and password correctly. It puts a newline character after the username.

要针对受基本身份验证保护的端点运行 JMeter 测试,请包含 HTTP 标头管理器并自行添加基本身份验证标头:

To run a JMeter test against a Basic Auth protected endpoint, include the HTTP Header Manager and add the Basic Auth header yourself:

  • 来自 MacOS 或 Linux:

  • From MacOS or Linux:

echo -n "用户名:密码" |base64

来自 Windows:

From Windows:

转到这里并编码您的用户名:密码"字符串

Go here and encode your "username:password" string

在 HTTP Header Manager 中,添加一个名为Authorization"且值为Basic [encoded credentials from above]"的条目

In the HTTP Header Manager, add an entry with the name "Authorization" and the value "Basic [encoded credentials from above]"

这篇关于JMeter 基本身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆