Commit Graph

100 Commits

Author SHA1 Message Date
nadilas 7d0c31f7bc
Feat: sqlite and turso support (#2729)
* feat: basic sqlite and turso setup

* chore: format code

* chore: explain turso flags

* fix: failing ttl tests for sqlite

* chore: increase key field length, even though sqlite doesn't care

* chore: remove sqlite logging

* fixed order by query (related to precision of current_timestamp which is seconds)

* delete record3 as well

* test: add turso to _dev docker compose and tests

* chore: remove temporary turso engine type

* removed sqlite3 from webpack ignore

* fixed format

* added turso image to ci/cd test

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2024-05-26 21:15:05 +01:00
Aswin V 9f4dddad09
E2E for DSync (#2701)
* Fixture add DSync Page

* Tweak fixture, add delete connection method

* Label should be associated with the input

* WIP Test for Azure SCIM

* Tweak helper to work with Azure SCIM query param

* Fixture add switching to users view method and use instance property for tenant/product

* Include Jackson Api key header in SCIM endpoint request

* Simulate a user creation request to SCIM endpoint and assert it in view

* Update sample user to match type

* Fix flaky test by waiting for dom

* Export helpers from index

* Refactor scimOpEndpoint

* Add group and group member

* Add switching to group view in fixture

* Assert group in groups view

* Tweak userName

* Enable webhook events logging

* Refactor

* Add second user, parametrize azureUser

* Set webhook url/secret

* Assert webhook events

* Refactor view switching

* Refactor event inspection

* Delete webhook logs

* Tweak scimEndpoint creation

* Add `deleteGroup`

* Use util method in api helpers

* Add test for user/group deletion

* Bump up assertion timeout

* Try flakiness fix with waiting for api response

* `updateGroupName` e2e helper

* Assert updated group name

* Revert local changes

* Potential fix for failed test

* Try fix

* Add missing await for visibility checks

* Cleanup await inside expect

* Cleanup waiting for response

* Test user update, disabling webhook event logging

* Parametrize test for Okta/Azure

* Cleanup await

* Try removing assertion timeout

* Put back assetion timeout
2024-05-23 23:22:45 +05:30
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 6bfb89a74e
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 3d15b20a2d)

* 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 11:41:23 +01:00
Deepak Prabhakara 1d6a7e8e31
use customer query param instead of domain to fetch all users (#2594)
* use customer query param instead of domain to fetch all users

* members list doesn't take customer param

* Fix query param in tests

---------

Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-04-17 12:06:42 +01:00
Aswin V fde514123b
Pagination View fixes for DSync User/Group Lists (#2572)
* Handle pagination query params correctly and set response header for pageToken

* Support for pageToken

* Revert tokenmap change for and add comment

* Exclude `log_webhook_events` checkbox while creating

* `pageToken` handling for WebhookLogs

* `pageToken` handling in API route

* Fix unit tests

* Fix test

* Update tokenmap using effect
2024-04-15 11:01:32 +01:00
Aswin V 662e5cf46a
Google DSync fixes (#2560)
* Fix `nextPageToken` -> `pageToken`

* [Unit test] Add User obj type

* [Unit test] Populate 5k users

* [Unit test] Mock get for 5k users with pagination

* [Unit test] Update assertions
2024-04-11 23:59:59 +02: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
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
Kiran K f159ce7014
DSync: add roles into root along with raw to align with SSO (#2378)
* Add roles attribute to the dsync user profile

* Add roles property to transformed user object

* Add unit tests

* Remove unused import statement

* Fix the property

* Add tests
2024-03-07 17:41:17 +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 a473b360ef
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
Kiran K f923451fbf
Fix type error (#2374)
* Fix type error

* wip

* Remove tests

* Remove unused import in db.test.ts

* check types in ci/cd

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2024-03-05 12:44:50 +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
Kiran K a6ef0ddddb
Internal UI : Setup Link & SSO Tracer (#2354)
* 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

* Add new components and hooks for directory sync

* lint fix

* updated swr

* 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

* 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

* Add query parameters to API URLs in DirectoryGroups

* Add Google authorization status badge and handle pagination in FederatedSAMLApps

* Add router prop to AppsList component and update page header titles

* UI changes

* Add new files and export functions

* Remove unused router prop

* Add PencilIcon to FederatedSAMLApps

* Refactor FederatedSAMLApps and NewFederatedSAMLApp components

* lint fix

* add jose npm to dev dep

* added missing strings

* locale strings fix

* locale strings cleanup

* 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

* wip

* Add `--legacy-peer-deps` to prevent installing peer dependencies

* wip

* Fix the types import path

* wip

* wip

* Fix the types

* Format

* Update package-lock

* Cleanup

* Try adding jose library version 5.2.2

* Add new dependencies for @next/swc package

* Fix translation keys and import types

* Update SSOTracers component and common.json localization

* COPY internal-ui before npm install

* COPY internal-ui in builder stage

* fixed sort order for jose

* wip

* wip setuplink

* Add delete link

* Add exclusion for node_modules in files.exclude

* Add error handling and additional functionality to SetupLinks component

* Refactor SetupLinks component and add missing translations

* Add missing translations and update setup link messages

* Remove comment

* update localization strings

* Remove unused key

* Update SSOTracerInfo component title

* Refactor ConfirmationModal component button styling

* Update package.json and ConfirmationModal.tsx

* Update dep

* Refactor setup links API and UI to use query parameters for pagination

* Refactor deleteLink API endpoint and SetupLinks component

* Update package.json paths

* Update dep

* Refactor setup link forms and add new fields

* Update dep

* Update import paths and add new setup links tests

* wip

* Refactor CreateDirectory and DirectoryInfo components

* Add new fields to setup link and directory sync APIs

* Cleanup

* Update package-lock

* Fix link regeneration

* updated package-lock

* Fix and add e2e tests

* Update API documentation with new parameters for setup link creation and update

* Revert

* Update postcss.config.js and SSOForm.tsx

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
Co-authored-by: Aswin V <vaswin91@gmail.com>
2024-03-01 17:00:38 +00:00
Kiran K 4e7810e93c
Add TTL to sso tracer and webhook events (#2360)
* wip ttl

* Add TTL to sso tracer and webhook events

* Fix the unit tests

* Commented out code for secondary indexes with ttl

* Update package-lock.json

* Fix the test
2024-02-28 23:24:42 +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
Kiran K 1a9af89110
Add `sortOrder` to sso connection to control the order of connections (#2231)
* Control the order of connections in the IdP selection list

* Remove unused import statement

* Fix the sortOrder

* Type fix

* Fix TS error

* Fix build

* Update API version and add sortOrder parameter

* Update swagger specs

* Update swagger

* Add tests

* Add `sortOrder` to GET spec

* Refactor connection retrieval logic and add sorting option

* Fix connection sorting issue

* Fix connection sorting issue

* Update the validation

* Fix the tests

* Filter out connections that are not enabled

---------

Co-authored-by: Aswin V <vaswin91@gmail.com>
Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2024-02-08 15:14:14 +00:00
Deepak Prabhakara 3469bddf29
trying mongodb flaky tests fix (#2241)
* trying mongodb 5.0.24

* Revert "trying mongodb 5.0.24"

This reverts commit 04b96beadd.

* not ideal but add artificial delay
2024-02-01 23:08:34 +00:00
Aswin V 48c4fc74c7
Accept label for SSO connection (#2223)
* Accept label for SSO connection

* Fix test

* Sync lock file

* Update swagger
2024-01-31 09:08:40 +00:00
Deepak Prabhakara 70188ba593
randomize sessionStore to avoid tests failing in concurrent builds (#2204) 2024-01-26 11:01:20 +00:00
Aswin V b81e9218f1
Trace OIDC response path (#2179)
* [typings] OIDC provider clientId/secret is non optional

* try/catch and trace the errors ...

* Fix error message inside `resolveConnection`

* Default for error_description, trace error should be either error or fallback to description

* Attach traceId to OAuth error response

* Add more context to the traces

* [fed-saml] Add relayState to trace context

* Tenant/product can be traced from session.request in case connection is not resolved

* Minor change

* [npm] Rename `saml-tracer` -> `sso-tracer`

* [Admin UI/API] Rename `saml-tracer` -> `sso-tracer`

* [v1 API] Rename `saml-traces` -> `sso-traces` with alias to old path

* Fix assertion type display with fallback to `-`

* Update swagger spec

* Scroll in case text overflows
2024-01-23 22:35:17 +00:00
Aswin V ca9006702b
Implement DB store count (#1581)
* 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

* Impl `getCount`

* SQL impl

* Mongo impl

* Sync lock file

* Unit test for `getCount`

* `getCount` should be optional

* Add invocation gaurd against undefined

* updated package-lock

* updated package lock

* Silently fail if getCount is not supported

* [sql] Support count using index query

* [mongo] support count using index query

* Support count by index query on Store/DB abstractions

* Add test for countByIndex

* Add missing step for hashing the index value

* Minor refactor in test to distinguish engine vs type

* Enable getCount for planetscale

* Pass `hint` to countDocuments

* updated package-lock

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
Co-authored-by: Vishal Lodha <vishal@boxyhq.com>
Co-authored-by: Utkarsh Mehta <ukrocks.mehta@gmail.com>
2024-01-12 10:35:54 +00:00
Deepak Prabhakara b4827970ed
added close function to close DB connections (#1872)
* added close function to close DB connections

* fixed teardown

* test close() separately

* lint fix

* cleanup

* fixed db tests

* turn off tests for close

* Apply suggestions from code review

Co-authored-by: Kiran K <kiran@boxyhq.com>

* fixed tests for close()

---------

Co-authored-by: Kiran K <kiran@boxyhq.com>
2024-01-09 17:34:10 +00:00
Aswin V 4194d2dad3
Rfc9207 support for OIDC connections (#2135)
* Align expected type with oidc

* Pass through all params to openid-client

* Remove error handling, will be handled by openid-client

* Use `CallbackParamsType` from openid-implementation, cleanup previous type

* Sync lock files

* Fix test type

* Pass `checks.state`

* Remove obsolete type

* Forward `error/error_description` from OIDC provider response

* Fix tests

* Sync lock file
2024-01-09 22:44:26 +05:30
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 2992f36e84
Pass the okta runscope tests for SCIM (#2073)
* Pass the okta runscope tests for SCIM

* Fix duplicate group and user creation

* Remove unused const

* Update the tests

* Refactor error response in DirectoryGroups.ts
2023-12-22 14:16:11 +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
Aswin V bbd1396400
Sort order for getByIndex (#1871)
* Pass along sortOrder and use it in query

* Fix query

* Try with new syntax

* Switch `findBy` (sort order unsupported) to `find`

* Remove square brackets

* Refactor

* Add sort order test for getByIndex

* Fix type

* Support sortOrder for `mem`

* Support sort order for redis (non paginated case covered now)

* Fix e2e test list order

* Revert redis changes

* Exclude redis from test
2023-11-01 12:04:24 +00:00
Kiran K 70b3a037eb
Add sort order option to `getAll` function (#1565)
* add sort order

* add tests

* wip

* Fix the sort

* Cleanup

* Tweak

* Update tests

* Fix the test

* test db

* Run test

* Add precision 6

* Run test

* Test planetscale

* Test migration

* Remove test migration

* Update migration

* npm install

* modifiedAt column type change

* Remove test migration

* add migrations

* Fix

* Rename migration

* Fix the migration file name

* Fix conflict

* Update package-lock

* Fix Planetscale migration

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2023-10-24 18:11:52 +01:00
Kiran K 5cde18c6f9
Enhance SAML federation flow (#1743)
* Enhance saml federation flow

* redirectUrl -> redirect_url

* request -> requested

* add client_id to session

* responseForm -> response_form

* Cleanup

* Fix unit test

* fixed typo

---------

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2023-10-10 14:22:11 +01:00
Kiran K 3944f99081
Updates to SAML federation (#1724)
* Add unit test cases

* Fix displaying the branding

* Remove the license check on the metadata

* Fix the endpoint

* Add e2e

* Fix the tests

* Fix the tests

* Remove unused imports

* Improve the tests

* add BOXYHQ_LICENSE_KEY

* Fix the test
2023-10-05 17:47:20 +01:00
Deepak Prabhakara 1e116f380d
OIDC issuer should match external url where its hosted (#1715)
* oidc issuer should match external url where it's hosted

* fixed test

* Fix `issuer` in id_token

* Sync lock file

* Fix test

---------

Co-authored-by: Aswin V <vaswin91@gmail.com>
2023-10-05 17:46:26 +01:00
Kiran K 24a2927346
Add `/api/v1/federated-saml` endpoints (#1671)
* Get Federated SAML apps by product

* move to /ee

* Rename method

* Fix APIs

* delete app by tenant + product

* get app by tenant and product

* Fix the params

* Fix the params

* Change API path to /saml-federation

* Update the paths

* use /federated-saml

* Revert

* Add swagger specs

* Fix tests
2023-10-04 13:07:46 +01:00
Deepak Prabhakara 89d44ca903
updated tap (#1615)
* updated tap

* Fix the tests

* Update package-lock.json

* upgrade to 18.1.1

* Update package-lock.json

* Update package.json

---------

Co-authored-by: Kiran K <mailtokirankk@gmail.com>
Co-authored-by: Kiran K <kiran@boxyhq.com>
2023-09-25 11:03:21 +01:00
Aswin V 00e09d5561
Populate `requested` for IdP flow (#1481)
* Populate `requested` for IdP flow

* Sync lock file

* Assert requested in profile
2023-08-19 00:53:06 +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 405ca220fa
Add API to fetch dsync connections by product (#1239)
Add API to fetch the dsync connections by product
2023-06-26 10:28:57 +01:00
Kiran K 06f49e5516
Add API to fetch SSO connections by product (#1236)
* add secondary index on product

* add getConnectionsByProduct

* add unit test

* add API

* remove unused import

* update comment
2023-06-26 10:28:48 +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
Aswin V a14823938b
Fix db test run transient errors (#1074)
* Remove end calls

* Remove `t` param

* Try with db config setup inside before

* Console.log inside test

* Restructure tests

* Increase test timeout to 150 seconds

* Revert changes

* Don't timeout tap tests, rely on CI/CD timeout

* Remove `t.end` calls

* Remove remaining end calls

* Remove unused argument
2023-04-12 22:33:05 +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
Kiran K b321184fec
Add support for the method `deleteMany()` (#1033)
* wip

* Add deleteMany method to SQL engine

* add deleteMany to mem engine

* add deleteMany to MongoDB

* add deleteMany to Redis engine

* fix the test

* use deleteMany method in dsync

* add delete directory connection API

* add button to delete directory

* add new lang keys

* fix the delete directory connection

* use a limit variable

* fix eslint issues

* attempt to fix the test

* DynamoDB support deleteMany

* check if disabling DYNAMODB_URL can fix the timeout issue

* fix the planetscale impl

* Test GitHub action

* revert the change

* add bulk Delete Batch Size

* deleteAll should accept the directory Id

* fix the deleteMany for mem engine

* fix the tests

* cleanup

* change the order of deletion

* add database transaction to sql

* fix the linting issue

* use the promise

* rename variable

* change the delete order
2023-03-28 14:39:21 +01:00
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 aa86596983
Improvements to SCIM Group Sync operations (#1014) 2023-03-15 23:46:11 +05:30
Kiran K 68e355c09f
Add support for Webhook retry logic (#999)
add webhook retry logic
2023-03-15 22:47:58 +05:30
Kiran K cb52759d98
Directory sync: update raw user attributes (#998)
* add webhook retry method

* update the raw user attributes

* remove the webhook retry logic

* add a unit test

* try lodash

* try npx

* Update package.json
2023-03-15 10:32:58 +05:30
Kiran K 7283db3065
Fix the Directory Sync operations (#996)
* Fix the Directory Sync operations

* wip

* cleanup
2023-03-10 12:57:38 +00:00