From 9ee9c1db0a0e1c4a13e9555f211d992c00ea86b6 Mon Sep 17 00:00:00 2001
From: claudio <claudio.sousa@epfl.ch>
Date: Tue, 3 Jul 2018 18:03:59 +0200
Subject: [PATCH] [NRRPLT-6711] authentication headers required

Change-Id: I0ed57700d02de6206f6d9a89eb65c140ed08b954
---
 hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/virtual_coach.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/virtual_coach.py b/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/virtual_coach.py
index bedf6a3..bd67c81 100644
--- a/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/virtual_coach.py
+++ b/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/virtual_coach.py
@@ -386,15 +386,16 @@ class VirtualCoach(object):
         assert isinstance(cloned, bool)
 
         logger.info('Retrieving list of experiments.')
+        headers = None if self.__oidc_username else self.__storage_headers
         if cloned:
             url = self.__config['proxy-services']['storage-experiment-list']
-            response = requests.get(url, headers=self.__storage_headers)
+            response = requests.get(url, headers=headers)
             # return a simple list containing only experiment names since this is the only
             # information in the dictionary anyway
             return [experiment['name'] for experiment in json.loads(response.content)]
         else:
             _, response = self.__oidc_client.request(
-                self.__config['proxy-services']['experiment-list'])
+                self.__config['proxy-services']['experiment-list'], headers=headers)
             return json.loads(response)
 
     def __get_available_server_list(self):
-- 
GitLab