jackson/components/Sidebar.tsx

247 lines
7.5 KiB
TypeScript
Raw Normal View History

import HomeIcon from '@heroicons/react/24/outline/HomeIcon';
import Image from 'next/image';
import Link from 'next/link';
import classNames from 'classnames';
Directory Sync (#202) * SCIM Config API - / POST * SCIM wip * Add SCIM Webhook * Send webhoo event, and add signature * SCIM Group wip * wip * SCIM wip * User store wip * wip * wip * SCIM - Groups management * Add the params validation * Cleanup * Create user API, return the created user * Replace the nanoid with crypto .randomBytes * Improve the transform methods * Fix the events APIs * Fix * Wip - Testing with OneLogin SCIM * wip * Make changes to SCIM APIs * wip * Add the method createRandomSecret * wip * wip * wip * wip * wip * wip * wip * refactor wip * refactor wip * wip * Users finished * Group finished * Group fix * Fix the types * Fix the types * wip webhook events * Fix the config API * wip * wip * wip * wip * Improve the methods * wip * wip * wip webhook * Refactor the code * Add some comments * Fix the API * wip SCIM * Fix the pk * Return the all the groups * Fix * Improve the code * Final changes * wip APIs * Rename variables * Rename the classes * Fix the APIs * wip * Admin UI - wip * Add SCIM config screen * Admin UI wip * Admin UI wip * Admin UI wip * Fix the Admin UI * Add tabs * Add tabs * Add user screens * Add EmptyState * Add users, groups info screen * Add JSON syntax highlighter * Fix the config details screen * Add authentication to the APIs * wip * Add types * Add webhook event logs * Add type to directory * Display the event log details * Fix the missing arg * Ability to configure the logging enable/disable * Display alert if webhook logging is disabled * Fix the SCIM * Applied prettier * Search users by userName * Fix the section width * Add pagination for /users /groups in admin UI * Add pagination for directory listing * Fix the issues with list() * Add APIs * Add Next.js middleware for authentication * Fix the TS issue * Add pagination for SCIM /users * Add pagination for SCIM /users * Moved the tests into sub folders * Add unit tests for directories, users * wip * wip - unit tests * wip - unit tests * Some improvments * wip * Finished the SCIM unit tests * Some fixes * Fixes * Rename methods * Fix the TS * Many fixes * Fixes * Fixes * SCIM Fixes * SCIM updates * Fix the unit tests * Fix the unit tests * Fix the unit tests * Improve the unit tests * A fix * File renamed as per JS standard * Fix * Updates * Fix the SCIM APIs * Fix the tests * Added the Base class * Some fixes * Some fixes * Some fixes * Fix the events * Renamed to directorySyncController for consistency * Moved the createId to Base class * Moved the createId to Base class * Remove the Next.js middleware and add authentication to each routes * Change the text * Merged * Revert the changes * Improved the response of the SDK and APIs * Fix the return value * Azure related changes * Add the middleware back * Infer the types from getServerSideProps * givenName and familyName can be empty depends on the mapping * Fix the issue with update * API changes * Fixes * Fix the types * Revert the change * Improving the Webhooks and Callback * Added the event callback and changed the implementation for Webhook * Fix the SCIM API * Fix the events.ts file * wip * Cleanup and improve the request handler * Revert the package.json changes * Make the directory name optional. * Add a generic scim provider to the type * wip * Remove supabase UI * Update package-lock.json * Update the UI with DaisyUI * UI fixes * Final changes to the UI * Standardize the Input theme Co-authored-by: Kiran <kiran@Kirans-MacBook-Pro.local> Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2022-09-08 14:36:18 +00:00
import { useRouter } from 'next/router';
import Logo from '../public/logo.png';
import { useTranslation } from 'next-i18next';
2022-12-22 22:25:19 +00:00
import SSOLogo from '@components/logo/SSO';
import DSyncLogo from '@components/logo/DSync';
Retraced Admin UI (#452) * Merged * Revert the changes * changes * dropdown working * fixes * added custom classes for log viewer * Create Project & styling fixes * Update package-lock.json * fixed react datepicker css issues * Showing apis keys after project is created * View tokens page * minor changes * masking for tokens * warning fixes * Fix the sidebar active state * wip * wip * wip * Showing publisher api url * Fixed create new projects and list projects * Improved the ProjectInfo page * Fix the copy to clipboard button * Add the codesnippet * wip * wip UI * Improve the code snippet * Fixes and improve the UIs * Replace the product logos * Set the group null * Fix the conflicts * Fix the heroicons * Remove the unused method * Make the ProjectDetails 2 columns * Fix the logs-viewer not displaying * read event log from admin-ui * Jackson docker compose file & retraced integration related changes * minor fix * fixes for created key of audit log * fixed the expiry for self signed certificate * using node forge for self signed certs * Revert "using node forge for self signed certs" This reverts commit c027b5b7ced28a1a9be641d87517071aa74aa10c. * fix * package lock changes * installed missing dependancies and added new packages * minor fixes * fixes * added missing translations for retraced pages * - pin deps - removed react-copy-to-clipboard, react-host-toast * fixed typo * cleanup * tweak * switched to ButtonIcon * switch to button components and added back buttons where needed * checking npm ci * simplified env vars for Retraced * tweaks * If Retraced host is not specified then show a message * added audit logs logo * - added admin_token to bypass user and project specific queries - fixed project details view to read any length for environments * switched to daisyui Select * fixed auth check for api routes, get email for claims from the jwt * updated package-lock * switched to clipboard component * tweaks to CodeSnippet * padding tweaks * updated package-lock * updated package-lock * fixed z-index for modal in logs-viewer * select -> Select Co-authored-by: Kiran <kiran@boxyhq.com> Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2022-12-30 17:02:16 +00:00
import AuditLogsLogo from '@components/logo/AuditLogs';
import Vault from '@components/logo/Vault';
New OIDC fed (#2336) * add WellKnownURLs * Fix translation keys * Update dependencies and add IdP Configuration * Update common.json with new translations * wip * Update @boxyhq/internal-ui version to 0.0.5 * add internal ui folder * Fix imports and build * Refactor internal-ui package structure * wip shared UI * Fix the build * WIP * Add new components and hooks for directory sync * WIP * lint fix * updated swr * WIP * users * Refactor shared components and fix API endpoints*** ***Update directory user page and add new federated SAML app * Fix lint * wip * Add new files and update existing files * Refactor DirectoryGroups and DirectoryInfo components * Update localization strings for directory UI * Update Google Auth URL description in common.json * Refactor directory tab and add delete functionality to webhook logs * IdP selection screen changes * Delete unused files and update dependencies * Fix column declaration * Add internal-ui/dist to .gitignore * Update page limit and add new dependencies * wip * Refactor directory search in user API endpoint * wip * Refactor directory retrieval logic in user and group API handlers * Add API endpoints for retrieving webhook events * check app's redirectUrl, TODO: save app info into session to read later * Add query parameters to API URLs in DirectoryGroups * working saml login via IdP select. TODO: oidc login via IdP select and saml + oidc login with 1 connection * oidc IdP working with selection * working oidc fed -> saml flow * Add Google authorization status badge and handle pagination in FederatedSAMLApps * Add router prop to AppsList component and update page header titles * UI changes * updated peer-deps * Add new files and export functions * Remove unused router prop * Add PencilIcon to FederatedSAMLApps * updated federated app creation page * updated federated app edit page * Refactor FederatedSAMLApps and NewFederatedSAMLApp components * lint fix * lint fix * updated package-lock * add jose npm to dev dep * added missing strings * added missing strings * locale strings fix * locale strings cleanup * tweaks to icon imports * replaced textarea with list of inputs for Federated Apps redirect url * update package-lock * Add prepublish step * Build and publish npm and internal ui * Refactor install step * Run npm install (for local) inside internal ui automatically using prepare * Remove eslint setup for internal-ui * updated package-lock * Add `--legacy-peer-deps` to prevent installing peer dependencies * Fix the types import path * wip * wip * Fix the types * Format * Update package-lock * Cleanup * Try adding jose library version 5.2.2 * allow selective subdomain globbing * removed duplicate jose lib * updated package-lock * updated swagger doc * SAML Federation -> Identity Federation * fixed locale strings * turn off autocomplete for tags input --------- Co-authored-by: Kiran K <mailtokirankk@gmail.com> Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-03-05 16:57:02 +00:00
import Cog8ToothIcon from '@heroicons/react/24/outline/Cog8ToothIcon';
type SidebarProps = {
isOpen: boolean;
setIsOpen: (isOpen: boolean) => void;
};
type MenuItem = {
href: string;
text: string;
active: boolean;
icon?: any;
items?: MenuItem[];
};
export const Sidebar = ({ isOpen, setIsOpen }: SidebarProps) => {
const { t } = useTranslation('common');
Directory Sync (#202) * SCIM Config API - / POST * SCIM wip * Add SCIM Webhook * Send webhoo event, and add signature * SCIM Group wip * wip * SCIM wip * User store wip * wip * wip * SCIM - Groups management * Add the params validation * Cleanup * Create user API, return the created user * Replace the nanoid with crypto .randomBytes * Improve the transform methods * Fix the events APIs * Fix * Wip - Testing with OneLogin SCIM * wip * Make changes to SCIM APIs * wip * Add the method createRandomSecret * wip * wip * wip * wip * wip * wip * wip * refactor wip * refactor wip * wip * Users finished * Group finished * Group fix * Fix the types * Fix the types * wip webhook events * Fix the config API * wip * wip * wip * wip * Improve the methods * wip * wip * wip webhook * Refactor the code * Add some comments * Fix the API * wip SCIM * Fix the pk * Return the all the groups * Fix * Improve the code * Final changes * wip APIs * Rename variables * Rename the classes * Fix the APIs * wip * Admin UI - wip * Add SCIM config screen * Admin UI wip * Admin UI wip * Admin UI wip * Fix the Admin UI * Add tabs * Add tabs * Add user screens * Add EmptyState * Add users, groups info screen * Add JSON syntax highlighter * Fix the config details screen * Add authentication to the APIs * wip * Add types * Add webhook event logs * Add type to directory * Display the event log details * Fix the missing arg * Ability to configure the logging enable/disable * Display alert if webhook logging is disabled * Fix the SCIM * Applied prettier * Search users by userName * Fix the section width * Add pagination for /users /groups in admin UI * Add pagination for directory listing * Fix the issues with list() * Add APIs * Add Next.js middleware for authentication * Fix the TS issue * Add pagination for SCIM /users * Add pagination for SCIM /users * Moved the tests into sub folders * Add unit tests for directories, users * wip * wip - unit tests * wip - unit tests * Some improvments * wip * Finished the SCIM unit tests * Some fixes * Fixes * Rename methods * Fix the TS * Many fixes * Fixes * Fixes * SCIM Fixes * SCIM updates * Fix the unit tests * Fix the unit tests * Fix the unit tests * Improve the unit tests * A fix * File renamed as per JS standard * Fix * Updates * Fix the SCIM APIs * Fix the tests * Added the Base class * Some fixes * Some fixes * Some fixes * Fix the events * Renamed to directorySyncController for consistency * Moved the createId to Base class * Moved the createId to Base class * Remove the Next.js middleware and add authentication to each routes * Change the text * Merged * Revert the changes * Improved the response of the SDK and APIs * Fix the return value * Azure related changes * Add the middleware back * Infer the types from getServerSideProps * givenName and familyName can be empty depends on the mapping * Fix the issue with update * API changes * Fixes * Fix the types * Revert the change * Improving the Webhooks and Callback * Added the event callback and changed the implementation for Webhook * Fix the SCIM API * Fix the events.ts file * wip * Cleanup and improve the request handler * Revert the package.json changes * Make the directory name optional. * Add a generic scim provider to the type * wip * Remove supabase UI * Update package-lock.json * Update the UI with DaisyUI * UI fixes * Final changes to the UI * Standardize the Input theme Co-authored-by: Kiran <kiran@Kirans-MacBook-Pro.local> Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2022-09-08 14:36:18 +00:00
const { asPath } = useRouter();
const menus = [
{
href: '/admin/dashboard',
text: t('dashboard'),
icon: HomeIcon,
active: asPath.includes('/admin/dashboard'),
},
{
href: '/admin/sso-connection',
text: t('enterprise_sso'),
icon: SSOLogo,
Renaming routes for Identity Federation (#2618) * WIP * updated swagger file * renamed routes * renamed test folder * separate section for Identity Federation * sso-tracer -> sso-traces * don't change ACS url for SAML federation * SAMLFederation -> IdentityFederation * SAMLFederation -> IdentityFederation * keep api/federated-saml but move to api/identity-federation * test old route as well * fixed test * fixed test * retry tests 3 times * updated deployment * WIP create SAML Fed app (cherry picked from commit 3d15b20a2d85001764b77f29b93e4c2a96e3799a) * Add Admin Portal SSO via SAML Fed * Minor tweaks * Use fixture and login using federated connection * Cleanup SAML fed connection after test, disable failing assertion for now * Remove only * Use MockSAML endpoint from env * Cleanup SSO connections mapped to SAML Fed * OIDC Fed spec * Try with higher timeout * Mutate on page load * Put back assertion * Remove assertion and mutate for now * SAML Fed App + 2 SAML Providers * Take in optional tenant/product for fixture method * SAML Fed + 2 OIDC providers * SAML Fed test cases for single provider * Tweak title * Replace swr with fetch * Remove only * Bump up timeout to 100s * Add more test cases for OIDC Fed * Refactor fetch with hooks * locale tweaks * Also try with the other provider * Fixture support SAML add via raw metadata * Add second SAML connection using raw metadata * Revert "Add second SAML connection using raw metadata" * Revert "Fixture support SAML add via raw metadata" --------- Co-authored-by: ukrocks007 <ukrocks.mehta@gmail.com> Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-05-10 10:41:23 +00:00
active: asPath.includes('/admin/sso-connection'),
items: [
Setup Link Feature (#628) * Share setup link related changes 1. Setup link creation for saml connection 2. Setup link creation for Directory sync 3. Regeneration of Setup link 4. Ability to open setup link without login 5. Setup link opens up SAML connection page 6. Saml Connection page hides Tenant & Product fields * Saving SAML and OIDC configuration * showing the connection list on setup page * Connections CRUD * UI changes for Setup layout * semantics changes connection -> sso-connection * directory sync support for share link * showing only current tenant product directories * fixes mentioned in commnets by Aswin * prettier formatting * fixed route * minor fixes * Fix the layout rendering for the /setup routes * minor fixes * review changes * package lock changes * package json and lock changes * removed xmlbuilder * package lock changes * removed api call from ConnectionList component * Back button link fix * intermediate changes for Setup link list feature * setup link list related changes * UI fixes and actions * removed unwanted import * setup link list action hooked with correct functions * path rewrites, styling changes, toast regenerate & delete setup links * fixes for mutate * minor tweaks to clipboard icon * updated package-lock * formatting changes * removed console log * Added cusor pointer for action for LinkList component Removed unused variable & validation of empty token Removed redundent validation code linting fixes * Auto redirect in setup link page for sso-connection create form Delete icon on setup link list page on hover red color & tooltips * removed redirect and used isValidating * fixes for router replace * toast for setup links * fixes for dsync apis * redirect related change * removing redirect for sso-connection * fallback to error.message Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran <kiran@boxyhq.com>
2022-12-13 21:41:27 +00:00
{
href: '/admin/sso-connection',
text: t('connections'),
active:
asPath.includes('/admin/sso-connection') && !asPath.includes('/admin/sso-connection/setup-link'),
Setup Link Feature (#628) * Share setup link related changes 1. Setup link creation for saml connection 2. Setup link creation for Directory sync 3. Regeneration of Setup link 4. Ability to open setup link without login 5. Setup link opens up SAML connection page 6. Saml Connection page hides Tenant & Product fields * Saving SAML and OIDC configuration * showing the connection list on setup page * Connections CRUD * UI changes for Setup layout * semantics changes connection -> sso-connection * directory sync support for share link * showing only current tenant product directories * fixes mentioned in commnets by Aswin * prettier formatting * fixed route * minor fixes * Fix the layout rendering for the /setup routes * minor fixes * review changes * package lock changes * package json and lock changes * removed xmlbuilder * package lock changes * removed api call from ConnectionList component * Back button link fix * intermediate changes for Setup link list feature * setup link list related changes * UI fixes and actions * removed unwanted import * setup link list action hooked with correct functions * path rewrites, styling changes, toast regenerate & delete setup links * fixes for mutate * minor tweaks to clipboard icon * updated package-lock * formatting changes * removed console log * Added cusor pointer for action for LinkList component Removed unused variable & validation of empty token Removed redundent validation code linting fixes * Auto redirect in setup link page for sso-connection create form Delete icon on setup link list page on hover red color & tooltips * removed redirect and used isValidating * fixes for router replace * toast for setup links * fixes for dsync apis * redirect related change * removing redirect for sso-connection * fallback to error.message Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran <kiran@boxyhq.com>
2022-12-13 21:41:27 +00:00
},
{
href: '/admin/sso-connection/setup-link',
text: t('setup_links'),
active: asPath.includes('/admin/sso-connection/setup-link'),
Setup Link Feature (#628) * Share setup link related changes 1. Setup link creation for saml connection 2. Setup link creation for Directory sync 3. Regeneration of Setup link 4. Ability to open setup link without login 5. Setup link opens up SAML connection page 6. Saml Connection page hides Tenant & Product fields * Saving SAML and OIDC configuration * showing the connection list on setup page * Connections CRUD * UI changes for Setup layout * semantics changes connection -> sso-connection * directory sync support for share link * showing only current tenant product directories * fixes mentioned in commnets by Aswin * prettier formatting * fixed route * minor fixes * Fix the layout rendering for the /setup routes * minor fixes * review changes * package lock changes * package json and lock changes * removed xmlbuilder * package lock changes * removed api call from ConnectionList component * Back button link fix * intermediate changes for Setup link list feature * setup link list related changes * UI fixes and actions * removed unwanted import * setup link list action hooked with correct functions * path rewrites, styling changes, toast regenerate & delete setup links * fixes for mutate * minor tweaks to clipboard icon * updated package-lock * formatting changes * removed console log * Added cusor pointer for action for LinkList component Removed unused variable & validation of empty token Removed redundent validation code linting fixes * Auto redirect in setup link page for sso-connection create form Delete icon on setup link list page on hover red color & tooltips * removed redirect and used isValidating * fixes for router replace * toast for setup links * fixes for dsync apis * redirect related change * removing redirect for sso-connection * fallback to error.message Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran <kiran@boxyhq.com>
2022-12-13 21:41:27 +00:00
},
{
Renaming routes for Identity Federation (#2618) * WIP * updated swagger file * renamed routes * renamed test folder * separate section for Identity Federation * sso-tracer -> sso-traces * don't change ACS url for SAML federation * SAMLFederation -> IdentityFederation * SAMLFederation -> IdentityFederation * keep api/federated-saml but move to api/identity-federation * test old route as well * fixed test * fixed test * retry tests 3 times * updated deployment * WIP create SAML Fed app (cherry picked from commit 3d15b20a2d85001764b77f29b93e4c2a96e3799a) * Add Admin Portal SSO via SAML Fed * Minor tweaks * Use fixture and login using federated connection * Cleanup SAML fed connection after test, disable failing assertion for now * Remove only * Use MockSAML endpoint from env * Cleanup SSO connections mapped to SAML Fed * OIDC Fed spec * Try with higher timeout * Mutate on page load * Put back assertion * Remove assertion and mutate for now * SAML Fed App + 2 SAML Providers * Take in optional tenant/product for fixture method * SAML Fed + 2 OIDC providers * SAML Fed test cases for single provider * Tweak title * Replace swr with fetch * Remove only * Bump up timeout to 100s * Add more test cases for OIDC Fed * Refactor fetch with hooks * locale tweaks * Also try with the other provider * Fixture support SAML add via raw metadata * Add second SAML connection using raw metadata * Revert "Add second SAML connection using raw metadata" * Revert "Fixture support SAML add via raw metadata" --------- Co-authored-by: ukrocks007 <ukrocks.mehta@gmail.com> Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-05-10 10:41:23 +00:00
href: '/admin/sso-traces',
text: t('bui-traces-title'),
Renaming routes for Identity Federation (#2618) * WIP * updated swagger file * renamed routes * renamed test folder * separate section for Identity Federation * sso-tracer -> sso-traces * don't change ACS url for SAML federation * SAMLFederation -> IdentityFederation * SAMLFederation -> IdentityFederation * keep api/federated-saml but move to api/identity-federation * test old route as well * fixed test * fixed test * retry tests 3 times * updated deployment * WIP create SAML Fed app (cherry picked from commit 3d15b20a2d85001764b77f29b93e4c2a96e3799a) * Add Admin Portal SSO via SAML Fed * Minor tweaks * Use fixture and login using federated connection * Cleanup SAML fed connection after test, disable failing assertion for now * Remove only * Use MockSAML endpoint from env * Cleanup SSO connections mapped to SAML Fed * OIDC Fed spec * Try with higher timeout * Mutate on page load * Put back assertion * Remove assertion and mutate for now * SAML Fed App + 2 SAML Providers * Take in optional tenant/product for fixture method * SAML Fed + 2 OIDC providers * SAML Fed test cases for single provider * Tweak title * Replace swr with fetch * Remove only * Bump up timeout to 100s * Add more test cases for OIDC Fed * Refactor fetch with hooks * locale tweaks * Also try with the other provider * Fixture support SAML add via raw metadata * Add second SAML connection using raw metadata * Revert "Add second SAML connection using raw metadata" * Revert "Fixture support SAML add via raw metadata" --------- Co-authored-by: ukrocks007 <ukrocks.mehta@gmail.com> Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-05-10 10:41:23 +00:00
active: asPath.includes('/admin/sso-traces'),
},
Renaming routes for Identity Federation (#2618) * WIP * updated swagger file * renamed routes * renamed test folder * separate section for Identity Federation * sso-tracer -> sso-traces * don't change ACS url for SAML federation * SAMLFederation -> IdentityFederation * SAMLFederation -> IdentityFederation * keep api/federated-saml but move to api/identity-federation * test old route as well * fixed test * fixed test * retry tests 3 times * updated deployment * WIP create SAML Fed app (cherry picked from commit 3d15b20a2d85001764b77f29b93e4c2a96e3799a) * Add Admin Portal SSO via SAML Fed * Minor tweaks * Use fixture and login using federated connection * Cleanup SAML fed connection after test, disable failing assertion for now * Remove only * Use MockSAML endpoint from env * Cleanup SSO connections mapped to SAML Fed * OIDC Fed spec * Try with higher timeout * Mutate on page load * Put back assertion * Remove assertion and mutate for now * SAML Fed App + 2 SAML Providers * Take in optional tenant/product for fixture method * SAML Fed + 2 OIDC providers * SAML Fed test cases for single provider * Tweak title * Replace swr with fetch * Remove only * Bump up timeout to 100s * Add more test cases for OIDC Fed * Refactor fetch with hooks * locale tweaks * Also try with the other provider * Fixture support SAML add via raw metadata * Add second SAML connection using raw metadata * Revert "Add second SAML connection using raw metadata" * Revert "Fixture support SAML add via raw metadata" --------- Co-authored-by: ukrocks007 <ukrocks.mehta@gmail.com> Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-05-10 10:41:23 +00:00
],
},
{
href: '/admin/identity-federation',
text: t('identity_federation'),
icon: SSOLogo,
active: asPath.includes('/admin/identity-federation'),
items: [
SAML Tracer (#945) * `SAMLTracer` bootstrap * Pass `db` handle * Expect `null` when license is void * Skeleton - WIP * Add `Trace` type * Hook into `samlTracer` * Secondary index and other changes * Remove secondary index, support pagination * Remove TTL on tracer store, add secondary indices * Add `traceId` alongside payload value * Implement `cleanUpStaleTraces` * Trace any error in response parsing stage * Move `setInterval` to constructor, also run at start * Use arithmetic * Make method `public` * `await` on delete op * Fix logic: store `concat` result in `traces` * Unit tests * Switch `randomUUID` to `generateMnemonic` * Tweak const name * Typo fix * SAML Tracer to the sidebar * Api routes and pages * i18n * SAML Tracer instance and type updates * Page and api route for admin portal * Update comment * Rename variable * Enhance types, make `timestamp` optional * prefix `traceId` to error_description * Assert traceId pattern and return value * Add translations for traces list table * Updates for SAML Tracer viewer * Format the `error_description` * Implement `getByTraceId` * keycheck instead of falsiness check * Use status `403` and minor tweaks * Api route for getting single trace by `traceId` * Trace Inspector view * Move SAMLTracer out of `ee` * Remove license check * Placeholder for parsing rawResponse * Trace inspect page * Tweak description * Wrap `samlResponse` in try catch * Refactor and style changes, display more context * Rethrow error for SAMLFederation without redirecting * Add `issuer`,`profile` to context * Switch to `<span>` inside `<p>` * Format profile display and fix issuer term * Add TODO comment * Use empty string if `issuer` turns out to be empty * Package lock changes * Tweak the comment * Handle error with no op within saveTrace * Wrap SAML error points in `authorize` with tracer * Sync lock file * Redirect to jackson error page for federated sso * Pass `samlTracer` to Federated SSO class * Trace the error and rethrow to caller * Refactor * Expand `context` type * Gaurd for absent context fields * Disable word-wrap for timestamp * Display additional context * `await` to catch errors inside promise * Use tenant/product from app instead of connection * Use translation and minor fix * More translations * More translations * Remove "unlikely request" capturing * Copy to clipboard button * `await` inside try catch block * cleanup * Expand `try` to include jackson init * Add `requestedOIDCFlow` * Filter out empty indices * Make `samlTracer` internal to jackson * Use `AdminController` to get trace data * Default to 0 for pagination * Add comment * Add IdP login flag to context * Move the assignment before IdP flow check to populate context * Add `relayState` to context * Add `redirectUri` to context
2023-03-07 22:36:13 +00:00
{
Renaming routes for Identity Federation (#2618) * WIP * updated swagger file * renamed routes * renamed test folder * separate section for Identity Federation * sso-tracer -> sso-traces * don't change ACS url for SAML federation * SAMLFederation -> IdentityFederation * SAMLFederation -> IdentityFederation * keep api/federated-saml but move to api/identity-federation * test old route as well * fixed test * fixed test * retry tests 3 times * updated deployment * WIP create SAML Fed app (cherry picked from commit 3d15b20a2d85001764b77f29b93e4c2a96e3799a) * Add Admin Portal SSO via SAML Fed * Minor tweaks * Use fixture and login using federated connection * Cleanup SAML fed connection after test, disable failing assertion for now * Remove only * Use MockSAML endpoint from env * Cleanup SSO connections mapped to SAML Fed * OIDC Fed spec * Try with higher timeout * Mutate on page load * Put back assertion * Remove assertion and mutate for now * SAML Fed App + 2 SAML Providers * Take in optional tenant/product for fixture method * SAML Fed + 2 OIDC providers * SAML Fed test cases for single provider * Tweak title * Replace swr with fetch * Remove only * Bump up timeout to 100s * Add more test cases for OIDC Fed * Refactor fetch with hooks * locale tweaks * Also try with the other provider * Fixture support SAML add via raw metadata * Add second SAML connection using raw metadata * Revert "Add second SAML connection using raw metadata" * Revert "Fixture support SAML add via raw metadata" --------- Co-authored-by: ukrocks007 <ukrocks.mehta@gmail.com> Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-05-10 10:41:23 +00:00
href: '/admin/identity-federation',
text: t('apps'),
active: asPath.includes('/admin/identity-federation'),
SAML Tracer (#945) * `SAMLTracer` bootstrap * Pass `db` handle * Expect `null` when license is void * Skeleton - WIP * Add `Trace` type * Hook into `samlTracer` * Secondary index and other changes * Remove secondary index, support pagination * Remove TTL on tracer store, add secondary indices * Add `traceId` alongside payload value * Implement `cleanUpStaleTraces` * Trace any error in response parsing stage * Move `setInterval` to constructor, also run at start * Use arithmetic * Make method `public` * `await` on delete op * Fix logic: store `concat` result in `traces` * Unit tests * Switch `randomUUID` to `generateMnemonic` * Tweak const name * Typo fix * SAML Tracer to the sidebar * Api routes and pages * i18n * SAML Tracer instance and type updates * Page and api route for admin portal * Update comment * Rename variable * Enhance types, make `timestamp` optional * prefix `traceId` to error_description * Assert traceId pattern and return value * Add translations for traces list table * Updates for SAML Tracer viewer * Format the `error_description` * Implement `getByTraceId` * keycheck instead of falsiness check * Use status `403` and minor tweaks * Api route for getting single trace by `traceId` * Trace Inspector view * Move SAMLTracer out of `ee` * Remove license check * Placeholder for parsing rawResponse * Trace inspect page * Tweak description * Wrap `samlResponse` in try catch * Refactor and style changes, display more context * Rethrow error for SAMLFederation without redirecting * Add `issuer`,`profile` to context * Switch to `<span>` inside `<p>` * Format profile display and fix issuer term * Add TODO comment * Use empty string if `issuer` turns out to be empty * Package lock changes * Tweak the comment * Handle error with no op within saveTrace * Wrap SAML error points in `authorize` with tracer * Sync lock file * Redirect to jackson error page for federated sso * Pass `samlTracer` to Federated SSO class * Trace the error and rethrow to caller * Refactor * Expand `context` type * Gaurd for absent context fields * Disable word-wrap for timestamp * Display additional context * `await` to catch errors inside promise * Use tenant/product from app instead of connection * Use translation and minor fix * More translations * More translations * Remove "unlikely request" capturing * Copy to clipboard button * `await` inside try catch block * cleanup * Expand `try` to include jackson init * Add `requestedOIDCFlow` * Filter out empty indices * Make `samlTracer` internal to jackson * Use `AdminController` to get trace data * Default to 0 for pagination * Add comment * Add IdP login flag to context * Move the assignment before IdP flow check to populate context * Add `relayState` to context * Add `redirectUri` to context
2023-03-07 22:36:13 +00:00
},
],
},
{
href: '/admin/directory-sync',
text: t('directory_sync'),
icon: DSyncLogo,
active: asPath.includes('/admin/directory-sync'),
items: [
Setup Link Feature (#628) * Share setup link related changes 1. Setup link creation for saml connection 2. Setup link creation for Directory sync 3. Regeneration of Setup link 4. Ability to open setup link without login 5. Setup link opens up SAML connection page 6. Saml Connection page hides Tenant & Product fields * Saving SAML and OIDC configuration * showing the connection list on setup page * Connections CRUD * UI changes for Setup layout * semantics changes connection -> sso-connection * directory sync support for share link * showing only current tenant product directories * fixes mentioned in commnets by Aswin * prettier formatting * fixed route * minor fixes * Fix the layout rendering for the /setup routes * minor fixes * review changes * package lock changes * package json and lock changes * removed xmlbuilder * package lock changes * removed api call from ConnectionList component * Back button link fix * intermediate changes for Setup link list feature * setup link list related changes * UI fixes and actions * removed unwanted import * setup link list action hooked with correct functions * path rewrites, styling changes, toast regenerate & delete setup links * fixes for mutate * minor tweaks to clipboard icon * updated package-lock * formatting changes * removed console log * Added cusor pointer for action for LinkList component Removed unused variable & validation of empty token Removed redundent validation code linting fixes * Auto redirect in setup link page for sso-connection create form Delete icon on setup link list page on hover red color & tooltips * removed redirect and used isValidating * fixes for router replace * toast for setup links * fixes for dsync apis * redirect related change * removing redirect for sso-connection * fallback to error.message Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran <kiran@boxyhq.com>
2022-12-13 21:41:27 +00:00
{
href: '/admin/directory-sync',
text: t('connections'),
active:
asPath.includes('/admin/directory-sync') && !asPath.includes('/admin/directory-sync/setup-link'),
},
{
href: '/admin/directory-sync/setup-link',
text: t('setup_links'),
active: asPath.includes('/admin/directory-sync/setup-link'),
Setup Link Feature (#628) * Share setup link related changes 1. Setup link creation for saml connection 2. Setup link creation for Directory sync 3. Regeneration of Setup link 4. Ability to open setup link without login 5. Setup link opens up SAML connection page 6. Saml Connection page hides Tenant & Product fields * Saving SAML and OIDC configuration * showing the connection list on setup page * Connections CRUD * UI changes for Setup layout * semantics changes connection -> sso-connection * directory sync support for share link * showing only current tenant product directories * fixes mentioned in commnets by Aswin * prettier formatting * fixed route * minor fixes * Fix the layout rendering for the /setup routes * minor fixes * review changes * package lock changes * package json and lock changes * removed xmlbuilder * package lock changes * removed api call from ConnectionList component * Back button link fix * intermediate changes for Setup link list feature * setup link list related changes * UI fixes and actions * removed unwanted import * setup link list action hooked with correct functions * path rewrites, styling changes, toast regenerate & delete setup links * fixes for mutate * minor tweaks to clipboard icon * updated package-lock * formatting changes * removed console log * Added cusor pointer for action for LinkList component Removed unused variable & validation of empty token Removed redundent validation code linting fixes * Auto redirect in setup link page for sso-connection create form Delete icon on setup link list page on hover red color & tooltips * removed redirect and used isValidating * fixes for router replace * toast for setup links * fixes for dsync apis * redirect related change * removing redirect for sso-connection * fallback to error.message Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran <kiran@boxyhq.com>
2022-12-13 21:41:27 +00:00
},
],
},
Retraced Admin UI (#452) * Merged * Revert the changes * changes * dropdown working * fixes * added custom classes for log viewer * Create Project & styling fixes * Update package-lock.json * fixed react datepicker css issues * Showing apis keys after project is created * View tokens page * minor changes * masking for tokens * warning fixes * Fix the sidebar active state * wip * wip * wip * Showing publisher api url * Fixed create new projects and list projects * Improved the ProjectInfo page * Fix the copy to clipboard button * Add the codesnippet * wip * wip UI * Improve the code snippet * Fixes and improve the UIs * Replace the product logos * Set the group null * Fix the conflicts * Fix the heroicons * Remove the unused method * Make the ProjectDetails 2 columns * Fix the logs-viewer not displaying * read event log from admin-ui * Jackson docker compose file & retraced integration related changes * minor fix * fixes for created key of audit log * fixed the expiry for self signed certificate * using node forge for self signed certs * Revert "using node forge for self signed certs" This reverts commit c027b5b7ced28a1a9be641d87517071aa74aa10c. * fix * package lock changes * installed missing dependancies and added new packages * minor fixes * fixes * added missing translations for retraced pages * - pin deps - removed react-copy-to-clipboard, react-host-toast * fixed typo * cleanup * tweak * switched to ButtonIcon * switch to button components and added back buttons where needed * checking npm ci * simplified env vars for Retraced * tweaks * If Retraced host is not specified then show a message * added audit logs logo * - added admin_token to bypass user and project specific queries - fixed project details view to read any length for environments * switched to daisyui Select * fixed auth check for api routes, get email for claims from the jwt * updated package-lock * switched to clipboard component * tweaks to CodeSnippet * padding tweaks * updated package-lock * updated package-lock * fixed z-index for modal in logs-viewer * select -> Select Co-authored-by: Kiran <kiran@boxyhq.com> Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2022-12-30 17:02:16 +00:00
{
href: '/admin/retraced',
text: t('audit_logs'),
Retraced Admin UI (#452) * Merged * Revert the changes * changes * dropdown working * fixes * added custom classes for log viewer * Create Project & styling fixes * Update package-lock.json * fixed react datepicker css issues * Showing apis keys after project is created * View tokens page * minor changes * masking for tokens * warning fixes * Fix the sidebar active state * wip * wip * wip * Showing publisher api url * Fixed create new projects and list projects * Improved the ProjectInfo page * Fix the copy to clipboard button * Add the codesnippet * wip * wip UI * Improve the code snippet * Fixes and improve the UIs * Replace the product logos * Set the group null * Fix the conflicts * Fix the heroicons * Remove the unused method * Make the ProjectDetails 2 columns * Fix the logs-viewer not displaying * read event log from admin-ui * Jackson docker compose file & retraced integration related changes * minor fix * fixes for created key of audit log * fixed the expiry for self signed certificate * using node forge for self signed certs * Revert "using node forge for self signed certs" This reverts commit c027b5b7ced28a1a9be641d87517071aa74aa10c. * fix * package lock changes * installed missing dependancies and added new packages * minor fixes * fixes * added missing translations for retraced pages * - pin deps - removed react-copy-to-clipboard, react-host-toast * fixed typo * cleanup * tweak * switched to ButtonIcon * switch to button components and added back buttons where needed * checking npm ci * simplified env vars for Retraced * tweaks * If Retraced host is not specified then show a message * added audit logs logo * - added admin_token to bypass user and project specific queries - fixed project details view to read any length for environments * switched to daisyui Select * fixed auth check for api routes, get email for claims from the jwt * updated package-lock * switched to clipboard component * tweaks to CodeSnippet * padding tweaks * updated package-lock * updated package-lock * fixed z-index for modal in logs-viewer * select -> Select Co-authored-by: Kiran <kiran@boxyhq.com> Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2022-12-30 17:02:16 +00:00
icon: AuditLogsLogo,
current: asPath.includes('retraced'),
active: asPath.includes('/admin/retraced'),
items: [
{
href: '/admin/retraced',
text: t('projects'),
active: asPath.includes('/admin/retraced'),
},
],
},
{
href: '/admin/terminus',
text: t('privacy_vault'),
icon: Vault,
current: asPath.includes('terminus'),
active: asPath.includes('/admin/terminus'),
items: [
{
href: '/admin/terminus',
2024-02-21 18:04:24 +00:00
text: t('policies'),
active: asPath.includes('/admin/terminus'),
},
],
},
Admin portal sso login (#762) * env, login button & translations * added setting in sidebar Added login with sso button Added connection create form in settings * added new pages for Self SSO connection CRUD * Fixed Self SSO issue * Use @boxyhq/react-ui component for SSO * `await` on method instead of class * Fix import * Set fields to non-editable for settings view * Tweak for settings view * Add link for settings in sidebar * Take in admin SSO defaults from env * Tweak edit page for settings view * Remove `NEXT_PUBLIC` prefix * Switch back to getSSP from getStaticProps * Sync lock file * Set defaults in env * Filter out admin sso tenant/product * Load admin SSO tenant/product * Update heading * Fix back link * Use latest published version * Set `clientId` to dummy in provider init * Use the defaults from env * Fix redirectUrl after savingConnection for settingsView * Use `isLoading` from SWR * Fix settings view url for mutation and redirect in Edit * Replace api route path * Use rewrite instead of router.push and other tweaks * Reuse `ConnectionList` for settings * Use pagination query params in settings api * Import styles from sdk * Fix failing build * Use latest version * - Display badge for system sso connections - Reuse admin connection for retrieving system sso connections * Tweak styling * Construct profile in updateUser as done previously * Update react-ui * Remove extra truthy check * Hide pagination buttons for settings view * Install @boxyhq/react-ui as symlink to local * Tweak badge size * Rename admin portal sso envs * Fix the edit redirection for system sso Co-authored-by: ukrocks007 <ukrocks.mehta@gmail.com> Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran K <kiran@boxyhq.com>
2023-01-12 15:09:08 +00:00
{
href: '/admin/settings',
text: t('settings'),
icon: Cog8ToothIcon,
active: asPath.includes('/admin/settings'),
items: [
{
href: '/admin/settings/sso-connection',
text: 'Single Sign-On',
active: asPath.includes('/admin/settings/sso-connection'),
},
{
href: '/admin/settings/branding',
text: 'Branding',
active: asPath.includes('/admin/settings/branding'),
},
],
Admin portal sso login (#762) * env, login button & translations * added setting in sidebar Added login with sso button Added connection create form in settings * added new pages for Self SSO connection CRUD * Fixed Self SSO issue * Use @boxyhq/react-ui component for SSO * `await` on method instead of class * Fix import * Set fields to non-editable for settings view * Tweak for settings view * Add link for settings in sidebar * Take in admin SSO defaults from env * Tweak edit page for settings view * Remove `NEXT_PUBLIC` prefix * Switch back to getSSP from getStaticProps * Sync lock file * Set defaults in env * Filter out admin sso tenant/product * Load admin SSO tenant/product * Update heading * Fix back link * Use latest published version * Set `clientId` to dummy in provider init * Use the defaults from env * Fix redirectUrl after savingConnection for settingsView * Use `isLoading` from SWR * Fix settings view url for mutation and redirect in Edit * Replace api route path * Use rewrite instead of router.push and other tweaks * Reuse `ConnectionList` for settings * Use pagination query params in settings api * Import styles from sdk * Fix failing build * Use latest version * - Display badge for system sso connections - Reuse admin connection for retrieving system sso connections * Tweak styling * Construct profile in updateUser as done previously * Update react-ui * Remove extra truthy check * Hide pagination buttons for settings view * Install @boxyhq/react-ui as symlink to local * Tweak badge size * Rename admin portal sso envs * Fix the edit redirection for system sso Co-authored-by: ukrocks007 <ukrocks.mehta@gmail.com> Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Kiran K <kiran@boxyhq.com>
2023-01-12 15:09:08 +00:00
},
];
Directory Sync (#202) * SCIM Config API - / POST * SCIM wip * Add SCIM Webhook * Send webhoo event, and add signature * SCIM Group wip * wip * SCIM wip * User store wip * wip * wip * SCIM - Groups management * Add the params validation * Cleanup * Create user API, return the created user * Replace the nanoid with crypto .randomBytes * Improve the transform methods * Fix the events APIs * Fix * Wip - Testing with OneLogin SCIM * wip * Make changes to SCIM APIs * wip * Add the method createRandomSecret * wip * wip * wip * wip * wip * wip * wip * refactor wip * refactor wip * wip * Users finished * Group finished * Group fix * Fix the types * Fix the types * wip webhook events * Fix the config API * wip * wip * wip * wip * Improve the methods * wip * wip * wip webhook * Refactor the code * Add some comments * Fix the API * wip SCIM * Fix the pk * Return the all the groups * Fix * Improve the code * Final changes * wip APIs * Rename variables * Rename the classes * Fix the APIs * wip * Admin UI - wip * Add SCIM config screen * Admin UI wip * Admin UI wip * Admin UI wip * Fix the Admin UI * Add tabs * Add tabs * Add user screens * Add EmptyState * Add users, groups info screen * Add JSON syntax highlighter * Fix the config details screen * Add authentication to the APIs * wip * Add types * Add webhook event logs * Add type to directory * Display the event log details * Fix the missing arg * Ability to configure the logging enable/disable * Display alert if webhook logging is disabled * Fix the SCIM * Applied prettier * Search users by userName * Fix the section width * Add pagination for /users /groups in admin UI * Add pagination for directory listing * Fix the issues with list() * Add APIs * Add Next.js middleware for authentication * Fix the TS issue * Add pagination for SCIM /users * Add pagination for SCIM /users * Moved the tests into sub folders * Add unit tests for directories, users * wip * wip - unit tests * wip - unit tests * Some improvments * wip * Finished the SCIM unit tests * Some fixes * Fixes * Rename methods * Fix the TS * Many fixes * Fixes * Fixes * SCIM Fixes * SCIM updates * Fix the unit tests * Fix the unit tests * Fix the unit tests * Improve the unit tests * A fix * File renamed as per JS standard * Fix * Updates * Fix the SCIM APIs * Fix the tests * Added the Base class * Some fixes * Some fixes * Some fixes * Fix the events * Renamed to directorySyncController for consistency * Moved the createId to Base class * Moved the createId to Base class * Remove the Next.js middleware and add authentication to each routes * Change the text * Merged * Revert the changes * Improved the response of the SDK and APIs * Fix the return value * Azure related changes * Add the middleware back * Infer the types from getServerSideProps * givenName and familyName can be empty depends on the mapping * Fix the issue with update * API changes * Fixes * Fix the types * Revert the change * Improving the Webhooks and Callback * Added the event callback and changed the implementation for Webhook * Fix the SCIM API * Fix the events.ts file * wip * Cleanup and improve the request handler * Revert the package.json changes * Make the directory name optional. * Add a generic scim provider to the type * wip * Remove supabase UI * Update package-lock.json * Update the UI with DaisyUI * UI fixes * Final changes to the UI * Standardize the Input theme Co-authored-by: Kiran <kiran@Kirans-MacBook-Pro.local> Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2022-09-08 14:36:18 +00:00
return (
<>
{/* Sidebar for mobile */}
<div
className={classNames('relative z-40 md:hidden', { hidden: isOpen })}
role='dialog'
aria-modal='true'>
<div className='fixed inset-0 bg-gray-600 bg-opacity-75' />
<div className='fixed inset-0 z-40 flex'>
<div className='relative flex w-full max-w-xs flex-1 flex-col bg-white pt-5 pb-4'>
<div className='absolute top-0 right-0 -mr-12 pt-2'>
<button
onClick={() => {
setIsOpen(!isOpen);
}}
type='button'
className='ml-1 flex h-10 w-10 items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white'>
<span className='sr-only'>{t('close_sidebar')}</span>
<svg
className='h-6 w-6 text-white'
xmlns='http://www.w3.org/2000/svg'
fill='none'
viewBox='0 0 24 24'
strokeWidth={2}
stroke='currentColor'
aria-hidden='true'>
<path strokeLinecap='round' strokeLinejoin='round' d='M6 18L18 6M6 6l12 12' />
</svg>
</button>
</div>
<div className='flex flex-shrink-0 items-center px-4'>
<Link href='/' className='flex items-center'>
<Image src={Logo} alt='BoxyHQ' width={36} height={36} className='h-8 w-auto' />
<span className='ml-4 text-xl font-bold text-gray-900'>{t('boxyhq_admin_portal')}</span>
</Link>
</div>
<div className='mt-5 h-0 flex-1 overflow-y-auto'>
<MenuItems menus={menus} />
</div>
</div>
<div className='w-14 flex-shrink-0' aria-hidden='true'></div>
</div>
</div>
{/* Sidebar for desktop */}
<div className='hidden md:fixed md:inset-y-0 md:flex md:w-64 md:flex-col'>
<div className='flex flex-grow flex-col overflow-y-auto border-r border-gray-200 bg-white pt-5'>
<div className='flex flex-shrink-0 items-center px-4'>
<Link href='/' className='flex items-center'>
<Image src={Logo} alt='BoxyHQ' width={36} height={36} className='h-8 w-auto' />
<span className='ml-4 text-lg font-bold text-gray-900'>{t('boxyhq_admin_portal')}</span>
</Link>
</div>
<div className='mt-5 flex flex-1 flex-col'>
<MenuItems menus={menus} />
</div>
</div>
</div>
</>
);
};
const MenuItems = ({ menus }: { menus: MenuItem[] }) => {
return (
<nav className='space-y-1'>
{menus.map((menu, id) => {
return (
<div key={id}>
<ItemLink key={id} {...menu} />
{menu.items && <SubMenuItems items={menu.items} />}
</div>
);
})}
</nav>
);
};
const SubMenuItems = ({ items }: { items: MenuItem[] }) => {
return (
<nav className='flex-1 pl-10'>
<div className='mt-1 space-y-1 border-l-2 border-gray-200'>
{items.map((item, id) => (
<ItemLink key={id} {...item} />
))}
</div>
</nav>
);
};
const ItemLink = (props: MenuItem) => {
const { href, text, active } = props;
return (
<Link
href={href}
className={classNames(
'group mx-2 flex items-center rounded-md py-2 px-2 text-sm text-gray-900',
active ? 'bg-gray-100 font-bold' : 'font-medium hover:bg-gray-100 hover:text-gray-900'
)}>
{props.icon && <props.icon className='mr-2 h-6 w-6 flex-shrink-0' aria-hidden='true' />}
{text}
</Link>
);
};