bug 832. Fixing non-authorized configuration for testing
Change-Id: I3c851031e902da8dddf542ee40c64699e088f6e8
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
diff --git a/osm_nbi/auth.py b/osm_nbi/auth.py
index fde7455..c320d50 100644
--- a/osm_nbi/auth.py
+++ b/osm_nbi/auth.py
@@ -348,6 +348,12 @@
if cherrypy.session.get('Authorization'):
del cherrypy.session['Authorization']
cherrypy.response.headers["WWW-Authenticate"] = 'Bearer realm="{}"'.format(e)
+ elif self.config.get("user_not_authorized"):
+ # TODO provide user_id, roles id (not name), project_id
+ return {"id": "fake-token-id-for-test",
+ "project_id": self.config.get("project_not_authorized", "admin"),
+ "username": self.config["user_not_authorized"],
+ "roles": ["system_admin"]}
raise
def new_token(self, token_info, indata, remote):