Hello there! I'm trying to use WireMock running in...
# help
v
Hello there! I'm trying to use WireMock running in Docker to mock a SAML IDP for a browser login. My idea was to have a mock endpoint act as the Single SignOn Service endpoint which will redirect straight to the Assertion Consumer Service endpoint (
/acs
) but the problem is that the request flow starts with a
GET /mockedSSO
which should then 302 redirect to
POST /mockedACS
but it turns out it's not possible to change the HTTP verb when redirecting so I can't go from a
GET
to a
POST
. I tried also with webhook/callback but since it is asynchronous the browser does not render the callback response. Was hoping for some pointers since I imagine this kind of thing has been done before.
Currently my mapping looks something like this
Copy code
{
  "mappings": [
    {
      "request": {
        "method": "GET",
        "urlPath": "/mockedSSO"
      },
      "serveEventListeners": [
        {
          "name": "webhook",
          "parameters": {
            "method": "POST",
            "url": "http://<auth-service>/acs",
            "headers": {
              "Content-Type": "application/x-www-form-urlencoded"
            },
            "body": "SAMLResponse=<SAML Response Goes Here>"
          }
        }
      ]
    }
  ]
}
Since this is done in-browser there seems to be no way to render the response from
http://<auth-service>/acs
and I am stuck on the
/mockedSSO
endpoint.
r
http status codes dont support redirecting with a POST. one solution is to have the mockedSSO endpoint return some html with a form that performs the post when it's submitted, just like in a real saml flow. if you want the form to be submitted automatically without user input, you can add some javascript to the page to do that for you