Skip to content

Commit

Permalink
derive tenant from host
Browse files Browse the repository at this point in the history
  • Loading branch information
NotChristianGarcia committed Nov 21, 2024
1 parent 06874f0 commit 7975e19
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions service/api_pods_podid_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ async def pod_auth(pod_id_net, request: Request):
# Get info for clients
# 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):
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)

Expand All @@ -369,7 +370,7 @@ async def pod_auth(pod_id_net, request: Request):

oauth2_url = f"https://{tapis_domain}/v3/oauth2/authorize?client_id={client_id}&redirect_uri={auth_callback_url}&response_type=code"

return JSONResponse(content = f"tenant_id: {g.request_tenant_id}, beep: {t.base_url}", status_code = 302)
return JSONResponse(content = f"tenant_id: {g.request_tenant_id}, tenant: {tapis_tenant} beep: {t.base_url}", status_code = 302)

# Create tapis client or update tapis client if needed
try:
Expand All @@ -379,7 +380,7 @@ async def pod_auth(pod_id_net, request: Request):
callback_url = auth_callback_url,
display_name = client_display_name,
description = client_description,
_x_tapis_tenant = g.request_tenant_id,
_x_tapis_tenant = tapis_tenant,
_x_tapis_user = "_tapis_pods",
_tapis_debug = True
)
Expand All @@ -393,7 +394,7 @@ async def pod_auth(pod_id_net, request: Request):
callback_url = auth_callback_url,
display_name = client_display_name,
description = client_description,
_x_tapis_tenant = g.request_tenant_id,
_x_tapis_tenant = tapis_tenant,
_x_tapis_user = "_tapis_pods",
_tapis_debug = True
)
Expand Down

0 comments on commit 7975e19

Please sign in to comment.