diff --git a/monkey/monkey_island/cc/resources/auth/auth.py b/monkey/monkey_island/cc/resources/auth/auth.py index 0d1ac3d30..4fd9b66a0 100644 --- a/monkey/monkey_island/cc/resources/auth/auth.py +++ b/monkey/monkey_island/cc/resources/auth/auth.py @@ -30,14 +30,6 @@ class Authenticate(flask_restful.Resource): See `AuthService.js` file for the frontend counterpart for this code. """ - @staticmethod - def _authenticate(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 - - return False - def post(self): """ Example request: @@ -62,6 +54,14 @@ class Authenticate(flask_restful.Resource): else: return make_response({"error": "Invalid credentials"}, 401) + @staticmethod + def _authenticate(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 + + return False + # See https://flask-jwt-extended.readthedocs.io/en/stable/custom_decorators/ def jwt_required(fn):