Skip to content

Commit

Permalink
Add CSRF guard header to the get calls (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
balciiberk authored Dec 3, 2023
1 parent 4ab80c9 commit b45d4ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vomsimporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,17 @@ def get_voms_users(self, start=None, pagesize=None):
url = "https://%s:8443/voms/%s/apiv2/users" % (self._host, self._vo)

r = self._session.get(
url, params={'startIndex': start, 'pageSize': pagesize})
url, params={'startIndex': start, 'pageSize': pagesize},
headers= {'X-VOMS-CSRF-GUARD': "y"})
r.raise_for_status()
return r.json()

def get_voms_user(self, uid):
logging.debug("Loading VOMS user by id: %d", uid)
url = "https://%s:8443/voms/%s/apiv2/user-info" % (
self._host, self._vo)
r = self._session.get(url, params={'userId': uid})
r = self._session.get(url, params={'userId': uid},
headers= {'X-VOMS-CSRF-GUARD': "y"})
r.raise_for_status()
return r.json()

Expand Down

0 comments on commit b45d4ab

Please sign in to comment.