Commit Graph

91 Commits

Author SHA1 Message Date
Deepak Prabhakara 5eb106e5c4
Rename saml fed and sso tracer (#2693)
* rename

* more rename

* samlFed -> idFed
2024-05-11 13:35:32 +01:00
Deepak Prabhakara 67d05e0ba1
fixes wrong EE check (#2674)
fixed wrong EE check
2024-05-06 17:28:28 +01:00
Utkarsh Mehta b98ccc68bc
feat: Stats route changes to return count of setup link & saml federations apps (#2627)
* feat: stats route updates to respond count of setup link & saml federations apps

* chore: Remove unused getCountByProductService method from SetupLinkController

* feat: Add validation for development mode connection limits

* chore: Update import path for validateDevelopmentModeLimits in directory-sync and sso-connection APIs

* refactor: update development mode limits validation in directory-sync and connections APIs

* feat: Update development mode limits validation in directory-sync and connections APIs
2024-04-29 14:40:01 +01:00
Aswin V 46ccc69ff6
Use itemlist component from UI SDK (#2513)
* Fix outline style

* Fix types

* Use `ItemList` from UI SDK

* Cleanup locale

* Externalize UI SDK

* Add UI SDK to peer dependency

* Package lock changes

* updated react-ui

* reverse accidental commit

* call toast inside useEffect

* Update dependency array

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2024-04-04 00:03:34 +05:30
Deepak Prabhakara 86985c9140 Revert "fixed build"
This reverts commit e28e80e158.
2024-04-02 20:53:13 +01:00
Deepak Prabhakara e28e80e158 fixed build 2024-04-02 20:23:38 +01:00
Deepak Prabhakara 742f9b0676
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
Aswin V 67f111711a
Use UI SDK (#2464)
* 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

* Reuse styles

* Set min value for expiry field to 1

* Validate expiry before using

* Update SDK and set idpMetadata display to true

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2024-03-28 01:05:55 +00:00
Kiran K e1602858f4
Cron jobs support (#2430)
* Use random id instead of os.hostname

* Remove unused import

* add eventLockKey

* add eventLockKey

* Check for expiry when acquiring lock (wip)

* Add cron interval config

* Add timeout functionality to process events

* Fix index value overwrite

* Fix bulk delete

* Remove console.log

* directory sync add cron

* Refactor event processing and add cron scheduling

* Remove await

* Refactor directory sync worker

* Remove unused import statement

* Fix lockKey initialization in EventProcessor constructor

* cleanup

* take a callback for DSync as NPM option (WIP)

* Fix the unit test

* Fix the webhooks test

* Remove unused import statement

* Fix type

* fixed cron, cleaned up x-access-token. TODO: Fix webhooks batch cron

* grouped dsync index names in one place

* ensure the cron ticks regularly, use setInterval instead of setTimeout

* do the renewal inside EventLock

* lint fix

* improved locking and added check for lock in Google dsync cron

* locking per cron

* refactor

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2024-03-22 11:49:23 +00:00
Deepak Prabhakara 41b47ed4ce renamed OIDC_REQUEST_PROFILE_SCOPE to OPENID_REQUEST_PROFILE_SCOPE, updated deployments 2024-03-16 20:16:25 +00:00
Deepak Prabhakara 132d27e8f7 updated package-lock, tweaked error message 2024-03-14 15:36:13 +00:00
Kiran K f7cf763cbc
Request handler middleware for API routes (#2403)
* Add error class and update API handlers

* Refactor admin API handlers

* Fix error constructor parameter order

* Add defaultHandler to API endpoints

* Keep the handler name

* Fix error status code in defaultHandler and ApiError

* Fix the status code

* Improve conditional logic

* Small tweak

---------

Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-03-14 14:51:16 +00:00
Aswin V 92d4f864ce
Ability to opt out of sending profile scope (#2436)
* Default should be true, opt-in via JacksonOption

* Add new env to example file

* Omit profile scope if opted out

* Type update

* Service env processing

* Sync package locks

* Add unit tests
2024-03-13 14:47:15 +00:00
Aswin V 73b9d8a65d
Google SCIM Authorize tweaks (#2421)
* Update google SCIM authz options

* Sync lock file

* Remove the old option support, should reflect in typings

* Fix failing test

* Sync lock file

* Include google_authorization_url in directory response

* Update internal-ui to use url from directory config

* Update component usage in Jackson UI

* Cleanup example env

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2024-03-12 19:22:11 +00:00
Deepak Prabhakara dc6b4f7569
print dsync webhooks to console (#2420)
* print dsync webhooks to console

* read from opts
2024-03-11 18:06:22 +00:00
Aswin V 1188dd6396
Pagination fixes (#2347)
* `offset` -> `pageOffset`, `limit`-> `pageLimit`

* Be backward compatible in API

* Cleanup types and handle pagination qs

* Cleanup unused code

* Import type

* Cleanup and fix lint error

* Align params for sso-tracer

* Move parsing to a common util function

* pageLimit shouldn't be optional

* Cap pageLimit to max value, split the boolean

* Revert typings and assert non null

* Refactor var name

* Use util function to normalize pagination params across getAll and getByIndex

* Normalize offset/limit for dynamo/mongo

* Update query params in `FederatedSAMLApps`

* Cap to max limit if passed limit is 0

* Sync lock file

* Add a 3rd record and supply opts.pageLimit

* Normalize offset/limit for mem/redis

* Save the 3rd record in the store

* Fix getAll tests

* Give precedence to standard params over legacy

* Use util function

* Parse using util function

* Refactor

* Standardise pagination for `api/v1/dsync/events`

* Standardise pagination for api/admin/connections

* Standardise pagination for api/admin/directory-sync

* Standardise pagination for `api/v1/dsync/groups`

* Standardise pagination for `v1/dsync/users`, `v1/dsync/product`

* Standardise pagination in fetchByProduct APIs

* Update swagger for groups

* Fix pagination params definition, add the params for users api

* More swagger updates

* Swagger spec update for dsync events

* Add pagination params to apis fetching by product

* Update qs in internal-ui

* Remove type assertion

* [Swagger WIP] Fix response format for paginated APIs

* Add dsync events to swagger spec

* Fix swagger spec for sso tracer

* Fix swagger spec for federated-saml apps of a product

* Update pageLimit to 50

* Use pageLimit value from internal-ui

* Update UI SDK

* Cleanup local pagination component

* Update swagger version

* Remove unused keys from locale

* Fix tag for trace api spec

* Fix param name for swagger

* Fix swagger tag for trace

* updated package-lock

* updated package-lock

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2024-03-06 20:14:14 +00:00
Deepak Prabhakara 27a43cb778
Clean/unused (#2373)
* updated deployment

* cleanup unused code

* more cleanup

* revert back to old import of styles
2024-03-02 23:46:56 +00:00
Deepak Prabhakara bb7b856191
run planetscale test on local mysql db (#2353)
* run planetscale test on local mysql db

* run planetscale test on local mysql db

* run planetscale migration before test, ignore eslint warnings
2024-02-28 00:20:01 +00:00
Deepak Prabhakara 1c04f9099c
Feature/ory (#2205)
* WIP

* Support OIDC connections

* update connection using project revision

* working connections

* look up product config if boxyhqHosted

* fixed function return

* lint fix

* crash fix

* tweak name of org

* updated package-lock

* isEnabled is private

---------

Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-01-30 14:47:08 +00:00
dependabot[bot] 0d017ef00a
Bump prettier from 3.1.1 to 3.2.0 (#2151)
* Bump prettier from 3.1.1 to 3.2.0

Bumps [prettier](https://github.com/prettier/prettier) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.1.1...3.2.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fixed prettier format

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2024-01-12 18:46:32 +00:00
Kiran K 4a719ee911
Make Setup Link Expiry Time Configurable (#2112)
* Make Setup Link Expiry Time Configurable

* Update setup link expiry variable

* Fixes

* Add tests
2024-01-03 12:30:13 +00:00
Kiran K 70abbc8ee4
Support product branding (EE) (#2110)
* Make entity ID read-only

* Update swagger.json

* Add validation to check if an app with the same tenant and product already exists

* Fix error message for duplicate app creation

* Update API handler to use PATCH method instead of POST

* Add product branding support

* Refactor product controller

* Refactor branding and product fetching logic

* Update setup link branding

* Revert

* Fix ProductConfig interface
2024-01-02 15:00:41 +00:00
Deepak Prabhakara 1525035092
updated daisyui (#2088)
* updated daisyui

* Update color conversion function

* Update color conversion function

---------

Co-authored-by: Kiran K <mailtokirankk@gmail.com>
2023-12-26 12:07:34 +00:00
Kiran K da3846807b
Add prefix to Google dsync credentials (#1963)
* Add prefix to Google dsync credentials

* fallback to old env vars

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2023-11-22 17:46:14 +00:00
Kiran K e5fe69b62a
Send dsync events as a batch to the webhooks (#1579)
* store the events in the database

* wip DirectoryEvents

* wip

* Update package-lock.json

* wip - bulk sending events

* Batch events

* Remove status DELIVERED

* wip

* add unit tests

* Update package-lock.json

* Fix no-constant-condition

* add process locking

* rearrange files

* Fix imports

* log the webhook events

* Fix the test

* Fix the logs table

* Rename the endpoint

* Fix

* Cleanup

* Tweak

* clear Interval

* validate api key

* Correct sort order

* Updates

* Add unit tests

* Add more test cases

* Move files

* Update package-lock.json

* Fix the import

* Tweak

* Send otel

* Remove unused import

* Prevent parallel processing

* updated package-lock

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2023-11-13 23:06:06 +00:00
vishalboxyhq 0b99c7d667
Feature/typeorm migrations (#141)
* updated typeorm

* renamed connection

* updated migration scripts to new TypeORM version (v3)

* typeorm and mongo -migrations and namespace column

* update the mongo migration file

* remove the camelcase

* remove camelcase

* rename the file

* renaming migration files

* folder restructuring and add migrate-mongo package

* correcting path and minor changes

* merging db name with URL

* changing ts to js for mongo

* migration automation with env variable

* using custom scripts for migration

* Dockerfile fixes

* bootstrap script fixes and still need ts-node migrate-mongo in dockerfile

* running migration in CI/CD

* turning down planetscale

* migration related fixes for namespace

* Migration & bootstrap changes

* reverting minor change

* bootstrap.sh will only run in docker env

* bootstrap RUN_MIGRATION env variable will use true

* migration fixes

* migration changes

* removed console logs

* planetscale migration fixes

* copied back old files, tweaks to filenames

* add index for namespace

* restore older migration scripts

* formatting

* aligned timestamps

* updated mysql, mariadb, mssql, planetscale namespace migrations

* We'll run migrate manually as a separate step/container

* forgot to add migrate.sh

* bumped up timestamp

* Enable planetscale testing

* Revert planetscale test and comment config object

* Revert deletions in Dockerfile

* Update maria, mssql, mysql, ps, pg, sql namespace migrations

* Cleanup

* Add runMigration env to support manual run

* Minor tweak

* Ensure sql data migrations run after schema changes

* Fix mssql namespace data migration query

* Sync lock file

* Update mongo timestamp

* Set env for npm mongo migration script

* [sql] Populate namespace column for synchronize: true instances

* Rename `DB_RUN_MIGRATION` -> `DB_MANUAL_MIGRATION`

* [mongo] Populate namespace for already deployed instances

* Cleanup migrate.sh

* [bash -> sh] bash does not work inside docker

* Optimise migration artifacts

* Source packages from global path

* Copy npm from build context - excludes node_modules via .dockerignore

* Remove redundant copy step

* added swc packages

* fresh package-lock

* fresh package-lock

* added migratepg job to skaffold
fixes in migrate.sh to exit with error when migration fails

* cleanup

* added migratepg to demo skaffold as well

* turn on planetscale tests

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
Co-authored-by: Utkarsh Mehta <ukrocks.mehta@gmail.com>
Co-authored-by: Aswin V <vaswin91@gmail.com>
2023-10-13 23:29:21 +01:00
Deepak Prabhakara 1177ce1011
Format using prettier and add check-format step to GH actions (#1759)
* prettier format

* added check-format step to github actions
2023-10-11 09:18:03 +01:00
Kiran K 42cabf0b35
SAML setup UI/UX improvements. (#1457) 2023-09-07 17:56:34 +05:30
dependabot[bot] b65c25ff6a
Bump @typescript-eslint/eslint-plugin from 5.61.0 to 6.0.0 (#1311)
* Bump @typescript-eslint/eslint-plugin from 5.61.0 to 6.0.0

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.61.0 to 6.0.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.0.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fixed lint errors

* ignore type error for calledWithMatch args

* disable eslint check

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2023-07-11 13:56:55 +01:00
Kiran K 07a5f8a46d
Google Directory API Integration (#1158)
* Add Google Group API

* Restructure the Group interface

* Rename the methods

* wip

* temp change

* Revert the changes

* Fix the groups from Google

* wip fetch users

* Skip directory check

* Convert to SCIM schema

* Updates to users sync

* Fix the unit test

* Rename folder and merge the files

* add raw to the user payload

* Fix the unit tests

* Optimize the Group sync create ops

* Reorder import

* Remove unused imports

* Add type safety to SCIM Schema

* Fix the users and groups update

* try fixing unit tests

* Fix the file extension

* Delete groups that are not in the directory anymore

* Fix the group update

* Compare and find the delete users

* Add and update group members

* cleanup the test

* Fix the test (temp)

* dont throw error

* Add secondary index if the directory type is `google`

* Rename the file

* wip

* Export functions inline

* Hide the SCIM endpoint and token for non-scim provider

* Update the `dsync` option key to allow multiple providers

* Restructure the folders

* Update folder structure

* Cleanup

* Revert the callback changes

* Fix the type

* Fix the type

* Fix existing unit tests

* add callback

* Fix the internal callback

* Fix the method call

* merge the type files

* add console.info for testing

* Fix the Google OAuth client usage

* Reactor the update method

* Handle no users or group cases

* Refactor the sync method

* Fix the pagination

* Cleanup

* Finish the pagination

* Fix the unit tests

* Fix the lint errors

* Fix the build issues

* Pass directory id to the method

* Pass directoryId while fetching

* apply changes to the UI

* display the Google auth URL

* Fix the type

* add unit tests

* add unit test for syncing users

* add unit tests

* Pass operation to SCIM payload

* unit tests wip 1

* updated

* Test the events deleted

* Test group.user_added events

* Finish the tests

* Revert and cleanup

* update map.js

* Revert

* update the e2e test

* Cleanup

* Revert

* label tweak

* Remove unused import

* Protect the cron job using apiKey

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2023-06-15 14:31:38 +01:00
Deepak Prabhakara 2e21b533d2
tweaked caching of jackson lib instance, fixed misc types (#1142) 2023-05-15 10:02:51 +01:00
Deepak Prabhakara 33c057065e fixed brandongController type 2023-05-12 00:38:49 +01:00
Kiran K c8e0eb85fc
add ability to activate/deactivate the sso and directory sync connections (#1049)
* add support to activate and deactivate SSO connections

* add unit tests for sso.deactivated and sso.activated

* prevent sso login with deactivated connection

* add deactivate key for directory sync

* update the Badge component to extend react-daisyui

* restructure the status toggle button

* update the connection toggle for directory connection

* wip

* tweak variables

* wip

* cleanup

* delete the connection after each test

* ask for confirmation before sending the request

* use PATCH method

* fix the default value for toggle

* stop sending webhook if connection is disabled

* add the key deactivated to connection object

* fix the unit test

* attempt to fix the test

* update

* allow passing data-testid to ConfirmationModal

* revert the changes

* cleanup

* remove the console.log

* remove unused imports

* sync the state after the status change

* Sync lock file

---------

Co-authored-by: Aswin V <vaswin91@gmail.com>
2023-04-10 13:56:26 +01:00
Aswin V 8c66b46ce7
Use @boxyhq/metrics wrapper package for telemetry (#1065)
* Init sdk folder for otel

* Update LICENSE

* Add `directory` for `git` in package.json

* Initialize metrics

* Acquire meter

* Operation for counter instrument

* operation for gauge

* - Move `otel` out of `sdk` folder into root folder"
- Rename npm to `@boxyhq/metrics`

* Add function instrumentation

* Rename `otel` to `metrics`

* Rename folder and add npm dependencies

* Refactor

* Add `instrumented` decorator

* Exclude metrics from root tsconfig

* Remove otel from names

* Remove `metrics` folder

* Swap creation of instruments with constants

* Remove `metrics` from tsconfig

* Use `@boxyhq/metrics`

* Use `@boxyhq/metrics` from npm registry

* Use `initializeMetrics` from `@boxyhq/metrics`

* Cleanup

* Wrap telemetry calls

* Refactor

* Refactor

* Fix call

* Update metrics to latest release
2023-04-08 22:19:57 +05:30
Kiran K 8afd99f296
Webhook events for SSO and DSync connection operations (#1018) 2023-03-27 21:06:44 +05:30
Deepak Prabhakara 9154d3a7af
Dynamodb support (#980)
* added dynamodb-local to docker-compose

* [WIP] Add DynamoDB data source (#947)

wip

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>

* WIP

* fixed put, get and delete

* store secondary index

* implemented getAll and delete

* revert changes to test file

* revert test script changes

* added dynamodb-local for testing

* WIP: pagination for DynamoDB

* dynamodb pagination cannot take offset and limit

* fixes for the change from Array to Records type so we can handle pageToken for DynamoDB

* fixed github actions

* trying options instead of command

* try default dynamodb-local command

* lint

* region for dynamodb

* added dummy aws creds

* lint

* getAll can be paginated using pageLimit

* tweaked comments

* Track `pageToken` with `pageOffset`.

* Track the (next)pageToken with offset

* Use the pageToken (from prev page) to get the connection list

* Comment

* Pass along the pageToken

* Type fix

* Relay the `pageToken` header to the response

* Update type for SWR ApiSuccess data

* Remove `marshall`

* Support pageToken for DS

* Support pageToken for SAML Fed

* Fix test

* Support pageToken for SAML Tracer

* Fix test

* Fix test for tracer

* Remove `marshall` in getByIndex

* Support `pageToken` for SetupLinks

* added dynamodb dev script

* move dynamodb options to it's own namespace

* added config for read/write capacity units

---------

Co-authored-by: Michael McDermott <michael.g.mcdermott@gmail.com>
Co-authored-by: Aswin V <vaswin91@gmail.com>
2023-03-16 21:42:36 +00:00
Kiran K 224358df28
Ability to customize the branding of Setup Link pages and the IdP selection pages (ee) (#965)
* display toast and adjust the width of the content

* customize the branding for setup links

* use the branding in setup links page

* Admin Branding WIP

* Update settings

* Move to ee folder

* If the licence is not valid, return the default branding

* update translation

* Add logo to the idp selection page

* add license check to the API

* read default branding from a common place

* add LicenseRequired

* cleanup

* Add License check to NPM

* Fix

* Add --pf css variable

* fix the idp selection page

* use default branding if value is not set

* Fixes

* Improved the store and keys

* Infer the return type

* Whitelabeling the IdP selection screen per tenant and product

* Fix the param type

* Fix the unit tests

* Fix mismatch in server/client rendering

* Switch to radio button look and feel

* Use rounded border only for textual inputs

* Cleanup import

* Move routing to `useEffect`

* Fix server render mismatch

* fixed merge conflict

* fixed merge conflict

---------

Co-authored-by: Aswin V <vaswin91@gmail.com>
Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2023-03-09 14:50:25 +00:00
Aswin V c8fb34823b
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
Deepak Prabhakara 1e2e6fcdf1
Terminus UI (#977)
* WIP

* tweaks

* more tweaks

* layout without any controls

* only need sprites.png

* added Terminus blocks

* converted to ts

* z-index hack

* fixed layout without z-index hack

* retrieve model

* upload model

* terminus config

* lint fixes

* refactor

* added confirmation modal and toasts

* fixed cue generation

* fixed modal toggle
2023-03-02 20:55:54 +00:00
Deepak Prabhakara fa2dbb63a9 Revert "fixed ui crash when retraced config is not defined"
This reverts commit cece3b866a.
2023-03-01 00:55:23 +00:00
Deepak Prabhakara cece3b866a fixed ui crash when retraced config is not defined 2023-02-28 23:21:17 +00:00
Aswin V 4ab8138969
Fallback for OIDC discovery (#926)
* Support `metadata` in `OIDCSSORecord`

* Helper to create oidc issuer instance

* Use helper to create `Issuer`

* Sync lock file

* Support `oidcMetadata` in pre-loaded connections

* Augment typings for OIDC SSO Connections

* Use helper and pass metadata

* Update validation to consider metadata

* Support for OIDC metadata

* Test fixes for types and error message

* Fix swagger array type

* Update swagger spec

* Util to transform OIDC metadata JSON

* Fix typings

* Augment validation for oidc metadata fields

* Add `oidcMetadataParse` to admin apis

* Add `oidcMetadataParse` to setup link apis

* Remove previously set discoveryUrl or metadata
if any

* Type updates admin portal

* initialState seeding for `object` type

* Add  and place  at bottom of the form

* Type the catalog list

* use  to set the fields for the object type

* Type updates

* Gaurd against  parentKey value

* Add missing guard to `formatForDisplay`

* Link like button

* Support for fallback field

* Util function to check if value is `{}`

* Fix premature setting of metadata

* Exclude fallback from form display
Activate fallback on switch interaction

* Fix settings view state setting

* Sync lock file

* Tweak error message

* Add e2e for SSO connection add via metadata

* Tweak switch

* Refactor - Parameterize the e2e test

* Cleanup

* text tweaks

* fixed test

* Update comments

* Use `data-testid` instead of button name

* Source `data-testid`s from catalog

* Refactor `hidden` className setting

* Switch from `locator` to `getByTestId`

* Apply hidden className to checkbox input

---------

Co-authored-by: Kiran K <kiran@boxyhq.com>
Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2023-02-24 12:43:58 +05:30
Aswin V b889ad9f98
Fix jackson init (#962)
* Fix key on global object

* Sync lock file
2023-02-20 16:28:15 +05:30
Deepak Prabhakara 5decd3574e fixed init of jackson lib, error text tweak 2023-02-17 20:57:03 +00:00
Aswin V 69f32c2cd1
Use credentials provider for SAML IdP login into admin portal (#921)
* SAML Idp login using credentials provider

* Use idp login path as defaultRedirectUrl

* Whitelist idp-login route

* Logout from magic link before sign in

* Cleanup

* Set `callbackUrl` for signIn

* Sync lock file

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2023-02-07 12:30:37 +00:00
Kiran K 842ff50268
Add Playwright test for `/api/v1/` and `/api/scim/` endpoints (#816)
* Update config

* add the test cases for /api/v1/connections

* Fix the strategyChecker, add metadataUrl to the condition

* add the test cases for /api/v1/connections

* update /api/v1/connections

* Update the SSO connections tests

* Rename the test file

* update the tests

* should be able to check if a connection exists

* add the tests for directory sync APIs

* rstructure the tests folder

* add tests wip

* Fix the API tests

* Fix the sso connections tests

* Refactor the connections list

* restructure the /api/v1/connections APIs

* restructure the /api/v1/directory-sync tests

* add the tests for /api/scim/v2.0/

* update the tests

* wip

* fixes the api testing

* allow adding multiple directory connections for the same tenant and product

* update the tests

* update the unit tests

* improved the integration tests

* cleanup the api tests

* add tests for SCIM APIs

* fix the globalSetup

* update the tests for SCIM endpoints

* add the remaining tests

* fix the bug with fetching resource by invalid ID

* cleanup

* fix the tests

* update the tenant name

* typescript types cleanup

* directory sync API updates

* standardize the /api/v1/directory-sync

* update the directories.test.ts

* remove unused methods

* filter the users and groups by directoryId

* improve the SCIM request handling

* fix the e2e tests

* fix the e2e tests

* attempt to fix the api tests

* fix the api testing

* move the files to helpers

* add pagination for directory groups

* API - delete a directory by id

* delete the directory after the tests

* remove the members array from the group info
2023-01-17 10:07:14 +00:00
Aswin V b14a0f1623
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 20:39:08 +05:30
Kiran K eb80fb5297
Use middleware to validate the API requests (#792)
* Update

* Validate the API routes in the middleware

* Validate the setuplink token by calling the API

* Tweaks

* unAuthorizedResponse method now accept a message

* Update middleware

* Cleanup

* Update message

* Removed CheckSession - Not needed anymore

* Updates to API authentication middleware

* Updates to API authentication middleware

* Remove the use of checkSession from retraced admin APIs

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2023-01-06 23:37:08 +00:00
Utkarsh Mehta 61796eb59f
Pagination related changes for audit logs projects (#813)
* pagination related changes for audit logs projects

* fixed the colSpan
useProject signature fixes

* used toast component  instead of ErrorMessage
Changes in the api to send correct error messages

* response fixes
2023-01-06 18:59:27 +00:00
Kiran K 36ac681a79
append the `offset` to the query string of the page URL when paginating (#811)
Append the offset to the query string of the page URL.
2023-01-05 11:41:01 +00:00