2022-02-24 03:28:53 +00:00
|
|
|
import { GetStaticProps } from 'next';
|
|
|
|
|
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-02-24 04:16:49 +00:00
|
|
|
const { ssoUrl, entityId, certificate } = metadata;
|
|
|
|
|
|
2022-01-08 15:11:13 +00:00
|
|
|
return (
|
2022-02-24 04:16:49 +00:00
|
|
|
<section className='text-gray-600 body-font'>
|
|
|
|
|
<div className='container px-5 py-24 mx-auto'>
|
|
|
|
|
<div className='flex flex-col w-full mb-12 text-center'>
|
|
|
|
|
<h1 className='mb-4 text-2xl font-medium text-gray-900 sm:text-3xl title-font'>
|
|
|
|
|
Mock SAML Metadata
|
|
|
|
|
</h1>
|
2022-02-24 05:38:43 +00:00
|
|
|
<p className='mx-auto text-base font-medium leading-relaxed lg:w-2/3'>
|
|
|
|
|
A simple mock SAML 2.0 Identity Provider for development and testing the SAML SSO integration.
|
2022-02-24 04:16:49 +00:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='flex items-end w-full px-8 mx-auto space-y-4 lg:w-2/3 sm:space-x-4 sm:space-y-0 sm:px-0'>
|
|
|
|
|
<div className='relative mr-4 lg:w-full'>
|
|
|
|
|
<label className='text-sm leading-7 text-gray-600'>SSO URL</label>
|
|
|
|
|
<input
|
|
|
|
|
type='text'
|
2022-02-24 04:39:15 +00:00
|
|
|
defaultValue={ssoUrl}
|
2022-02-24 04:16:49 +00:00
|
|
|
className='w-full px-3 py-1 text-base leading-8 text-gray-700 transition-colors duration-200 ease-in-out bg-gray-100 bg-opacity-50 border border-gray-300 rounded outline-none focus:ring-2 focus:ring-indigo-200 focus:bg-transparent focus:border-indigo-500'
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='relative mr-4 lg:w-full'>
|
|
|
|
|
<label className='text-sm leading-7 text-gray-600'>Entity ID</label>
|
|
|
|
|
<input
|
|
|
|
|
type='text'
|
2022-02-24 04:39:15 +00:00
|
|
|
defaultValue={entityId}
|
2022-02-24 04:16:49 +00:00
|
|
|
className='w-full px-3 py-1 text-base leading-8 text-gray-700 transition-colors duration-200 ease-in-out bg-gray-100 bg-opacity-50 border border-gray-300 rounded outline-none focus:ring-2 focus:ring-indigo-200 focus:bg-transparent focus:border-indigo-500'
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='flex items-end w-full px-8 mx-auto mt-5 space-y-4 lg:w-2/3 sm:space-x-4 sm:space-y-0 sm:px-0'>
|
|
|
|
|
<div className='relative lg:w-full'>
|
|
|
|
|
<label className='text-sm leading-7 text-gray-600'>Certificate</label>
|
|
|
|
|
<textarea
|
2022-02-24 06:20:40 +00:00
|
|
|
rows={5}
|
2022-02-24 04:39:15 +00:00
|
|
|
defaultValue={certificate}
|
2022-02-24 04:16:49 +00:00
|
|
|
className='w-full px-3 py-1 text-base leading-8 text-gray-700 transition-colors duration-200 ease-in-out bg-gray-100 bg-opacity-50 border border-gray-300 rounded outline-none focus:ring-2 focus:ring-indigo-200 focus:bg-transparent focus:border-indigo-500'></textarea>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='flex items-end w-full px-8 mx-auto mt-5 space-y-4 lg:w-2/3 sm:space-x-4 sm:space-y-0 sm:px-0'>
|
|
|
|
|
<Link href='/api/saml/metadata/download'>
|
2022-02-24 06:20:40 +00:00
|
|
|
<a className='button'>Download Metadata</a>
|
2022-02-24 04:16:49 +00:00
|
|
|
</Link>
|
|
|
|
|
</div>
|
2022-02-18 08:56:42 +00:00
|
|
|
</div>
|
2022-02-24 04:16:49 +00:00
|
|
|
</section>
|
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;
|