Implemented sessions in authentication logic