From 83f7f04929c17bb9631afa60b17e438011d36204 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 4 May 2021 12:00:10 -0400 Subject: [PATCH] island: Change order of methods in Authenticate to follow stepdown rule --- monkey/monkey_island/cc/resources/auth/auth.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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):