Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \

EXPOSE 9000

# CMD ["/app/run.sh"]
CMD ["python", "app.py"]
CMD ["/app/run.sh"]
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
app = create_app()

if __name__ == "__main__":
app.run(port=9000)
app.run(host="0.0.0.0", port=9000)
2 changes: 2 additions & 0 deletions labconnect/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ def serializeOpportunity(data):

def prepare_flask_request(request):
# If server is behind proxys or balancers use the HTTP_X_FORWARDED fields
url_data = request.host_url + request.script_root
return {
"https": "on" if request.scheme == "https" else "off",
"http_host": request.host,
"script_name": request.path,
"server_port": url_data.split(":")[1] if ":" in url_data else "80",
"get_data": request.args.copy(),
# Uncomment if using ADFS as IdP, https://github.com/onelogin/python-saml/pull/144
# 'lowercase_urlencoding': True,
Expand Down
8 changes: 2 additions & 6 deletions labconnect/main/auth_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,10 @@ def saml_login():
@main_blueprint.post("/callback")
def saml_callback():
# Process SAML response
print("HERE")
req = prepare_flask_request(request)
print("req", req)
auth = OneLogin_Saml2_Auth(req, custom_base_path=current_app.config["SAML_CONFIG"])
print("auth", auth)
auth.process_response()
print("auth", auth)
errors = auth.get_errors()
print("errors", errors)

if not errors:
registered = True
Expand All @@ -102,7 +97,8 @@ def saml_callback():
# Send the JWT to the frontend
return redirect(f"{current_app.config['FRONTEND_URL']}/callback/?code={code}")

return {"errors": errors}, 500
error_reason = auth.get_last_error_reason()
return {"errors": errors, "error_reason": error_reason}, 500


@main_blueprint.post("/register")
Expand Down
Loading