Commit 7249f684 authored by Joao Pedro Lopes's avatar Joao Pedro Lopes
Browse files

FTS-1734: Adapt response to /delegation/<delegation_id> to assure backwards...

FTS-1734: Adapt response to /delegation/<delegation_id> to assure backwards compatiblity with the old fts-rest clients
parent ec029cf5
Pipeline #3122433 passed with stages
in 12 minutes and 21 seconds
......@@ -241,12 +241,18 @@ class view(Delegation):
"""
user = flask.request.environ["fts3.User.Credentials"]
user_agent = flask.request.environ.get("HTTP_USER_AGENT", None)
if not user_agent:
log.debug("No HTTP_USER_AGENT header found")
if dlg_id != user.delegation_id:
raise Forbidden("The requested ID and the credentials ID do not match")
cred = Session.query(Credential).get((user.delegation_id, user.user_dn))
if not cred:
ret = None
if isinstance(user_agent, str) and user_agent.startswith("PycURL"):
return ret # FTS-1734: Assure backwards compatibility with old clients who expect a null response
else:
ret = {
"termination_time": cred.termination_time,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment