AJAX friendly responses for Security class

Final work around issue #1802 - creating templates for complex layout
operations and removing HTML from this controller.