Fixed a bug in the Rest controller.
Implemented basic token based auth.