2022-02-18 12:52:59 +00:00
|
|
|
import { GetStaticProps } from "next";
|
2022-02-18 08:56:42 +00:00
|
|
|
import { IdPMetadata } from "../types";
|
|
|
|
|
import config from "../lib/env";
|
2022-02-21 14:31:47 +00:00
|
|
|
import { fetchPublicKey } from "../utils";
|
2022-02-18 08:56:42 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import Link from "next/link";
|
|
|
|
|
import Head from "next/head";
|
2022-02-18 04:07:27 +00:00
|
|
|
|
2022-02-18 12:52:59 +00:00
|
|
|
export const getStaticProps: GetStaticProps = async () => {
|
2022-02-18 04:07:27 +00:00
|
|
|
const metadata: IdPMetadata = {
|
|
|
|
|
ssoUrl: config.ssoUrl,
|
|
|
|
|
entityId: config.entityId,
|
2022-02-21 14:31:47 +00:00
|
|
|
certificate: await fetchPublicKey(),
|
2022-02-18 08:56:42 +00:00
|
|
|
};
|
2022-02-18 04:07:27 +00:00
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
props: {
|
2022-02-18 08:56:42 +00:00
|
|
|
metadata,
|
2022-02-18 04:07:27 +00:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-18 08:56:42 +00:00
|
|
|
const Home: React.FC<{ metadata: IdPMetadata }> = ({ metadata }) => {
|
2022-01-08 15:11:13 +00:00
|
|
|
return (
|
2022-02-18 12:52:24 +00:00
|
|
|
<div className="h-full">
|
2022-02-18 08:56:42 +00:00
|
|
|
<Head>
|
|
|
|
|
<title>Mock SAML IdP - Metadata</title>
|
|
|
|
|
</Head>
|
2022-02-18 12:52:59 +00:00
|
|
|
<div className="w-4/5 lg:w-3/5 mx-auto relative top-20 bg-blue-50 p-10 rounded-xl grid gap-6 grid-cols-3 shadow-lg shadow-blueGray-50 text-[#145698]">
|
|
|
|
|
<p className="font-extrabold">SSO URL</p>
|
2022-02-18 08:56:42 +00:00
|
|
|
<p className="col-span-2">{metadata.ssoUrl}</p>
|
2022-02-18 12:52:59 +00:00
|
|
|
<p className="font-extrabold">Entity ID</p>
|
2022-02-18 08:56:42 +00:00
|
|
|
<p className="col-span-2">{metadata.entityId}</p>
|
2022-02-18 12:52:59 +00:00
|
|
|
<p className="font-extrabold">Certificate</p>
|
2022-02-21 14:31:47 +00:00
|
|
|
<p className="min-w-0 col-span-2 overflow-auto text-sm">
|
2022-02-18 08:56:42 +00:00
|
|
|
{metadata.certificate}
|
|
|
|
|
</p>
|
|
|
|
|
<br></br>
|
|
|
|
|
<p>
|
|
|
|
|
<Link href="/api/saml/metadata/download">Download Metadata</Link>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2022-02-18 12:52:24 +00:00
|
|
|
</div>
|
2022-02-18 08:56:42 +00:00
|
|
|
);
|
|
|
|
|
};
|
2022-01-08 15:11:13 +00:00
|
|
|
|
2022-02-18 08:56:42 +00:00
|
|
|
export default Home;
|