diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 691bb1adf3..6416044d8c 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -2493,13 +2493,12 @@ class ProxyConfig: if success_callback not in litellm.success_callback: litellm.success_callback.append(success_callback) _added_callback = True - if _added_callback: - # we need to set env variables too - environment_variables = config_data.get("environment_variables", None) - for k, v in environment_variables.items(): - decoded_b64 = base64.b64decode(v) - value = decrypt_value(value=decoded_b64, master_key=master_key) - os.environ[k] = value + # we need to set env variables too + environment_variables = config_data.get("environment_variables", None) + for k, v in environment_variables.items(): + decoded_b64 = base64.b64decode(v) + value = decrypt_value(value=decoded_b64, master_key=master_key) + os.environ[k] = value except Exception as e: verbose_proxy_logger.error( "{}\nTraceback:{}".format(str(e), traceback.format_exc()) diff --git a/ui/litellm-dashboard/src/components/admins.tsx b/ui/litellm-dashboard/src/components/admins.tsx index b8995eb1d5..926df9b87c 100644 --- a/ui/litellm-dashboard/src/components/admins.tsx +++ b/ui/litellm-dashboard/src/components/admins.tsx @@ -40,6 +40,7 @@ import { Member, userGetAllUsersCall, User, + setCallbacksCall, } from "./networking"; const AdminPanel: React.FC = ({ @@ -56,6 +57,33 @@ const AdminPanel: React.FC = ({ const [isAddMemberModalVisible, setIsAddMemberModalVisible] = useState(false); const [isAddAdminModalVisible, setIsAddAdminModalVisible] = useState(false); const [isUpdateMemberModalVisible, setIsUpdateModalModalVisible] = useState(false); + const [isAddSSOModalVisible, setIsAddSSOModalVisible] = useState(false); + const [isInstructionsModalVisible, setIsInstructionsModalVisible] = useState(false); + +const handleAddSSOOk = () => { + setIsAddSSOModalVisible(false); + form.resetFields(); +}; + +const handleAddSSOCancel = () => { + setIsAddSSOModalVisible(false); + form.resetFields(); +}; + +const handleShowInstructions = (formValues: Record) => { + setIsAddSSOModalVisible(false); + setIsInstructionsModalVisible(true); + // Optionally, you can call handleSSOUpdate here with the formValues + // handleSSOUpdate(formValues); +}; + +const handleInstructionsOk = () => { + setIsInstructionsModalVisible(false); +}; + +const handleInstructionsCancel = () => { + setIsInstructionsModalVisible(false); +}; const roles = ["proxy_admin", "proxy_admin_viewer"] @@ -284,6 +312,20 @@ const AdminPanel: React.FC = ({ console.error("Error creating the key:", error); } }; + + const handleSSOUpdate = async (formValues: Record) => { + if (accessToken == null) { + return; + } + let payload = { + environment_variables: { + PROXY_BASE_URL: formValues.proxy_base_url, + GOOGLE_CLIENT_ID: formValues.google_client_id, + GOOGLE_CLIENT_SECRET: formValues.google_client_secret, + }, + }; + setCallbacksCall(accessToken, payload); + } console.log(`admins: ${admins?.length}`); return (
@@ -376,6 +418,84 @@ const AdminPanel: React.FC = ({
+ + Add SSO +
+ + + +
+ <> + + + + + + + + + + + + +
+ Save +
+
+ +
+ +

Follow these steps to complete the SSO setup:

+ + 1. DO NOT Exit this TAB + + + 2. Open a new tab, visit your proxy base url + + + 3. Confirm your SSO is configured correctly and you can login on the new Tab + + + 4. If Step 3 is successful, you can close this tab + +
+ Done +
+
+
+
); };