2022-02-24 03:28:53 +00:00
|
|
|
import { GetStaticProps } from 'next';
|
|
|
|
|
import Head from 'next/head';
|
|
|
|
|
import Link from 'next/link';
|
|
|
|
|
import React from 'react';
|
|
|
|
|
import config from '../lib/env';
|
|
|
|
|
import { IdPMetadata } from '../types';
|
|
|
|
|
import { fetchPublicKey } from '../utils';
|
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-24 03:28:53 +00:00
|
|
|
<div className='h-full'>
|
2022-02-18 08:56:42 +00:00
|
|
|
<Head>
|
|
|
|
|
<title>Mock SAML IdP - Metadata</title>
|
|
|
|
|
</Head>
|
2022-02-24 03:28:53 +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>
|
|
|
|
|
<p className='col-span-2'>{metadata.ssoUrl}</p>
|
|
|
|
|
<p className='font-extrabold'>Entity ID</p>
|
|
|
|
|
<p className='col-span-2'>{metadata.entityId}</p>
|
|
|
|
|
<p className='font-extrabold'>Certificate</p>
|
|
|
|
|
<p className='min-w-0 col-span-2 overflow-auto text-sm'>{metadata.certificate}</p>
|
2022-02-18 08:56:42 +00:00
|
|
|
<br></br>
|
|
|
|
|
<p>
|
2022-02-24 03:28:53 +00:00
|
|
|
<Link href='/api/saml/metadata/download'>Download Metadata</Link>
|
2022-02-18 08:56:42 +00:00
|
|
|
</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;
|