diff --git a/app/logger/log.py b/app/logger/log.py index d38b485..1a10ae7 100644 --- a/app/logger/log.py +++ b/app/logger/log.py @@ -3,8 +3,7 @@ from app.utils import configParser from logging.handlers import TimedRotatingFileHandler -FORMATTER = logging.Formatter("""%(asctime)s - %(name)s - %(levelname)s - - %(message)s""") +FORMATTER = logging.Formatter("""%(asctime)s - %(name)s - %(levelname)s - %(message)s""") LOG_FILE = "{0}/{1}".format(configParser.getConfig('logging', 'config.global.py')['folder'], configParser.getConfig('logging', 'config.global.py')['file']) LEVEL = configParser.getConfig('logging', 'config.global.py')['level'] diff --git a/app/routers/authenticate.py b/app/routers/authenticate.py index 99c40e8..1f3f072 100644 --- a/app/routers/authenticate.py +++ b/app/routers/authenticate.py @@ -27,7 +27,7 @@ def initializeAuthOb(): oauth = OAuth() oauth.register( - 'rciam', + g.tenant + '.' + g.environment + '.rciam', client_id=oidc_config['client_id'], client_secret=oidc_config['client_secret'], server_metadata_url=oidc_config['issuer'] + "/.well-known/openid-configuration", @@ -46,7 +46,7 @@ async def login_endpoint( request: Request, oauth_ob= Depends(initializeAuthOb), server_config= Depends(getServerConfig)): - rciam = oauth_ob.create_client('rciam') + rciam = oauth_ob.create_client(g.tenant + '.' + g.environment + '.rciam') redirect_uri = server_config['protocol'] + "://" + server_config['host'] + server_config['api_path'] + "/auth" return await rciam.authorize_redirect(request, redirect_uri) @@ -71,7 +71,7 @@ async def authorize_rciam( response = RedirectResponse(url=urllib.parse.unquote(login_start_url)) response.delete_cookie("login_start") - rciam = oauth_ob.create_client('rciam') + rciam = oauth_ob.create_client(g.tenant + '.' + g.environment + '.rciam') try: token = await rciam.authorize_access_token(request) except OAuthError as error: @@ -148,7 +148,7 @@ async def logout( oauth_ob= Depends(initializeAuthOb), server_config=Depends(getServerConfig) ): - rciam = oauth_ob.create_client('rciam') + rciam = oauth_ob.create_client(g.tenant + '.' + g.environment + '.rciam') metadata = await rciam.load_server_metadata() # todo: Fix this after we complete the multitenacy redirect_uri = server_config['protocol'] + "://" + server_config['client'] +"/metrics" diff --git a/app/utils/globalMethods.py b/app/utils/globalMethods.py index 8cb9171..d0b234f 100644 --- a/app/utils/globalMethods.py +++ b/app/utils/globalMethods.py @@ -31,7 +31,7 @@ async def __call__(self, request: Request, response: Response): self.logger.debug("""{0}.{1}: Config File Name: {2}""".format(g.tenant, g.environment, config_file)) self.oauth.register( - 'rciam', + g.tenant + '.' + g.environment + '.rciam', client_id=oidc_config['client_id'], client_secret=oidc_config['client_secret'], server_metadata_url=oidc_config['issuer'] + "/.well-known/openid-configuration", @@ -42,7 +42,7 @@ async def __call__(self, request: Request, response: Response): # permissions calculation access_token = request.headers.get('x-access-token') - rciam = self.oauth.create_client('rciam') + rciam = self.oauth.create_client(g.tenant + '.' + g.environment + '.rciam') metadata = await rciam.load_server_metadata() headers = {'Authorization': f'Bearer {access_token}'}