Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
NotChristianGarcia committed Nov 21, 2024
1 parent 632bd41 commit 9103d60
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions service/api_pods_podid_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ async def pod_auth(pod_id_net, request: Request):
Process a callback from a Tapis authorization server:
1) Get the authorization code from the query parameters.
2) Exchange the code for a token
3) Add the user and token to the sessionhttps
4) Redirect to the /data endpoint.
3) Add the user and token to the session
4) Redirect to the /data endpoint
"""
logger.debug(f"GET /pods/{pod_id_net}/auth - pod-auth, headers: {request.headers}, request.cookies: {request.cookies}")
# In cases where networking key is not 'default', the pod_id_net is f"{pod_id}-{network_key}"
Expand Down Expand Up @@ -412,7 +412,7 @@ async def pod_auth(pod_id_net, request: Request):
return JSONResponse(content = msg, status_code = 500)
msg = (f"Error creating client_id: {client_id}. e.message: {e.message}, e.request: {e.request}, e.response: {e.response}, tapis_debug = {td}")
logger.warning(msg)
return JSONResponse(content = msg, status_code = 500)
# return JSONResponse(content = msg, status_code = 500)



Expand All @@ -423,8 +423,6 @@ async def pod_auth(pod_id_net, request: Request):

# Shouldn't be able to get here
raise Exception(f"not implemented")
return ok("I promise I'm healthy.")


@router.get(
"/pods/{pod_id_net}/auth/callback",
Expand All @@ -445,14 +443,17 @@ 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



# return JSONResponse(content = f"Callback for pod_id_net: {pod_id_net}, tapis_domain: {tapis_domain}", status_code = 200)
# return JSONResponse(content = str(dir(request)))
# code = request.args.get('code')
# if not code:
# raise Exception(f"Error: No code in request; debug: {request.args}")
code = request.args.get('code')
if not code:
raise Exception(f"Error: No code in request; debug: {request.args}")
logger.debug(f"GET /pods/{pod_id_net}/auth/callback - pod_auth_callback, code: {code}")
url = f"https://{tapis_domain}/v3/oauth2/tokens"
data = {
"code": "code",
"code": code,
"redirect_uri": f"https://{tapis_domain}/v3/oauth2/callback",
"grant_type": "authorization_code",
}
Expand Down

0 comments on commit 9103d60

Please sign in to comment.