Implemented custom logic for authentication.