From 9f02fd4e4401ced748a166f0f03e2dc18b1fdd52 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 2 Aug 2022 14:42:58 +0530 Subject: [PATCH] Island: Add docstrings to Authenticate resource --- .../cc/resources/auth/authenticate.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/monkey/monkey_island/cc/resources/auth/authenticate.py b/monkey/monkey_island/cc/resources/auth/authenticate.py index a4b4468ec..f7ffe251b 100644 --- a/monkey/monkey_island/cc/resources/auth/authenticate.py +++ b/monkey/monkey_island/cc/resources/auth/authenticate.py @@ -22,10 +22,7 @@ def init_jwt(app): class Authenticate(AbstractResource): """ - Resource for user authentication. The user provides the username and password and we \ - give them a JWT. \ - See `AuthService.js` file for the frontend counterpart for this code. \ - + A resource for user authentication """ urls = ["/api/authenticate"] @@ -35,13 +32,13 @@ class Authenticate(AbstractResource): def post(self): """ - Example request: \ - { \ - "username": "my_user", \ - "password": "my_password" \ - } \ + Gets a username and password from the request sent from the client, authenticates, and + returns an access token + :return: Access token in the response body + :raises IncorrectCredentialsError: If credentials are invalid """ + username, password = get_username_password_from_request(request) try: