From a8646fc0561960d90e7f41b9e3b77ba86ddd471a Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 4 May 2021 12:09:04 -0400 Subject: [PATCH] island: Give _authenticate() more descriptive name and remove comment --- monkey/monkey_island/cc/resources/auth/auth.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/monkey/monkey_island/cc/resources/auth/auth.py b/monkey/monkey_island/cc/resources/auth/auth.py index 0137b5b36..a6f395424 100644 --- a/monkey/monkey_island/cc/resources/auth/auth.py +++ b/monkey/monkey_island/cc/resources/auth/auth.py @@ -38,10 +38,9 @@ class Authenticate(flask_restful.Resource): "password": "my_password" } """ - (username, password) = Authenticate._get_credentials_from_request(request) - # If the user and password have been previously registered - if self._authenticate(username, password): + + if self._credentials_match_registered_user(username, password): access_token = flask_jwt_extended.create_access_token( identity=user_store.UserStore.username_table[username].id ) @@ -62,7 +61,7 @@ class Authenticate(flask_restful.Resource): return (username, password) @staticmethod - def _authenticate(username, password): + def _credentials_match_registered_user(username, password): user = user_store.UserStore.username_table.get(username, None) if user and bcrypt.checkpw(password.encode("utf-8"), user.secret.encode("utf-8")): return True