Add anti-CSRF support

This commit goes with the Web Server anti-CSRF patch.

It primarily tidies up some code and modifies a few interfaces.  This is an essential part of
the much larger commit on the PZH Web Server.  Both are required - https://github.com/webinos/webinos-pzhWebServer/pull/5

Jira issue: WP-781