Skip to content

Commit

Permalink
feat: Adds support for multitenancy (#555)
Browse files Browse the repository at this point in the history
* adds connection uri and tenant id based resource distributor

* removes unnecessary file

* adds a bunch of todos

* adds storage layer function and also laod all configs function

* implements core config merging across tenants

* restructures code related to config checking in core

* changes storage layer to take json instead of config file path

* small refactor

* adds ability to create new storage instances on the fly

* in mem db function impl for user pool ID and config conflict checking

* small change

* adds checks for conflicting core configs

* adds a few tests for multi tenant config

* adds more tests

* more tests

* adds function to get connection pool ID

* adds skeleton for loading storage layers for tenants

* fixes compile error

* adds code to load multiple storage layers as well

* deletes info across all tenants during testing

* adds one test for storage layer

* fixes a test

* fixes bug in setting resource in resource distributor

* fixes bugs

* loads signing keys for all tenants

* fixes bug

* adds new test and modifies the testing kill process to clear databases across mulitple user pools

* implements more test

* small change to formatting

* small change to formatting

* modifies cron jobs to run per unique user pool ID

* fixes a few bugs

* disallows different argon2 pool size across tenants

* changes server api key check to be based on connection uri as well

* adds function for getTenantId

* modfies delete user API as well

* makes tests compile

* marked getStorageLayer older version as testonly

* fixes a few tests

* removes unused storage layer when loading them for all tenants

* makes storagelayer.getAuthRecipeStorage testonly

* makes storagelayer.getSession testonly

* makes storagelayer.getEmailPasswordStorage testonly

* makes storagelayer.getEmailVerificationStorage testonly

* makes storagelayer.getThirdPartyStorage testonly

* makes storagelayer.getPasswordlessStorage testonly

* more updates to storage layer functions and reciope

* completes all storage layer function changes

* makes Config.getConfig testonly

* implements custom routing class for api requests

* fixes a few bugs

* adds test cases

* adds tenant not found logic

* adds new exception

* fixes all tests

* removes unnecessary exception catching

* fixes bug

* adds test for path router

* adds more tests

* adds more tests

* adds more tests

* changes defaulttenantid to public

* adds appId as a identifier for a unique tenant

* adds extracting appId from request path

* small change

* fixes bug with extarcting tenantid with appid

* fixes bug

* adds more tests

* starts working on multitenancy class and utils functions

* more changes to multitenancy file

* fixes a bug

* small change

* ads crud functions for multi tenancy

* changes to use of quiteprogramexception from in mem db

* adds skeleton for multitenancy functions in in mem db

* adds a few todos

* small change

* small change

* adds more functions to multi tenancy impl

* adds multi tenancy functions to delete and get info

* fixes tests

* adds a few exception cases

* updates exception import

* small change to make debugging easier

* fixes logging related issue in test

* checks for permission when creating a new app

* simplifies delete of app and connectionuridomain

* adds sync to respirce distributor

* small change

* small changes

* checks if multi tenancy is enabled in license key during tenant creation

* adds FeatureNotEnabledException exception

* small refactor

* fixes deadlock condition

* fixes in memory db issue

* does deep equals in tenant refresh function

* small change

* adds more checks when adding or updating a tenant

* adds tenantIdentifier for emailpassword and useridmapping recipes

* enforces unique user pool id per connectionuridomain

* small bug fix for refreshing cronjobs

* makes cronjob run per user pool, but pass list of tenants within that pool to the doTask function

* changes to incorporate tenantIndetifier for key value storage

* changes to session receipe to add tenantIdentifier

* adds a todo

* introduces the concept of appIdentifier vs tenantIdentifier

* fixes test compilation issues

* fixes bugs from existing tests

* adds appidentifier to user metadata functions

* modifes user roles functions to add tenantidentifier and appidentifiers

* small refactor

* modifies session recipe to add tenantId as part of the access token and refresh token

* small change

* fixes a bug

* modifies emailpassword functions

* changes to a few functions

* adds appidentifier to email verfication

* adds tenant identifier to third party

* adds tenantidentifier to passwordless

* changes how tenant configs are checked

* fixes tests

* small bug fixes

* fix: config tests (#568)

* fix: added a config test

* fix: added few config tests

* fix: pr comments

* fix: pr comments

* fix: new exceptions and tests (#573)

* fix: added a config test

* fix: added few config tests

* fix: pr comments

* fix: pr comments

* fix: new exceptions and tests

* fix: new tests and moved race condition test to postgres plugin

* fix: new tests

* fix: updated tests

* fix: concurrent test

* fix: typos

* fix: random test

* fix: random test

* makes telemetry and feature flag multi tenant as well - per app

* refactors crontask to be better suited for multi tenancy

* fix: Email password and user id mapping multi tenancy changes (#580)

* fix: ep recipe impl

* fix: updated as per plugin interface

* fix: pr comments

* fix: fixed unknown user handling

* fix: update useridmapping

* fix: updated the way storage is passed

* fix: updated the way storage is passed

* fix: smaller changes

* fix: smaller changes

* fix: pr comments

* fix: cleanup

* fix: cleanup

* fix: pr comments

* fix: fix compile

* fix: pr comments and test fixes

* fix: revert delete user

* fix: updated deleteUserAPI

* fix: test fix

* fix: plugin interface related

* fix: pr comments

* fix: pr comments

* fix: removed getTenantIdentifierFromRequest

* fix: app identifier with storage

* fixes test

* fix: Multitenant userroles (#600)

* fix: user roles impl

* fix: handling fkey

* fix: pr comments

* fix: pr comments

* fix: Multitenant usermetadata (#605)

* fix: user roles impl

* fix: handling fkey

* fix: usermetadata impl

* fix: user metadata impl

* fix: api updates

* fix: emailpassword storage (#607)

* fix: uid mapping storage (#608)

* fix: multitenant ep tests (#609)

* fix: Multitenant user id mapping tests (#611)

* fix: uid mapping tests

* fix: uid mapping tests

* fix: uid mapping tests

* fix: uid mapping tests

* fix: uid mapping tests

* fix: uid mapping tests

* fix: pr comments

* fix: pr comments

* fix: pr comments

* fix: Multitenant API, storage and tests (#614)

* fix: passwordless storage

* fix: passwordless changes and tests

* fix: passwordless changes and tests

* fix: passwordless changes and tests

* fix: pr comments

* fix: Multitenant thirdparty API, storage and tests (#616)

* fix: thirdparty storage and API

* fix: thirdparty tests

* fix: thirdparty changes

* fix: pr comments

* fix: Multitenant emailverification (#618)

* fix: thirdparty storage and API

* fix: thirdparty tests

* fix: emailverification storage

* fix: emailverification changes

* fix: emailverification test

* fix: comment

* fix: token tenant specific

* fix: Multitenant session (#619)

* fix: session changes

* fix: session changes

* fix: session API

* fix: updated comments

* fix: minor fixes

* fix: minor fixes

* fix: minor fixes

* fix: minor fixes

* fix: minor fixes

* fix: session tests

* fix: fixed tests

* fix: pr comments

* fix: pr comments

* fix: pr comments

* fix: pr comments

* fix: removed unused param

* fix: pr comments

* merges with latest (#622)

* merges with latest - tests not fixed

* fixes a few tests

* fixes test compilation issue

* fixes tests

* adds load testing basics

---------

Co-authored-by: Sattvik Chakravarthy <sattvik@supertokens.com>

* several fixes

* fix: Multitenant jwt (#629)

* fix: jwt changes

* fix: undo

* fix: Multitenant Auth Recipe (#633)

* fix: auth recipe storage

* fix: auth recipe changes

* fix: updated API

* fix: pr comments

* fix: pr comments

* fix: Multitenant dashboard (#636)

* fix: dashboard changes

* fix: dashboard test

* fix: Multitenant totp (#637)

* fix: totp changes

* fix: handling fk

* fix: updated comments

* fix: multitenant test

* fix: pr comment

* merges (#638)

* adds new config (#639)

* makes test more reliable

* removes unnecessary deprecated annotation (#640)

* fix: multitenancy changes (#641)

* fix: api implementations

* fix: after merge

* fix: test fix

* fix: test fix

* fix: working cud tests

* fix: db config protection

* fix: add user to tenant

* fix: tests

* fix: pr comment

* fix: cleanup

* fix: input parsing

* fix: PR comments

* fix: remove DeletionInProgressException

* fix: removeUserIdFromTenant

* fix: protected fields

* fix: pr comment

* fix: more tests and fixes

* fix: fixed validation

* fix: remove api permission checks

* fix: fixed permission logic and added tests

* fix: thirdparty config tests and fixes

* fix: thirdparty config tests and fixes

* fix: tests

* fix: pr comments

* fix: pr comments

* fix: pr comments

* fix: pr comment

* fix: Misc changes (#645)

* fix: api implementations

* fix: after merge

* fix: test fix

* fix: test fix

* fix: working cud tests

* fix: db config protection

* fix: add user to tenant

* fix: tests

* fix: pr comment

* fix: cleanup

* fix: input parsing

* fix: PR comments

* fix: remove DeletionInProgressException

* fix: removeUserIdFromTenant

* fix: protected fields

* fix: pr comment

* fix: more tests and fixes

* fix: fixed validation

* fix: remove api permission checks

* fix: fixed permission logic and added tests

* fix: thirdparty config tests and fixes

* fix: thirdparty config tests and fixes

* fix: tests

* fix: config api

* fix: active users

* fix: test only code in production

* fix: Tenantid logging (#646)

* fix: tenant id in logging

* fix: pr comment

* fix: Rate limiting hello (#647)

* fix: rate limiting hello api

* fix: pr comments

* fix: multitenancy stats (#649)

* fix: multitenancy stats

* fix: pr comment and test

* fix: pr comment

* fix: pr comment

* fix: Tenantid in userobjects (#650)

* fix: create user type

* fix: test fixes

* fix: added test

* fix: refactored ep and tp

* fix: refactor pless

* fix: test fix

* fix: pr comment

* fix: Ip filter per tenant (#652)

* fix: ip filter impl

* fix: ip filter impl

* fix: ip filter impl

* fix: jwt fix

* fix: updated console log (#653)

* fix: API key per app (#654)

* fix: Startup log (#655)

* fix: tenant id in loadConfig

* fix: remove repeat log

* fix: added test

* fix: License tests (#656)

* fix: license tests

* fix: added test

* fix: pr comment

* test: Config normalisation test (#658)

* fix: added tests for config normalisation

* fix: fixed comment

* fix: fixed comment

* fix: delete non auth user in deleteUserIdFromTenantId (#659)

* fix: delete user in non auth recipe

* fix: pr comments

* fix: thirdparty related tests (#661)

* fix: tp changes

* fix: pr comment

* fix: Config validation (#662)

* fix: config validation

* fix: config validation

* fix: pr comment

* fix: pr comment

* fix: pr comment

* fix: pr comment

* fix: config per tenant, per app annotations and validation (#666)

* fix: pagination test (#667)

* fix: added version check for multitenant apis (#669)

* fix: added version check for multitenant apis

* fix: pr comment

* fix: clean up init keys (#670)

* fix: clean up init keys

* fix: pr comment

* fix: removed isTesting check in prod code (#671)

* fix: resource reloading (#673)

* fix: resource reloading

* fix: license test task reloading

* fix: reload revert

* fix: impl

* fix: pr comments

* fix: pr comments

* fix: pr comment

* fix: pr comments

* fix: fixed missing log (#678)

* fix: fixed logging

* fix: pr comments

* fix: pr comments

* fix: merge issues (#680)

* fix: session v4 (#683)

* fix: session v4

* fix: tests

* fix: pr comments and tests

* fix: test

* fix: pr comments

* fix: Postgres migration (#685)

* fix: changelog

* fix: changelog

* fix: pr comments

* fix: fixed tests for active user storage (#686)

* refactor: Add email to the response of Dashboard verify session API (#689)

* Update Dashboard verify session API to return the user's email

* Update tests

* Update CHANGELOG

* Make changes based on PR comments

* fix: Inmemory plugin (#693)

* fix: inmemory impl

* fix: test fixes

* fix: test fixes

* fix: version update

* fix: version update

* fix: jar

* fix: update version

* fix: CDI version update

* fix: mongo plugin (#694)

* fix: mongo plugin

* test: fix mongodb tests

* fix: pr comments

---------

Co-authored-by: Mihaly Lengyel <mihaly@lengyel.tech>

* fix: added date

* fix: added date

* Update coreDriverInterfaceSupported.json

---------

Co-authored-by: Sattvik Chakravarthy <sattvik@gmail.com>
Co-authored-by: Sattvik Chakravarthy <sattvik@supertokens.com>
Co-authored-by: Nemi Shah <nemishah1212@gmail.com>
Co-authored-by: Mihaly Lengyel <mihaly@lengyel.tech>
  • Loading branch information
5 people authored Jun 2, 2023
1 parent ff04fd7 commit b294e0f
Show file tree
Hide file tree
Showing 327 changed files with 36,242 additions and 7,441 deletions.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ highlighting the necessary changes)
- [ ] Had installed and ran the pre-commit hook
- [ ] If there are new dependencies that have been added in `build.gradle`, please make sure to add them
in `implementationDependencies.json`.
- [ ] Update function `getValidFields` in `io/supertokens/config/CoreConfig.java` if new aliases were added for any core config (similar to the `access_token_signing_key_update_interval` config alias).
- [ ] Issue this PR against the latest non released version branch.
- To know which one it is, run find the latest released tag (`git tag`) in the format `vX.Y.Z`, and then find the
latest branch (`git branch --all`) whose `X.Y` is greater than the latest released tag.
Expand Down
Loading

0 comments on commit b294e0f

Please sign in to comment.