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-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-07-27 07:52:38 +00:00
|
|
|
<div className='flex items-center justify-center md:py-10'>
|
|
|
|
|
<div className='flex w-full max-w-4xl flex-col space-y-5 px-2'>
|
|
|
|
|
<h1 className='text-center text-xl font-extrabold text-gray-900 md:text-2xl'>
|
2022-07-26 21:28:46 +00:00
|
|
|
A free SAML 2.0 Identity Provider for testing SAML SSO integrations.
|
|
|
|
|
</h1>
|
2022-10-25 16:38:56 +00:00
|
|
|
<div className='flex flex-col justify-between space-y-5 md:flex-row md:space-y-0'>
|
|
|
|
|
<div className='flex flex-col space-y-5 md:flex-row md:space-x-5 md:space-y-0'>
|
2022-11-08 03:33:16 +00:00
|
|
|
<Link href='/api/saml/metadata/download' className='btn-primary btn-active btn'>
|
|
|
|
|
<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
|
2022-10-25 16:38:56 +00:00
|
|
|
</Link>
|
2022-11-08 03:33:16 +00:00
|
|
|
<Link href='/api/saml/metadata' className='btn-outline btn-primary btn' target='_blank'>
|
|
|
|
|
Metadata URL
|
2022-10-25 16:38:56 +00:00
|
|
|
</Link>
|
|
|
|
|
</div>
|
2022-11-08 03:33:16 +00:00
|
|
|
<Link href='/saml/login' className='btn-outline btn-primary btn'>
|
|
|
|
|
Test IdP Login
|
2022-07-27 07:52:38 +00:00
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='border-2 p-3'>
|
|
|
|
|
<h2 className='mb-5 text-center text-2xl font-bold text-gray-900'>Mock SAML Metadata</h2>
|
|
|
|
|
<div className='grid grid-cols-2 gap-y-5 gap-x-5'>
|
|
|
|
|
<div className='form-control'>
|
|
|
|
|
<label className='label'>
|
|
|
|
|
<span className='label-text font-bold'>SSO URL</span>
|
|
|
|
|
</label>
|
2022-11-08 03:33:16 +00:00
|
|
|
<input type='text' defaultValue={ssoUrl} className='input-bordered input' disabled />
|
2022-07-26 21:28:46 +00:00
|
|
|
</div>
|
2022-07-27 07:52:38 +00:00
|
|
|
<div className='form-control'>
|
|
|
|
|
<label className='label'>
|
|
|
|
|
<span className='label-text font-bold'>Entity ID</span>
|
|
|
|
|
</label>
|
2022-11-08 03:33:16 +00:00
|
|
|
<input type='text' defaultValue={entityId} className='input-bordered input' disabled />
|
2022-07-26 21:28:46 +00:00
|
|
|
</div>
|
2022-07-27 07:52:38 +00:00
|
|
|
<div className='form-control col-span-2 w-full'>
|
|
|
|
|
<label className='label'>
|
|
|
|
|
<span className='label-text font-bold'>Certificate</span>
|
|
|
|
|
</label>
|
|
|
|
|
<textarea
|
2022-11-08 03:33:16 +00:00
|
|
|
className='textarea-bordered textarea h-48'
|
2022-07-27 07:52:38 +00:00
|
|
|
defaultValue={certificate}
|
|
|
|
|
disabled></textarea>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='alert alert-error'>
|
|
|
|
|
<div>
|
|
|
|
|
<span className='text-white'>Caution: Not for production use.</span>
|
2022-02-24 04:16:49 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-02-18 08:56:42 +00:00
|
|
|
</div>
|
2022-07-26 21:28:46 +00:00
|
|
|
</div>
|
2022-02-18 08:56:42 +00:00
|
|
|
);
|
|
|
|
|
};
|
2022-01-08 15:11:13 +00:00
|
|
|
|
2022-07-26 21:28:46 +00:00
|
|
|
export const getServerSideProps: GetServerSideProps = async () => {
|
|
|
|
|
const metadata: IdPMetadata = {
|
|
|
|
|
ssoUrl: config.ssoUrl,
|
|
|
|
|
entityId: config.entityId,
|
|
|
|
|
certificate: config.publicKey,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
props: {
|
|
|
|
|
metadata,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-18 08:56:42 +00:00
|
|
|
export default Home;
|