diff --git a/plexpy/__init__.py b/plexpy/__init__.py index 95e0cfd2..2454e198 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -217,15 +217,10 @@ def initialize(config_file): CONFIG.write() # Check if Tautulli has a jwt_secret - if CONFIG.JWT_SECRET == '' or not CONFIG.JWT_SECRET: + if CONFIG.JWT_SECRET == '' or not CONFIG.JWT_SECRET or CONFIG.JWT_UPDATE_SECRET: logger.debug(u"Generating JWT secret...") CONFIG.JWT_SECRET = generate_uuid() - CONFIG.write() - - if CONFIG.JWT_UUID == '' or CONFIG.JWT_UPDATE_UUID: - logger.debug(u"Generating JWT UUID...") - CONFIG.JWT_UUID = generate_uuid() - CONFIG.JWT_UPDATE_UUID = False + CONFIG.JWT_UPDATE_SECRET = False CONFIG.write() # Get the previous version from the file diff --git a/plexpy/config.py b/plexpy/config.py index 06018904..4fc5c4ac 100644 --- a/plexpy/config.py +++ b/plexpy/config.py @@ -624,8 +624,7 @@ _CONFIG_DEFINITIONS = { 'XBMC_ON_CONCURRENT': (int, 'XBMC', 0), 'XBMC_ON_NEWDEVICE': (int, 'XBMC', 0), 'JWT_SECRET': (str, 'Advanced', ''), - 'JWT_UUID': (str, 'Advanced', ''), - 'JWT_UPDATE_UUID': (bool_int, 'Advanced', 0), + 'JWT_UPDATE_SECRET': (bool_int, 'Advanced', 0), 'SYSTEM_ANALYTICS': (int, 'Advanced', 1), 'WIN_SYS_TRAY': (int, 'General', 1) } @@ -923,8 +922,3 @@ class Config(object): self.BUFFER_THRESHOLD = max(self.BUFFER_THRESHOLD, 10) self.CONFIG_VERSION = 13 - - if self.CONFIG_VERSION == 13: - self.JWT_UUID = self.PMS_UUID - - self.CONFIG_VERSION = 14 diff --git a/plexpy/webauth.py b/plexpy/webauth.py index 9027228d..d3a89af7 100644 --- a/plexpy/webauth.py +++ b/plexpy/webauth.py @@ -139,7 +139,7 @@ def check_credentials(username=None, password=None, token=None, admin_login='0', def check_jwt_token(): - jwt_cookie = JWT_COOKIE_NAME + plexpy.CONFIG.JWT_UUID + jwt_cookie = JWT_COOKIE_NAME + plexpy.CONFIG.PMS_UUID jwt_token = cherrypy.request.cookie.get(jwt_cookie) if jwt_token: @@ -285,7 +285,7 @@ class AuthController(object): if payload: self.on_logout(payload['user'], payload['user_group']) - jwt_cookie = JWT_COOKIE_NAME + plexpy.CONFIG.JWT_UUID + jwt_cookie = JWT_COOKIE_NAME + plexpy.CONFIG.PMS_UUID cherrypy.response.cookie[jwt_cookie] = 'expire' cherrypy.response.cookie[jwt_cookie]['expires'] = 0 cherrypy.response.cookie[jwt_cookie]['path'] = '/' @@ -331,14 +331,14 @@ class AuthController(object): success=True, oauth=bool(token)) - jwt_cookie = JWT_COOKIE_NAME + plexpy.CONFIG.JWT_UUID + jwt_cookie = JWT_COOKIE_NAME + plexpy.CONFIG.PMS_UUID cherrypy.response.cookie[jwt_cookie] = jwt_token cherrypy.response.cookie[jwt_cookie]['expires'] = int(time_delta.total_seconds()) cherrypy.response.cookie[jwt_cookie]['path'] = '/' cherrypy.request.login = payload cherrypy.response.status = 200 - return {'status': 'success', 'token': jwt_token.decode('utf-8'), 'uuid': plexpy.CONFIG.JWT_UUID} + return {'status': 'success', 'token': jwt_token.decode('utf-8'), 'uuid': plexpy.CONFIG.PMS_UUID} elif admin_login == '1' and username: self.on_login(username=username) diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 3f3e529a..2f4cc458 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -53,7 +53,6 @@ import pmsconnect import users import versioncheck import web_socket -import webauth from plexpy.api2 import API2 from plexpy.helpers import checked, addtoapi, get_ip, create_https_certificates, build_datatables_json, sanitize_out from plexpy.session import get_session_info, get_session_user_id, allow_session_user, allow_session_library @@ -2857,14 +2856,14 @@ class WebInterface(object): kwargs['http_password'] = plexpy.CONFIG.HTTP_PASSWORD # Flag to refresh JWT uuid to log out clients - kwargs['jwt_update_uuid'] = True + kwargs['jwt_update_secret'] = True elif kwargs['http_password'] and kwargs.get('http_hash_password'): kwargs['http_password'] = make_hash(kwargs['http_password']) kwargs['http_hashed_password'] = 1 # Flag to refresh JWT uuid to log out clients - kwargs['jwt_update_uuid'] = True + kwargs['jwt_update_secret'] = True elif not kwargs.get('http_hash_password'): kwargs['http_hashed_password'] = 0