Added AuthorizeUser function.