2022-03-10 17:20:33 +00:00
|
|
|
import { GetServerSideProps } from 'next';
|
2022-02-24 03:28:53 +00:00
|
|
|
import Link from 'next/link';
|
|
|
|
|
import React from 'react';
|
|
|
|
|
import config from '../lib/env';
|
|
|
|
|
import { IdPMetadata } from '../types';
|
2022-02-18 04:07:27 +00:00
|
|
|
|
2022-03-10 17:20:33 +00:00
|
|
|
export const getServerSideProps: GetServerSideProps = async () => {
|
2022-02-18 04:07:27 +00:00
|
|
|
const metadata: IdPMetadata = {
|
|
|
|
|
ssoUrl: config.ssoUrl,
|
|
|
|
|
entityId: config.entityId,
|
2022-03-02 21:06:04 +00:00
|
|
|
certificate: config.publicKey,
|
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-03-01 12:35:42 +00:00
|
|
|
<section className='body-font text-gray-600'>
|
2022-03-03 18:40:32 +00:00
|
|
|
<div className='container mx-auto px-5 py-8'>
|
|
|
|
|
<div className='mb-5 flex w-full flex-col text-center'>
|
2022-02-28 05:52:49 +00:00
|
|
|
<p className='mx-auto text-lg font-medium leading-relaxed lg:w-2/3'>
|
2022-03-02 20:53:00 +00:00
|
|
|
A free SAML 2.0 Identity Provider for testing SAML SSO integrations.
|
2022-03-03 18:40:32 +00:00
|
|
|
<sup className='text-xl text-orange-600'>*</sup>
|
2022-02-28 05:52:49 +00:00
|
|
|
</p>
|
2022-03-03 18:40:32 +00:00
|
|
|
<div className='mx-auto mt-4 flex w-full justify-center px-8 lg:w-2/3'>
|
|
|
|
|
<Link href='/saml/login'>
|
|
|
|
|
<a className='button min-w-[14rem] py-3 text-xl tracking-wide'>Test IdP Login</a>
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
2022-02-24 04:16:49 +00:00
|
|
|
</div>
|
2022-03-03 18:40:32 +00:00
|
|
|
<h2 className='title-font mt-9 text-center text-lg font-medium text-gray-900 sm:text-3xl'>
|
|
|
|
|
Mock SAML Metadata
|
|
|
|
|
</h2>
|
|
|
|
|
<div className='mx-auto mt-5 flex w-full space-x-6 px-8 lg:w-2/3'>
|
|
|
|
|
<div className='relative flex-1'>
|
2022-02-24 04:16:49 +00:00
|
|
|
<label className='text-sm leading-7 text-gray-600'>SSO URL</label>
|
2022-03-08 13:21:58 +00:00
|
|
|
<input disabled type='text' defaultValue={ssoUrl} className='input w-full' />
|
2022-02-24 04:16:49 +00:00
|
|
|
</div>
|
2022-03-03 18:40:32 +00:00
|
|
|
<div className='relative flex-1'>
|
2022-02-24 04:16:49 +00:00
|
|
|
<label className='text-sm leading-7 text-gray-600'>Entity ID</label>
|
2022-03-08 13:21:58 +00:00
|
|
|
<input disabled type='text' defaultValue={entityId} className='input w-full' />
|
2022-02-24 04:16:49 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-03-03 18:40:32 +00:00
|
|
|
<div className='mx-auto mt-5 flex w-full px-8 lg:w-2/3'>
|
|
|
|
|
<div className='relative w-full'>
|
2022-02-24 04:16:49 +00:00
|
|
|
<label className='text-sm leading-7 text-gray-600'>Certificate</label>
|
2022-03-08 13:21:58 +00:00
|
|
|
<textarea disabled rows={5} defaultValue={certificate} className='input w-full'></textarea>
|
2022-02-24 04:16:49 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-03-03 18:40:32 +00:00
|
|
|
<div className='mx-auto mt-5 flex w-full justify-center px-8 lg:w-2/3'>
|
2022-02-24 04:16:49 +00:00
|
|
|
<Link href='/api/saml/metadata/download'>
|
2022-03-03 18:40:32 +00:00
|
|
|
<a className='button-secondary'>
|
|
|
|
|
<svg
|
|
|
|
|
className='mr-1 inline-block h-6 w-6'
|
|
|
|
|
fill='none'
|
|
|
|
|
viewBox='0 0 24 24'
|
|
|
|
|
stroke='currentColor'
|
|
|
|
|
aria-hidden
|
|
|
|
|
strokeWidth='2'>
|
|
|
|
|
<path
|
|
|
|
|
strokeLinecap='round'
|
|
|
|
|
strokeLinejoin='round'
|
|
|
|
|
d='M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4'
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
Download Metadata
|
|
|
|
|
</a>
|
2022-02-24 04:16:49 +00:00
|
|
|
</Link>
|
|
|
|
|
</div>
|
2022-03-03 18:40:32 +00:00
|
|
|
<p className='mt-3 text-center text-lg text-orange-600'>* Caution: Not for production use</p>
|
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;
|