LPS-32181 Refactor security access of template engine