X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Fnbi.py;h=07219bc1704d1b33bc62811de1c66a9197691071;hb=refs%2Fchanges%2F90%2F14190%2F1;hp=343ac0d2e4bcf9ed131ca70607e60309109c0a9a;hpb=7802ff80245ba7ba6055bc927b91e4f8b1f42542;p=osm%2FNBI.git diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index 343ac0d2..07219bc1 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -1091,9 +1091,13 @@ class Server(object): # for logging self._format_login(token_info) token_id = token_info["_id"] - token_details = self.engine.db.get_one("tokens", {"_id": token_id}) - current_user = token_details.get("username") - current_project = token_details.get("project_name") + if current_backend != "keystone": + token_details = self.engine.db.get_one("tokens", {"_id": token_id}) + current_user = token_details.get("username") + current_project = token_details.get("project_name") + else: + current_user = "keystone backend" + current_project = "keystone backend" outdata = self.authenticator.del_token(token_id) token_info = None cherrypy.session["Authorization"] = "logout" # pylint: disable=E1101 @@ -1411,7 +1415,7 @@ class Server(object): **kwargs ): token_info = None - outdata = None + outdata = {} _format = None method = "DONE" engine_topic = None @@ -1928,12 +1932,16 @@ def _start_service(): global nbi_server global subscription_thread global cef_logger + global current_backend cherrypy.log.error("Starting osm_nbi") # update general cherrypy configuration update_dict = {} engine_config = cherrypy.tree.apps["/osm"].config for k, v in environ.items(): + if k == "OSMNBI_USER_MANAGEMENT": + feature_state = eval(v.title()) + engine_config["authentication"]["user_management"] = feature_state if not k.startswith("OSMNBI_"): continue k1, _, k2 = k[7:].lower().partition("_") @@ -2039,6 +2047,7 @@ def _start_service(): # Do not capture except SubscriptionException backend = engine_config["authentication"]["backend"] + current_backend = backend cherrypy.log.error( "Starting OSM NBI Version '{} {}' with '{}' authentication backend".format( nbi_version, nbi_version_date, backend