core/proxy: handle missing session for user info endpoint (#4769)

This commit is contained in:
Caleb Doxsey 2024-01-08 07:03:49 -07:00 committed by GitHub
parent b3cb21e13c
commit 2dbcf32cc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 55 deletions

View file

@ -1,3 +1,5 @@
import Alert from "@mui/material/Alert";
import AlertTitle from "@mui/material/AlertTitle";
import Stack from "@mui/material/Stack";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
@ -20,50 +22,66 @@ export const SessionDetails: FC<SessionDetailsProps> = ({
profile,
}) => {
return (
<Section title="User Details">
<Stack spacing={3}>
<TableContainer>
<Table size="small">
<TableBody>
<TableRow>
<TableCell width={"18%"} variant="head">
Session ID
</TableCell>
<TableCell align="left">
<IDField value={session?.id} />
</TableCell>
</TableRow>
<TableRow>
<TableCell variant="head">User ID</TableCell>
<TableCell align="left">
<IDField
value={session?.userId || `${profile?.claims?.sub}`}
/>
</TableCell>
</TableRow>
<TableRow>
<TableCell variant="head">Expires At</TableCell>
<TableCell align="left">{session?.expiresAt || ""}</TableCell>
</TableRow>
{Object.entries(session?.claims || {}).map(([key, values]) => (
<ClaimRow
key={`session/${key}`}
claimKey={key}
claimValue={values}
/>
))}
{Object.entries(profile?.claims || {}).map(([key, value]) => (
<ClaimRow
key={`profile/${key}`}
claimKey={key}
claimValue={value}
/>
))}
</TableBody>
</Table>
</TableContainer>
</Stack>
</Section>
<>
{session?.id ? (
<Section title="User Details">
<Stack spacing={3}>
<TableContainer>
<Table size="small">
<TableBody>
<TableRow>
<TableCell width={"18%"} variant="head">
Session ID
</TableCell>
<TableCell align="left">
<IDField value={session?.id} />
</TableCell>
</TableRow>
<TableRow>
<TableCell variant="head">User ID</TableCell>
<TableCell align="left">
<IDField
value={
session?.userId || `${profile?.claims?.sub || ""}`
}
/>
</TableCell>
</TableRow>
<TableRow>
<TableCell variant="head">Expires At</TableCell>
<TableCell align="left">
{session?.expiresAt || ""}
</TableCell>
</TableRow>
{Object.entries(session?.claims || {}).map(
([key, values]) => (
<ClaimRow
key={`session/${key}`}
claimKey={key}
claimValue={values}
/>
)
)}
{Object.entries(profile?.claims || {}).map(([key, value]) => (
<ClaimRow
key={`profile/${key}`}
claimKey={key}
claimValue={value}
/>
))}
</TableBody>
</Table>
</TableContainer>
</Stack>
</Section>
) : (
<Alert severity="warning">
<AlertTitle>User Details Not Available</AlertTitle>
Have you signed in yet? <br />
<a href="/">{location.origin}</a>.
</Alert>
)}
</>
);
};
export default SessionDetails;