jackson/pages/well-known/oidc-configuration.tsx

61 lines
2.1 KiB
TypeScript
Raw Normal View History

import type { NextPage, InferGetStaticPropsType } from 'next';
import React from 'react';
import { useTranslation, Trans } from 'next-i18next';
import jackson from '@lib/jackson';
Cleanup duplicate locale and components (#2493) * Tweak sdk style import order * WIP * Override SDK styles * Cleanup and pass props to component * Cleanup setup link related code as it's handled via setup-link instructions * Cleanup locale * Fix e2e tests * Fix selectors in e2e test * Add select dropdown style override * Use component from SDK * Cleanup locale * Use Edit DSync from SDK * Remove default webhook props from setup token page * Ability to set default webhook secret * Tweak header text * Revert sdk style import order - app styles should be latest * Override default SDK focus style * Update locale * Use Edit component from SDK * Allow patching oidcMetadata fields * Tweak return data format * Route change on edit success and other fixes * Fix button styles * Fix data access from API * Fix focus styling for error btn * Sync lock file * Cleanup unused files * Set `displayInfo` to false for setup link and fix exclude fields for SAML under setup link * Allow forceAuthn in setup links * Only update forceAuthn if its a boolean value coming from body * Cleanup and hideSave only for setup link * Update UI SDK * Cleanup locales * Fix failing e2e * cleaned up dups * cleaned up dups * cleanup of components * more cleanup * cleanup * locale cleanup * dup cleanup * Reuse styles * Set min value for expiry field to 1 * Validate expiry before using * Update SDK and set idpMetadata display to true * cleaned up unused code, added formik as dep * clean unused locale strings * cleaned up ErrorMessage component --------- Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-03-28 13:21:59 +00:00
import { InputWithCopyButton } from '@boxyhq/internal-ui';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { Toaster } from '@components/Toaster';
const SPConfig: NextPage<InferGetStaticPropsType<typeof getServerSideProps>> = ({ oidcRedirectURI }) => {
const { t } = useTranslation('common');
return (
<>
<Toaster />
<div className='mt-10 flex w-full justify-center px-5'>
<div className='w-full rounded border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800 md:w-1/2'>
<div className='flex flex-col space-y-3'>
<h2 className='font-bold text-gray-700 md:text-xl'>{t('sp_oidc_config_title')}</h2>
<p className='text-sm leading-6 text-gray-800'>{t('sp_oidc_config_description')}</p>
<p className='text-sm leading-6 text-gray-600'>
<Trans
i18nKey='refer_to_provider_instructions'
t={t}
components={{
guideLink: (
<a
href='https://boxyhq.com/docs/jackson/sso-providers'
target='_blank'
rel='noreferrer'
className='underline underline-offset-4'>
{t('guides')}
</a>
),
}}
/>
</p>
</div>
<div className='mt-6 flex flex-col gap-6'>
<div className='form-control w-full'>
<InputWithCopyButton text={oidcRedirectURI} label={t('sp_oidc_redirect_url')} />
</div>
</div>
</div>
</div>
</>
);
};
export const getServerSideProps = async ({ locale }) => {
const { spConfig } = await jackson();
return {
props: {
...(await serverSideTranslations(locale, ['common'])),
oidcRedirectURI: spConfig.oidcRedirectURI,
},
};
};
export default SPConfig;