import React, { useState, useEffect } from "react"; import { Card, Title, Text, Grid, Col, Button as TremorButton, Callout, TextInput, Divider, } from "@tremor/react"; import { message, Form } from "antd"; import { keyCreateCall } from "./networking"; import { CopyToClipboard } from "react-copy-to-clipboard"; import { LinkOutlined, KeyOutlined, CopyOutlined, ExclamationCircleOutlined, PlusCircleOutlined } from "@ant-design/icons"; interface SCIMConfigProps { accessToken: string | null; userID: string | null; proxySettings: any; } const SCIMConfig: React.FC = ({ accessToken, userID, proxySettings }) => { const [form] = Form.useForm(); const [isCreatingToken, setIsCreatingToken] = useState(false); const [tokenData, setTokenData] = useState(null); const [baseUrl, setBaseUrl] = useState(""); useEffect(() => { let url = ""; if (proxySettings && proxySettings.PROXY_BASE_URL && proxySettings.PROXY_BASE_URL !== undefined) { url = proxySettings.PROXY_BASE_URL; } else if (typeof window !== 'undefined') { // Use the current origin as the base URL if no proxy URL is set url = window.location.origin; } setBaseUrl(url); }, [proxySettings]); const scimBaseUrl = `${baseUrl}/scim/v2`; const handleCreateSCIMToken = async (values: any) => { if (!accessToken || !userID) { message.error("You need to be logged in to create a SCIM token"); return; } try { setIsCreatingToken(true); const formData = { key_alias: values.key_alias || "SCIM Access Token", team_id: null, models: [], allowed_routes: ["/scim/*"], }; const response = await keyCreateCall(accessToken, userID, formData); setTokenData(response); message.success("SCIM token created successfully"); } catch (error) { console.error("Error creating SCIM token:", error); message.error("Failed to create SCIM token"); } finally { setIsCreatingToken(false); } }; return (
SCIM Configuration
System for Cross-domain Identity Management (SCIM) allows you to automatically provision and manage users and groups in LiteLLM.
{/* Step 1: SCIM URL */}
1
<LinkOutlined className="h-5 w-5 mr-2" /> SCIM Tenant URL
Use this URL in your identity provider SCIM integration settings.
message.success("URL copied to clipboard")} > Copy
{/* Step 2: SCIM Token */}
2
<KeyOutlined className="h-5 w-5 mr-2" /> Authentication Token
You need a SCIM token to authenticate with the SCIM API. Create one below and use it in your SCIM provider configuration. {!tokenData ? (
Create SCIM Token
) : (
Your SCIM Token
Make sure to copy this token now. You will not be able to see it again.
message.success("Token copied to clipboard")} > Copy
setTokenData(null)} > Create Another Token
)}
); }; export default SCIMConfig;