summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/opnfv_testapi/common
diff options
context:
space:
mode:
authorrohitsakala <rohitsakala@gmail.com>2017-02-16 13:22:05 +0530
committerRohit Sakala <rohitsakala@gmail.com>2017-02-21 19:32:25 +0000
commit914c2788ae0f240c1a7a4e060213c531a602d6c7 (patch)
tree1dc2bd078345ade2f65dd2fbd1f7b06d46a9b1ad /utils/test/testapi/opnfv_testapi/common
parentbf3316238f541feb41b259b7e32c279433a7daee (diff)
Add token based authentication for post/update/delete
As the mongodb database is not so secure today, this has been added. The token is stored in the mongoDB database. For now, authenticate variable is set false so that there would be no problem in accessing the databse by jenkins jobs. JIRA: FUNCTEST-730 Change-Id: I12b3907d650fc63efbdb031ebf3dd09519750109 Signed-off-by: rohitsakala <rohitsakala@gmail.com>
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/common')
-rw-r--r--utils/test/testapi/opnfv_testapi/common/config.py5
-rw-r--r--utils/test/testapi/opnfv_testapi/common/constants.py1
2 files changed, 6 insertions, 0 deletions
diff --git a/utils/test/testapi/opnfv_testapi/common/config.py b/utils/test/testapi/opnfv_testapi/common/config.py
index 82d9c4de6..84a127391 100644
--- a/utils/test/testapi/opnfv_testapi/common/config.py
+++ b/utils/test/testapi/opnfv_testapi/common/config.py
@@ -34,6 +34,7 @@ class APIConfig:
self.mongo_dbname = None
self.api_port = None
self.api_debug_on = None
+ self.api_authenticate_on = None
self._parser = None
self.swagger_base_url = None
@@ -77,6 +78,9 @@ class APIConfig:
obj.api_port = obj._get_int_parameter("api", "port")
obj.api_debug_on = obj._get_bool_parameter("api", "debug")
+ obj.api_authenticate_on = obj._get_bool_parameter("api",
+ "authenticate")
+
obj.swagger_base_url = obj._get_parameter("swagger", "base_url")
return obj
@@ -90,4 +94,5 @@ class APIConfig:
self.mongo_dbname,
self.api_port,
self.api_debug_on,
+ self.api_authenticate_on,
self.swagger_base_url)
diff --git a/utils/test/testapi/opnfv_testapi/common/constants.py b/utils/test/testapi/opnfv_testapi/common/constants.py
index 4d39a142d..71bd95216 100644
--- a/utils/test/testapi/opnfv_testapi/common/constants.py
+++ b/utils/test/testapi/opnfv_testapi/common/constants.py
@@ -10,6 +10,7 @@
DEFAULT_REPRESENTATION = "application/json"
HTTP_BAD_REQUEST = 400
+HTTP_UNAUTHORIZED = 401
HTTP_FORBIDDEN = 403
HTTP_NOT_FOUND = 404
HTTP_OK = 200