forked from p15670423/monkey
Island: Change Environment.get_auth_expiration_time() to a constant
This commit is contained in:
parent
e98aa81645
commit
e0fc3cec2a
|
@ -1,11 +1,11 @@
|
|||
import os
|
||||
import uuid
|
||||
from datetime import timedelta
|
||||
|
||||
import flask_restful
|
||||
from flask import Flask, Response, send_from_directory
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
||||
import monkey_island.cc.environment.environment_singleton as env_singleton
|
||||
from common.common_consts.api_url_consts import T1216_PBA_FILE_DOWNLOAD_PATH
|
||||
from monkey_island.cc.database import database, mongo
|
||||
from monkey_island.cc.resources.attack.attack_config import AttackConfiguration
|
||||
|
@ -58,6 +58,7 @@ from monkey_island.cc.services.remote_run_aws import RemoteRunAwsService
|
|||
from monkey_island.cc.services.representations import output_json
|
||||
|
||||
HOME_FILE = "index.html"
|
||||
AUTH_EXPIRATION_TIME = timedelta(minutes=30)
|
||||
|
||||
|
||||
def serve_static_file(static_path):
|
||||
|
@ -87,7 +88,7 @@ def init_app_config(app, mongo_url):
|
|||
app.config["MONGO_URI"] = mongo_url
|
||||
|
||||
# See https://flask-jwt-extended.readthedocs.io/en/stable/options
|
||||
app.config["JWT_ACCESS_TOKEN_EXPIRES"] = env_singleton.env.get_auth_expiration_time()
|
||||
app.config["JWT_ACCESS_TOKEN_EXPIRES"] = AUTH_EXPIRATION_TIME
|
||||
# Invalidate the signature of JWTs if the server process restarts. This avoids the edge case
|
||||
# of getting a JWT,
|
||||
# deciding to reset credentials and then still logging in with the old JWT.
|
||||
|
|
|
@ -12,8 +12,6 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class Environment(object, metaclass=ABCMeta):
|
||||
_AUTH_EXPIRATION_TIME = timedelta(minutes=30)
|
||||
|
||||
_testing = False
|
||||
|
||||
def __init__(self, config: EnvironmentConfig):
|
||||
|
@ -30,6 +28,3 @@ class Environment(object, metaclass=ABCMeta):
|
|||
|
||||
def get_config(self) -> EnvironmentConfig:
|
||||
return self._config
|
||||
|
||||
def get_auth_expiration_time(self):
|
||||
return self._AUTH_EXPIRATION_TIME
|
||||
|
|
Loading…
Reference in New Issue