import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import type { AxiosError } from "axios"; import { AlertCircle, Copy, Eye, Link2, Shield, Workflow, Save } from "lucide-react"; import { Link, useParams } from "react-router-dom"; import { Badge } from "../../components/ui/badge"; import { Button } from "../../components/ui/button"; import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "../../components/ui/card"; import { Separator } from "../../components/ui/separator"; import { Table, TableBody, TableCell, TableRow, } from "../../components/ui/table"; import { Textarea } from "../../components/ui/textarea"; import { Label } from "../../components/ui/label"; import { fetchClient, updateClient } from "../../lib/devApi"; import { useState, useEffect } from "react"; function ClientDetailsPage() { const params = useParams(); const queryClient = useQueryClient(); const clientId = params.id ?? ""; const { data, isLoading, error } = useQuery({ queryKey: ["client", clientId], queryFn: () => fetchClient(clientId), enabled: clientId.length > 0, }); const [redirectUris, setRedirectUris] = useState(""); useEffect(() => { if (data?.client?.redirectUris) { setRedirectUris(data.client.redirectUris.join(", ")); } }, [data]); const mutation = useMutation({ mutationFn: () => { const uriList = redirectUris .split(",") .map((u) => u.trim()) .filter(Boolean); return updateClient(clientId, { redirectUris: uriList }); }, onSuccess: () => { queryClient.invalidateQueries({ queryKey: ["client", clientId] }); alert("Redirect URIs가 저장되었습니다."); }, onError: (err) => { alert(`저장 실패: ${(err as Error).message}`); }, }); if (!clientId) { return
Client ID가 필요합니다.
; } if (isLoading) { return
Loading client...
; } if (error || !data) { const errMsg = (error as AxiosError<{ error?: string }>).response?.data?.error ?? (error as Error)?.message; return (
Error loading client: {errMsg || "unknown error"}
); } const endpoints = [ { label: "Discovery Endpoint", value: data.endpoints.discovery }, { label: "Issuer URL", value: data.endpoints.issuer }, { label: "Authorization Endpoint", value: data.endpoints.authorization }, { label: "Token Endpoint", value: data.endpoints.token }, { label: "UserInfo Endpoint", value: data.endpoints.userinfo }, ]; return (
Relying Parties / 클라이언트 상세

{data.client.name || data.client.id}

OIDC 자격 증명과 엔드포인트를 관리합니다.

{data.client.status === "active" ? "Active" : "Inactive"}
Connection Consent & Users Settings Federation

클라이언트 자격 증명

Client ID

{data.client.id}

Client Secret

••••••••••••••••

OIDC 엔드포인트

읽기 전용
{endpoints.map((endpoint) => (

{endpoint.label}

{endpoint.value}
))}

리디렉션 URI 설정

Redirect URIs 인증 성공 후 사용자를 리다이렉트할 허용된 URL 목록입니다. 콤마(,)로 구분하여 여러 개 입력할 수 있습니다.