How to simulate form authentication in Tomcat using JMeter?

I am very new to JMeter, but I have some ideas on what JMeter can be used for. I also have a Tomcat application with form authentication enabled. The thread I'm trying to use consists of:

  • HTTP request settings
  • HTTP cookie manager
  • HTTP Header Manager

and the following set of HTTP probes:

  • /app/logout.jsp Page ( /app/logout.jsp )
  • login page ( /app/login.jsp )
  • j_security_check (/ app/j_security_check )

where "Follow Redirects" and "Use KeepAlive" are included. I cannot understand why the response of the j_security_check request is redirected to logout.jsp . After checking the HTTP response in Chrome, I noticed that such a request redirects to index.jsp, but never goes to the exit page if the credentials are ok. First of all, I had the idea that I did not imitate all the HTTP headers of the browser, but I failed after I added them to the HTTP Header Manager:

 User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.859.0 Safari/535.2 Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding gzip,deflate,sdch Accept-Language en-US,en;q=0.8 Host localhost:8080 Referer http://localhost:8080/whapp/index.jsp 

But even after specifying all of them, I can not imitate authentication ... Any ideas? Thanks in advance.

+2
source share
1 answer

Did you try to record the login process or was it all done manually?

If in manual mode the parameter from one of your queries may be missing.

If written, there may be a hard-coded parameter that must be dynamic (JSessionID, etc.). You may need to add a GET with a regex to get this value and go to your POST.

If the JSessionID is expected as a parameter, you cannot pass it through the cookie manager, you need to do this as an HTTP parameter.

For a summary of the entry, see http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf

+2
source

Source: https://habr.com/ru/post/1491620/


All Articles