Form replay refactoring
I refactored Form replay for ##630 (closed) (revisions 3493 to 3496), but the work I did widely exceeds this ticket, so I think it is worth to open a new one to keep a trace of this work.
The old implementation was:
- handler intercepts GET requests to the form URL, and does not forward request to app but instead returns a blind html form with fake data, autosubmitted (just for the client to send a POST request)
- handler intercepts POST request to the target URL and replaces the fake POST parameters with parameters defined in manager.
The new implementation:
- handler intercepts GET requests to the form URL, and add some jQuery script in the html page head so that client fills the form with fake data and autosubmit it
- handler intercepts POST request to the target URL and modifies the POST data: parameters defined in manager are changed or added (if they are absent), other parameters are not changed
Drawbacks of the old implementation:
- intercepts all requests to the form URL, not only thoses whose response is a html page with a form
- tampers exchanges between client and app (for example, app may send a cookie with the html form, or require some POST param that LL::NG cannot guess)
- does not work natively with apache mod_proxy (requires Handler::Proxy - well, I think this was not hard to fix: don't use PerlResponseHandler, just replace OK with DONE)
Drawbacks of the new implementation:
- relies on jquery, and admin may need to know jQuery selectors (that is, css selectors)
- three new optional parameters in config: a jQuery URL, a jQuery selector for the form and a jQuery selector for the button to click on
Main advantages of the new implementation: it hardly disturbs exchanges between client and app, and increases the likelihood that form replay works.
I updated the doc, there is still an image to update and I don't know how to do it, can someone tell me ?
Clément, can you look at the doc (http://lemonldap-ng.org/documentation/latest/formreplay) and tell me if you validate the new implementation ?