Added code for authentication and authorization