improve sign in url style

This commit is contained in:
miloschwartz
2026-08-14 10:33:44 -04:00
parent c49c6f5837
commit ee75a09f8c
3 changed files with 33 additions and 39 deletions
+2 -2
View File
@@ -878,9 +878,9 @@
"policyAuthMethodOff": "Off", "policyAuthMethodOff": "Off",
"policyAuthSsoTitle": "Platform SSO", "policyAuthSsoTitle": "Platform SSO",
"policyAuthSsoDescription": "Require sign-in through your organization's identity provider", "policyAuthSsoDescription": "Require sign-in through your organization's identity provider",
"policyAuthInferenceSsoDescription": "Selected users and roles can authenticate to the gateway using their identity API key.", "policyAuthInferenceIdentityKeySignInUrl": "Sign-in URL",
"policyAuthInferenceIdentityKeyHelpNoUrl": "Every user already has an identity API key, so you only need to create virtual API keys for non-user clients or shared access. Users can retrieve their key by signing in with their identity provider at this resource's URL, where it will be shown after login.", "policyAuthInferenceIdentityKeyHelpNoUrl": "Every user already has an identity API key, so you only need to create virtual API keys for non-user clients or shared access. Users can retrieve their key by signing in with their identity provider at this resource's URL, where it will be shown after login.",
"policyAuthInferenceIdentityKeyHelp": "Every user already has an identity API key, so you only need to create virtual API keys for non-user clients or shared access. Users can retrieve their key by signing in with their identity provider at <resourceLink></resourceLink>, where it will be shown after login.", "policyAuthInferenceIdentityKeyHelp": "Every user already has an identity API key, so you only need to create virtual API keys for non-user clients or shared access. Users retrieve their key here after signing in with their identity provider.",
"policyAuthSsoSummary": "{idp} · {users} users, {roles} roles", "policyAuthSsoSummary": "{idp} · {users} users, {roles} roles",
"policyAuthSsoDefaultIdp": "Default provider", "policyAuthSsoDefaultIdp": "Default provider",
"policyAuthAddDefaultIdentityProvider": "Add Default Identity Provider", "policyAuthAddDefaultIdentityProvider": "Add Default Identity Provider",
@@ -1,5 +1,6 @@
"use client"; "use client";
import CopyToClipboard from "@app/components/CopyToClipboard";
import { SettingsFormCell, SettingsFormGrid } from "@app/components/Settings"; import { SettingsFormCell, SettingsFormGrid } from "@app/components/Settings";
import { SwitchInput } from "@app/components/SwitchInput"; import { SwitchInput } from "@app/components/SwitchInput";
import { Button } from "@app/components/ui/button"; import { Button } from "@app/components/ui/button";
@@ -32,6 +33,7 @@ export type PolicyAuthSsoSectionProps = {
ssoLocked?: boolean; ssoLocked?: boolean;
title?: string; title?: string;
description?: string; description?: string;
identityKeyUrl?: string | null;
}; };
export function PolicyAuthSsoSection({ export function PolicyAuthSsoSection({
@@ -46,7 +48,8 @@ export function PolicyAuthSsoSection({
idpDisabled, idpDisabled,
ssoLocked, ssoLocked,
title, title,
description description,
identityKeyUrl
}: PolicyAuthSsoSectionProps) { }: PolicyAuthSsoSectionProps) {
const t = useTranslations(); const t = useTranslations();
const [showIdpSelect, setShowIdpSelect] = useState(skipToIdpId != null); const [showIdpSelect, setShowIdpSelect] = useState(skipToIdpId != null);
@@ -79,11 +82,32 @@ export function PolicyAuthSsoSection({
{ssoActive && ( {ssoActive && (
<> <>
{ssoLocked && ssoDescription && ( {ssoLocked && identityKeyUrl !== undefined && (
<SettingsFormCell span="full"> <SettingsFormCell span="full">
{identityKeyUrl ? (
<FormItem>
<FormLabel>
{t(
"policyAuthInferenceIdentityKeySignInUrl"
)}
</FormLabel>
<CopyToClipboard
text={identityKeyUrl}
isLink
/>
<FormDescription>
{t(
"policyAuthInferenceIdentityKeyHelp"
)}
</FormDescription>
</FormItem>
) : (
<p className="text-sm text-muted-foreground"> <p className="text-sm text-muted-foreground">
{ssoDescription} {t(
"policyAuthInferenceIdentityKeyHelpNoUrl"
)}
</p> </p>
)}
</SettingsFormCell> </SettingsFormCell>
)} )}
<SettingsFormCell span="full"> <SettingsFormCell span="full">
@@ -15,7 +15,6 @@ import {
} from "@app/components/roles-selector"; } from "@app/components/roles-selector";
import { UsersSelector } from "@app/components/users-selector"; import { UsersSelector } from "@app/components/users-selector";
import { Button } from "@app/components/ui/button"; import { Button } from "@app/components/ui/button";
import { Alert, AlertDescription } from "@app/components/ui/alert";
import { Form, FormField } from "@app/components/ui/form"; import { Form, FormField } from "@app/components/ui/form";
import { toast } from "@app/hooks/useToast"; import { toast } from "@app/hooks/useToast";
import { useEnvContext } from "@app/hooks/useEnvContext"; import { useEnvContext } from "@app/hooks/useEnvContext";
@@ -29,7 +28,6 @@ import type { GetResourcePolicyResponse } from "@server/routers/policy";
import { UserType } from "@server/types/UserTypes"; import { UserType } from "@server/types/UserTypes";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import type { AxiosResponse } from "axios"; import type { AxiosResponse } from "axios";
import { ExternalLink, InfoIcon } from "lucide-react";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { toUnicode } from "punycode"; import { toUnicode } from "punycode";
@@ -555,34 +553,6 @@ export function PolicyAuthStackSectionEdit({
{isResourceOverlay && ( {isResourceOverlay && (
<SharedPolicyResourceNotice section="authentication" /> <SharedPolicyResourceNotice section="authentication" />
)} )}
{isInferenceResource && (
<Alert variant="neutral">
<InfoIcon className="h-4 w-4" />
<AlertDescription>
{inferenceResourceUrl
? t.rich(
"policyAuthInferenceIdentityKeyHelp",
{
resourceLink: () => (
<a
href={
inferenceResourceUrl
}
target="_blank"
rel="noopener noreferrer"
className="text-primary hover:underline"
>
{inferenceResourceUrl}
</a>
)
}
)
: t(
"policyAuthInferenceIdentityKeyHelpNoUrl"
)}
</AlertDescription>
</Alert>
)}
<SettingsSectionForm variant="half"> <SettingsSectionForm variant="half">
<PolicyAuthSsoSection <PolicyAuthSsoSection
sso={Boolean(sso) || isInferenceResource} sso={Boolean(sso) || isInferenceResource}
@@ -600,9 +570,9 @@ export function PolicyAuthStackSectionEdit({
disabled={authReadonly} disabled={authReadonly}
idpDisabled={authReadonly} idpDisabled={authReadonly}
ssoLocked={isInferenceResource} ssoLocked={isInferenceResource}
description={ identityKeyUrl={
isInferenceResource isInferenceResource
? t("policyAuthInferenceSsoDescription") ? inferenceResourceUrl
: undefined : undefined
} }
rolesEditor={ rolesEditor={