admin管理员组文章数量:1405736
Im using FastAPI via Uvicorn, and deploying my application to an Azure App Service. Its being deployed to
# Start
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8080, forwarded_allow_ips="*", proxy_headers=True)
And I am integrating a SSO Login via SAML, and when logging in to the IdP's AD FS page it works fine, but when calling my callback function, the login first redirects to my correct address with a POST request, and a 307 Temporary Redirect code
, and after a page that asks if I want to proceed,
Middle Screen
It then rejects my callback because it calls /api/auth/callback using a POST to http instead of https, which calls a GET to https, which doesnt work for callback. Here are my login and callback functions:
@auth_router.get(API_PREFIX + "/auth/login")
async def sso_login(request: Request):
try:
auth = await init_saml_auth(request)
redirect_url = auth.login()
return RedirectResponse(url=redirect_url)
except Exception as e:
return JSONResponse({"error": str(e)}, status_code=500)
@auth_router.post(API_PREFIX + "/auth/callback/")
async def sso_callback(request: Request):
logging.info(request)
auth = await init_saml_auth(request)
auth.process_response()
if len(auth.get_errors()) != 0:
return JSONResponse({"error": auth.get_last_error_reason()}, status_code=400)
if not auth.is_authenticated():
return JSONResponse({"error": "Authentication failed"}, status_code=403)
user_data = auth.get_attributes()
return JSONResponse({"message": "SSO Login Successful", "user": user_data})
Why is this happening?
本文标签: single sign onFastAPI application redirect to HTTP and not HTTPSStack Overflow
版权声明:本文标题:single sign on - FastAPI application redirect to HTTP and not HTTPS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744933421a2633036.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论