Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
NotChristianGarcia committed Nov 22, 2024
1 parent 5ca3ddb commit 02e08ec
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions service/api_pods_podid_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,13 @@ async def pod_auth(pod_id_net, request: Request):
# The goal is: https://tacc.develop.tapis.io/v3/pods/{{pod_id}}/auth
pod_id, tapis_domain = net_info.url.split('.pods.') ## Should return `mypod` & `tacc.tapis.io` with proper tenant and schmu
tapis_tenant = tapis_domain.split('.')[0]
if not net_info.get('tapis_auth', False):
if not net_info.tapis_auth:
return JSONResponse(content = f"This pod does not have tapis_auth configured in networking for this pod_id_net: {pod_id_net}. Leave or remedy.", status_code = 403)


auth_url = f"https://{tapis_domain}/v3/pods/{pod_id_net}/auth"
auth_callback_url = f"https://{tapis_domain}/v3/pods/{pod_id_net}/auth/callback" # should match client callback_url
tapis_auth_response_headers = net_info.get('tapis_auth_response_headers', [])
tapis_auth_response_headers = net_info.tapis_auth_response_headers

client_id = f"PODS-SERVICE-{pod.k8_name}-{network_key}"
#client_key = "4STQ^t&RGa$sah!SZ9zCP9UScGoEkS^GYLZDjjtjPBipp4kVLyrr@X"
Expand Down Expand Up @@ -453,7 +453,7 @@ def callback(pod_id_net, request: Request):

pod_id, tapis_domain = net_info.url.split('.pods.') ## Should return `mypod` & `tacc.tapis.io` with proper tenant and schmu
tapis_tenant = tapis_domain.split('.')[0]
if not net_info.get('tapis_auth', False):
if not net_info.tapis_auth:
return JSONResponse(content = f"This pod does not have tapis_auth configured in networking for this pod_id_net: {pod_id_net}. Leave or remedy.", status_code = 403)

client_id = f"PODS-SERVICE-{pod.k8_name}-{network_key}"
Expand Down Expand Up @@ -498,7 +498,7 @@ def callback(pod_id_net, request: Request):
content = {"message": f"Callback for pod_id_net: {pod_id_net}, tapis_domain: {tapis_domain}, username: {username}, token: {token}"}

response = JSONResponse(content=content, status_code=200)
response = RedirectResponse(url=f"https://{net_info['url']}", status_code=302, headers={"X-Tapis-Username": username})
response = RedirectResponse(url=f"https://{net_info.url}", status_code=302, headers={"X-Tapis-Username": username})

domain = conf.get('COOKIE_DOMAIN', f".pods.{tapis_domain}")
response.set_cookie("X-Tapis-Token", token, domain=domain, secure=True)
Expand All @@ -508,7 +508,7 @@ def callback(pod_id_net, request: Request):
response.set_cookie("X-Tapis-Username", username, domain=net_info['url'], secure=True)

logger.debug(f"GET /pods/{pod_id_net}/auth/callback - pod_auth_callback last bit, response: {response}, net_info: {net_info}")
response = RedirectResponse(url=f"https://{net_info['url']}", status_code=302, headers={"X-Tapis-Username": username})
response = RedirectResponse(url=f"https://{net_info.url}", status_code=302, headers={"X-Tapis-Username": username})

return response
except Exception as e:
Expand Down

0 comments on commit 02e08ec

Please sign in to comment.