Jmeter Performance Test-Azure AD SAML/OAuth B2B/B2C
Hi,
Our site uses MS Azure AD SAML/OAuth B2B/B2C to authenticate all users. In order to automate the performance tests using JMeter, we need to simulate the login into the Azure AD initially. We captured all the requests in the browser to simulate the same in Jmeter.
So far, we are following these steps:
GET to the custom B2C generic SAML login page with the entity id passed as a query parameter.
From this point we get the following parameters that are used in the next step: csrftoken, transid, nonce
This step is working as expected and we get all expected parameters.
POST to selfAsserted endpoint with the params : tx (transid), p (policy) etc. This step is working as expected and we get {status: "200"} as response.
GET to selfAsserted/confirmed with the params : p, tx, csrf_token and diags. This step is working as expected and we get 302 to authorize URL as response.
GET to authorize URL : login.microsoftonline.com/clientID/oauth2/v2.0/authorize with params : client_id, redirect_uri, response_type, scope, response_mode, nonce, state, sso_reload(true).
From this point we get the following parameters that are used in the next step: esctx, canary, ApiCanary, flowToken, originalRequest, hpgact, hpgid, hpgrequestid, x-ms-request-id, buid, ctx
This step is working as expected and we get all the expected parameters.
POST to login.microsoftonline.com/clientID/login
We made a POST using Content-Type application/x-www-form-urlencoded and the body consisting of flowToken, login, password, canary, hpgrequestid and ctx.
This step is working as expected and we get the code, state and session_state as part of the response body.
POST to redirect_uri with the code, state and session_state in its body : We get back SAMLResponse, but its invalid when we decode.
(Message: An invalid OAuth response was received)
We have added the correlation between the steps and verified that we are passing all the cookies and headers to every step (HTTP Request) in the Test Plan and so far we get the same responses and cookies as if we were in the browser.
Please let us know if we are missing anything or what can be done to get the correct SAMLResponse.
Thanks a lot in advance.
Best regards,