Added initial version of user authentication.

The logic for implementation was to have a minimal impact on the
existing system. The implementation might have to bechanged in future
releases, but it should get the job done for now.