Implemented cookie based authentication