From 8c428aa44d5c178b55b1525ac9c0ee6dd5567bce Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Mon, 22 Jun 2020 11:57:48 +0300 Subject: [PATCH] Added registration to aws, small typo fixes --- monkey/monkey_island/cc/environment/aws.py | 8 ++++---- monkey/monkey_island/cc/resources/auth/auth.py | 2 +- monkey/monkey_island/cc/resources/auth/user_store.py | 4 ++-- monkey/monkey_island/cc/ui/src/components/Main.js | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/monkey/monkey_island/cc/environment/aws.py b/monkey/monkey_island/cc/environment/aws.py index b8f684289..27c0cd86e 100644 --- a/monkey/monkey_island/cc/environment/aws.py +++ b/monkey/monkey_island/cc/environment/aws.py @@ -23,7 +23,7 @@ class AwsEnvironment(Environment): return self.aws_info.get_region() def get_auth_users(self): - return [ - # TODO change this to propper registration? - User(1, 'monkey', self.hash_secret(self._instance_id)) - ] + if self._is_registered(): + return self._config.get_users() + else: + return [] diff --git a/monkey/monkey_island/cc/resources/auth/auth.py b/monkey/monkey_island/cc/resources/auth/auth.py index 6e9ec650c..9d2e7e7e8 100644 --- a/monkey/monkey_island/cc/resources/auth/auth.py +++ b/monkey/monkey_island/cc/resources/auth/auth.py @@ -20,7 +20,7 @@ def init_jwt(app): def identity(payload): user_id = payload['identity'] - return user_store.UserStore.userid_table.get(user_id, None) + return user_store.UserStore.user_id_table.get(user_id, None) JWT(app, authenticate, identity) diff --git a/monkey/monkey_island/cc/resources/auth/user_store.py b/monkey/monkey_island/cc/resources/auth/user_store.py index 7cb43e222..a35f4b3d6 100644 --- a/monkey/monkey_island/cc/resources/auth/user_store.py +++ b/monkey/monkey_island/cc/resources/auth/user_store.py @@ -6,10 +6,10 @@ from monkey_island.cc.resources.auth.auth_user import User class UserStore: users = [] username_table = {} - userid_table = {} + user_id_table = {} @staticmethod def set_users(users: List[User]): UserStore.users = users UserStore.username_table = {u.username: u for u in UserStore.users} - UserStore.userid_table = {u.id: u for u in UserStore.users} + UserStore.user_id_table = {u.id: u for u in UserStore.users} diff --git a/monkey/monkey_island/cc/ui/src/components/Main.js b/monkey/monkey_island/cc/ui/src/components/Main.js index 43971c6c9..477e89bde 100644 --- a/monkey/monkey_island/cc/ui/src/components/Main.js +++ b/monkey/monkey_island/cc/ui/src/components/Main.js @@ -1,6 +1,6 @@ import React from 'react'; import {BrowserRouter as Router, Redirect, Route, Switch} from 'react-router-dom'; -import {Container, Row} from 'react-bootstrap'; +import {Container} from 'react-bootstrap'; import RunServerPage from 'components/pages/RunServerPage'; import ConfigurePage from 'components/pages/ConfigurePage';