Refactored authentication and user sessions.
Tested authentication and user sessions.
Merged in ExtendAuthentication.