Jmeter OAuth 1.0 Request

你说的曾经没有我的故事 提交于 2019-12-12 03:22:58

问题


I have a Java code for OAuth 1.0 Authentication and each time i have to execute it before testing each request. I am currently working on JSR223 sampler.

But happen to see this OAuth 1.0 Plugin, can someone explain me how this OAuth 1.0 based Authentication in the screenshot works.

I have some parameter value to be passed in the Authorization header output example given below for each request.

For the first URL, I have two parameter

  1. Key
  2. Secret Key

Which give the Access token and secret access token for the Second URL and for the third it will add

  1. request Payload
  2. Email
  3. Status

without these the request will fail.

My output code looks like the below in Eclipse:-

Authorization :OAuth oauth_signature="Dynamic Value",scope="Parameter Value",oauth_version="Dynamic Value",oauth_nonce="Dynamic Value",oauth_signature_method=HMAC-SHA1,oauth_consumer_key="Parameter Value",oauth_token="Dynamic Value",oauth_timestamp="Dynamic Value"

Is there a way that i run the piece of Java code directly with all the Jar files in Jmeter [without doing any changes] is that possible?

OAuth 1.0 Plugin


回答1:


I would suggest adding OAuth client libraries to JMeter's classpath (just drop them to /lib folder of your JMeter installation)

Also download the latest version of groovy-all.jar and put it to the same /lib folder. Restart JMeter to pick the jars up.

Then add JSR223 Sampler to your Test Plan, choose "groovy" in "Language" drop-down and put your Java code to "Script" area. Valid Java code in 99% of cases will be valid Groovy code so you can run it this way.

See How to Run Performance Tests on OAuth Secured Apps with JMeter guide for more detailed information on the domain.



来源:https://stackoverflow.com/questions/34524009/jmeter-oauth-1-0-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!