import { useMutation, useQuery } from "@tanstack/react-query"; import { ArrowLeft, ChevronLeft, ChevronRight, Filter, Search, } from "lucide-react"; import { useState } from "react"; import { Link, useParams } from "react-router-dom"; import { Badge } from "../../components/ui/badge"; import { Button } from "../../components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "../../components/ui/card"; import { Input } from "../../components/ui/input"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "../../components/ui/table"; import { fetchClient, fetchConsents, revokeConsent } from "../../lib/devApi"; function ClientConsentsPage() { const params = useParams(); const clientId = params.id ?? ""; const [subjectInput, setSubjectInput] = useState(""); const [subject, setSubject] = useState(""); const { data: clientData } = useQuery({ queryKey: ["client", clientId], queryFn: () => fetchClient(clientId), enabled: clientId.length > 0, }); const { data: consentsData, isLoading, error, refetch, } = useQuery({ queryKey: ["consents", clientId, subject], queryFn: () => fetchConsents(subject, clientId), enabled: subject.length > 0, }); const revokeMutation = useMutation({ mutationFn: (payload: { subject: string }) => revokeConsent(payload.subject, clientId), onSuccess: () => { refetch(); }, }); const rows = consentsData?.items ?? []; return (

User Consent Grants

OIDC Relying Party 사용자 권한을 검토·관리합니다.

{clientData?.client?.status === "active" ? "Active" : "Inactive"}
Connection Consent & Users Settings
setSubjectInput(e.target.value)} />
Status:
{error && ( Error loading consents: {(error as Error).message} )} {isLoading && ( Loading consents... )} User Status Granted Scopes Last Authenticated Action {rows.map((row) => (
{row.subject.slice(0, 2).toUpperCase()}
{row.clientName || "Subject"} {row.subject}
Active
{row.grantedScopes.map((scope) => ( {scope} ))}
{row.authenticatedAt || "-"}
))}

Showing 1 to{" "} 4 of{" "} 1,250 users

Active Grants

1,250

Total Scopes Issued

4,812

Avg. Scopes per User

3.8
); } export default ClientConsentsPage;