【问题标题】:Problems with OAuth PKCE and Visual Studio Load TestingOAuth PKCE 和 Visual Studio 负载测试的问题
【发布时间】:2020-03-02 14:46:58
【问题描述】:

(请原谅我的术语)

使用 Visual Studio Enterprise 2019 负载测试

我在使用 Visual Studio 负载测试器时尝试使用启用了 OAuth PKCE 的网站登录/验证时遇到问题。我似乎无法正确提取正确的信息。代码质询和代码方法以查询字符串的形式给出。我得到的错误都是401错误。

流程如下:

[GET] 转到该网站

[GET] 重定向到 API(API 查询字符串包含 code_challengecode_challenge_method

[POST] _RequestVerificationToken 然后发布(以 cookie 的形式出现)

[GET] 使用 /sign-in 链接发送不同的 code_challenge

[GET] 然后我得到另一个code 和一个session_state

[POST] 上面的code 然后与code_verifier 一起发布

我不知道我应该如何获取和发布条件,我尝试使用隐藏字段、文本提取和 REGEX 但找不到信息。

如果有人有什么要添加或尝试的,请告诉我,因为我被这个问题阻止了。

我附上了一张图片,其中包含 OAuth 从头到尾的敏感信息。

记录结果

Passed  http://portal-qa.***.com/       0.158 sec   -   -
Passed      https://portal-qa.***.com/  200 OK  -   0.158 sec   0
Passed          https://portal-qa.***.com/css/chunk-vendors.a903617c.css    200 OK  -   0.013 sec   0
Passed          https://portal-qa.***.com/css/app.b3b1d014.css  200 OK  -   0.009 sec   0
Passed          https://portal-qa.***.com/js/chunk-vendors.dc65dbba.js  200 OK  -   0.007 sec   0
Passed          https://portal-qa.***.com/js/app.5db053cd.js    200 OK  -   0.008 sec   0
Passed  https://portal-qa.***.com/fonts/apercu-light-pro.55f01ab6.eot   200 OK  0.003 sec   0.003 sec   0
Passed  https://portal-qa.***.com/fonts/apercu-regular-pro.ad897f51.eot 200 OK  0.003 sec   0.003 sec   0
Passed  https://portal-qa.***.com/fonts/apercu-medium-pro.27a3987c.eot  200 OK  0.003 sec   0.003 sec   0
Passed  https://qa.***.com/identityserver/connect/authorize     0.523 sec   -   -
Passed      https://qa.***.com/identityserver/Account/Login?ReturnUrl=%2Fidentityserver%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3DPortalCodePkce%26redirect_uri%3Dhttps%253A%252F%252Fportal-qa.***.com%252Fsign-in%26state%3D%252Ftransactions%26response_type%3Dcode%26scope%3D***IdentityApi%2520pcoProfile%2520openid%2520profile%2520reportingApi%2520portalApi%2520offline_access%26code_challenge%3DRaOI-Ln_ePSDimLT3ryZWEMQIiVybDaGE9VTg1gTu44%26code_challenge_method%3DS256  200 OK  -   0.379 sec   0
Passed          https://qa.***.com/identityserver/css/app.css   200 OK  -   0.008 sec   0
Passed          https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css   200 OK  -   0.020 sec   0
Passed          https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.1/cookieconsent.min.js    200 OK  -   0.008 sec   0
Passed          https://qa.***.com/identityserver/***-logo-primary.svg  200 OK  -   0.009 sec   0
Passed          https://qa.***.com/identityserver/lib/jquery/jquery.js  200 OK  -   0.007 sec   0
Passed          https://qa.***.com/identityserver/js/app.js 200 OK  -   0.009 sec   0
Passed          https://qa.***.com/identityserver/fonts/apercu/light/apercu-light-pro.eot   200 OK  -   0.002 sec   0
Passed          https://qa.***.com/identityserver/fonts/apercu/regular/apercu-regular-pro.eot   200 OK  -   0.003 sec   0
Passed          https://qa.***.com/identityserver/fonts/apercu/medium/apercu-medium-pro.eot 200 OK  -   0.001 sec   0
Passed  https://qa.***.com/identityserver/fonts/fontawesome/fa-light-300.eot    200 OK  0.003 sec   0.003 sec   0
Passed  https://qa.***.com/identityserver/fonts/fontawesome/fa-regular-400.eot  200 OK  0.004 sec   0.004 sec   0
Passed  https://qa.***.com/identityserver/fonts/fontawesome/fa-solid-900.eot    200 OK  0.003 sec   0.003 sec   0
Passed  https://qa.***.com/identityserver/Account/Login 0 0 3.341 sec   1.497 sec   0
Passed      https://portal-qa.***.com/fonts/apercu-light-pro.55f01ab6.eot   200 OK  -   0.002 sec   0
Passed      https://portal-qa.***.com/fonts/apercu-regular-pro.ad897f51.eot 200 OK  -   0.002 sec   0
Passed      https://portal-qa.***.com/fonts/apercu-medium-pro.27a3987c.eot  200 OK  -   0.002 sec   0
Passed      https://qa.***.com/identityserver/connect/token 200 OK  -   0.842 sec   0
Passed  https://qa.***.com/identityserver/Account/Login     1.921 sec   -   -
Passed      https://qa.***.com/identityserver/connect/authorize/callback        -   -   -
Passed      https://portal-qa.***.com/sign-in?code=83ad6ae0d1d85fa29811a989e5163048fe8620f6135455ca644d1d5f446134a8&scope=pcoProfile%20openid%20profile%20***IdentityApi%20reportingApi%20portalApi%20offline_access&state=%2Ftransactions&session_state=WJ3CeIFnO79UAiPetCFUHzNSEbF9cSDwXvulUWkr244.ae03a8ccef5b763b1457fa790e0d83ad   200 OK  -   1.921 sec   0
Passed          https://portal-qa.***.com/css/chunk-vendors.a903617c.css    200 OK  -   0.009 sec   0
Passed          https://portal-qa.***.com/css/app.b3b1d014.css  200 OK  -   0.009 sec   0
Passed          https://portal-qa.***.com/js/chunk-vendors.dc65dbba.js  200 OK  -   0.009 sec   0
Passed          https://portal-qa.***.com/js/app.5db053cd.js    200 OK  -   0.007 sec   0
Passed  https://qa.***.com/identityserver/connect/userinfo  204 NoContent   0.041 sec   0.041 sec   0
Passed  https://qa.***.com/identityserver/connect/userinfo  200 OK  0.448 sec   0.448 sec   0
Passed  https://qa.***.com/management/user/policyRoles  204 NoContent   0.038 sec   0.038 sec   0
Passed  https://qa.***.com/management/user/policyRoles  200 OK  0.245 sec   0.245 sec   0
Passed  https://qa.***.com/management/businesses    204 NoContent   0.051 sec   0.051 sec   0
Passed  https://qa.***.com/management/businesses    200 OK  0.325 sec   0.325 sec   0

测试结果

Passed  http://portal-qa.***.com/   301 Moved Permanently   0.691 sec   0.161 sec   0
Passed      https://portal-qa.***.com/  200 OK  -   0.163 sec   574,226
Passed          https://portal-qa.***.com/css/chunk-vendors.a903617c.css    200 OK  -   0.075 sec   4,653
Passed          https://portal-qa.***.com/css/app.b3b1d014.css  200 OK  -   0.128 sec   50,069
Passed          https://portal-qa.***.com/js/app.5db053cd.js    200 OK  -   0.148 sec   54,291
Passed          https://portal-qa.***.com/js/chunk-vendors.dc65dbba.js  200 OK  -   0.343 sec   464,356
Passed  https://qa.***.com/identityserver/connect/authorize 302 Moved Temporarily   0.322 sec   0.096 sec   0
Passed      https://qa.***.com/identityserver/Account/Login 200 OK  -   0.067 sec   92,765
Passed          https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.1/cookieconsent.min.js    200 OK  -   0.037 sec   6,773
Passed          https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css   200 OK  -   0.043 sec   1,215
Passed          https://qa.***.com/identityserver/css/app.css   200 OK  -   0.051 sec   3,570
Passed          https://qa.***.com/identityserver/***-logo-primary.svg  200 OK  -   0.067 sec   4,044
Passed          https://qa.***.com/identityserver/js/app.js 200 OK  -   0.085 sec   945
Passed          https://qa.***.com/identityserver/lib/jquery/jquery.js  200 OK  -   0.153 sec   74,245
Failed  https://qa.***.com/identityserver/Account/Login     0.015 sec   0.015 sec   0
Passed  https://qa.***.com/identityserver/Account/Login 302 Moved Temporarily   0.824 sec   0.442 sec   4,314
Passed      https://qa.***.com/identityserver/connect/authorize/callback    302 Moved Temporarily   -   0.189 sec   0
Passed      https://portal-qa.***.com/sign-in   200 OK  -   0.033 sec   574,226
Passed          https://portal-qa.***.com/css/chunk-vendors.a903617c.css    200 OK  -   0.048 sec   4,653
Passed          https://portal-qa.***.com/css/app.b3b1d014.css  200 OK  -   0.068 sec   50,069
Passed          https://portal-qa.***.com/js/app.5db053cd.js    200 OK  -   0.080 sec   54,291
Passed          https://portal-qa.***.com/js/chunk-vendors.dc65dbba.js  200 OK  -   0.157 sec   464,356
Failed  https://qa.***.com/identityserver/connect/userinfo  405 Method Not Allowed  0.048 sec   0.048 sec   0
Failed  https://qa.***.com/identityserver/connect/userinfo  401 Unauthorized    0.044 sec   0.044 sec   0
Failed  https://qa.***.com/management/user/policyRoles  404 Not Found   0.046 sec   0.046 sec   0
Failed  https://qa.***.com/management/user/policyRoles  401 Unauthorized    0.038 sec   0.038 sec   0
Failed  https://qa.***.com/management/businesses    404 Not Found   0.042 sec   0.042 sec   0
Failed  https://qa.***.com/management/businesses    Submitting...   0.041 sec   0.041 sec   0

https://i.stack.imgur.com/KGZOA.png

【问题讨论】:

  • 显示您的 webtest 文件(以 PNG 格式)没有用。显示生成 webtest 时生成的日志会更好 - 并将其显示为文本,而不是无法搜索的图像。另请参阅stackoverflow.com/questions/49239972/…,这可能会提供答案。
  • 嘿阿德里安,我在发布之前尝试了以前的修复。我在主要问题中添加了 webtest 结果。
  • web 测试结果没有用,你之前说他们失败了。我询问了录音的细节。在docs.microsoft.com/en-us/archive/blogs/edglas/…页面搜索“记录仪日志”
  • 嗨阿德里安,我已经添加了记录日志和测试结果。希望这是您所要求的。
  • 诊断 Web 测试中的错误可能很复杂。有许多网页描述了不同的方法。这是您的问题,如果您在这里需要帮助,那么您需要努力提供其他人需要帮助您的信息。我在您附加的日志中看不到任何有用的东西。您是否将录音与跑步进行比较,它是否向您透露了什么?关注第一个没有达到预期效果的请求,忽略后面的任何请求。

标签: performance visual-studio-2019 load-testing qa web-testing


【解决方案1】:

这篇文章中的问题并不是解释的确切问题,但 Visual Studio Load Tester 产生的错误让我相信 OAuth PKCE 是问题所在。

实际问题是 Visual Studio 正在记录不必要的请求并尝试在 GET 方法中使用查询字符串。这些请求使测试失败的真正原因变得模糊不清,一旦我删除了所有不必要的请求,例如字体、非法请求并将验证令牌发布到正确的位置,测试就会按预期工作。

将验证令牌发布到正确的位置仍然给我同样的“未经授权”错误,直到我删除非法的GET 请求,我才能够确定其他所有内容的正确位置。

我要感谢 AdrianHHH 在没有这些信息的情况下为我提供了更好地调试 VSLT 的提示,我仍然会考虑翻转表。过去 VSLT 只是为我工作,所以这是一个很好的挑战。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-11
    • 1970-01-01
    相关资源
    最近更新 更多