Rudimentary support for Authentication. Working, but needing refactoring