@contember/engine-tenant-api 1.2.1 → 1.3.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/TenantContainer.d.ts +1 -1
- package/dist/src/TenantContainer.d.ts.map +1 -1
- package/dist/src/TenantContainer.js +2 -0
- package/dist/src/TenantContainer.js.map +1 -1
- package/dist/src/bin/runMigrations.d.ts +2 -0
- package/dist/src/bin/runMigrations.d.ts.map +1 -0
- package/dist/src/bin/runMigrations.js +28 -0
- package/dist/src/bin/runMigrations.js.map +1 -0
- package/dist/src/migrations/2018-08-02-174310-init.d.ts +3 -0
- package/dist/src/migrations/2018-08-02-174310-init.d.ts.map +1 -0
- package/dist/src/migrations/2018-08-02-174310-init.js +64 -0
- package/dist/src/migrations/2018-08-02-174310-init.js.map +1 -0
- package/dist/src/migrations/2018-09-03-140621-identity-project.d.ts +3 -0
- package/dist/src/migrations/2018-09-03-140621-identity-project.d.ts.map +1 -0
- package/dist/src/migrations/2018-09-03-140621-identity-project.js +33 -0
- package/dist/src/migrations/2018-09-03-140621-identity-project.js.map +1 -0
- package/dist/src/migrations/2018-10-26-165450-setup-api-key.d.ts +3 -0
- package/dist/src/migrations/2018-10-26-165450-setup-api-key.d.ts.map +1 -0
- package/dist/src/migrations/2018-10-26-165450-setup-api-key.js +27 -0
- package/dist/src/migrations/2018-10-26-165450-setup-api-key.js.map +1 -0
- package/dist/src/migrations/2018-10-26-175155-variables.d.ts +3 -0
- package/dist/src/migrations/2018-10-26-175155-variables.d.ts.map +1 -0
- package/dist/src/migrations/2018-10-26-175155-variables.js +23 -0
- package/dist/src/migrations/2018-10-26-175155-variables.js.map +1 -0
- package/dist/src/migrations/2019-02-18-110949-project-slug.d.ts +3 -0
- package/dist/src/migrations/2019-02-18-110949-project-slug.d.ts.map +1 -0
- package/dist/src/migrations/2019-02-18-110949-project-slug.js +18 -0
- package/dist/src/migrations/2019-02-18-110949-project-slug.js.map +1 -0
- package/dist/src/migrations/2019-02-18-160155-session-expiration.d.ts +3 -0
- package/dist/src/migrations/2019-02-18-160155-session-expiration.d.ts.map +1 -0
- package/dist/src/migrations/2019-02-18-160155-session-expiration.js +11 -0
- package/dist/src/migrations/2019-02-18-160155-session-expiration.js.map +1 -0
- package/dist/src/migrations/2019-05-03-163729-api-key-disabled-at.d.ts +3 -0
- package/dist/src/migrations/2019-05-03-163729-api-key-disabled-at.d.ts.map +1 -0
- package/dist/src/migrations/2019-05-03-163729-api-key-disabled-at.js +18 -0
- package/dist/src/migrations/2019-05-03-163729-api-key-disabled-at.js.map +1 -0
- package/dist/src/migrations/2019-08-14-153300-project-slug-unique.d.ts +3 -0
- package/dist/src/migrations/2019-08-14-153300-project-slug-unique.d.ts.map +1 -0
- package/dist/src/migrations/2019-08-14-153300-project-slug-unique.js +11 -0
- package/dist/src/migrations/2019-08-14-153300-project-slug-unique.js.map +1 -0
- package/dist/src/migrations/2019-09-06-111000-membership.d.ts +3 -0
- package/dist/src/migrations/2019-09-06-111000-membership.d.ts.map +1 -0
- package/dist/src/migrations/2019-09-06-111000-membership.js +51 -0
- package/dist/src/migrations/2019-09-06-111000-membership.js.map +1 -0
- package/dist/src/migrations/2019-09-06-111001-drop-old-member.d.ts +3 -0
- package/dist/src/migrations/2019-09-06-111001-drop-old-member.d.ts.map +1 -0
- package/dist/src/migrations/2019-09-06-111001-drop-old-member.js +11 -0
- package/dist/src/migrations/2019-09-06-111001-drop-old-member.js.map +1 -0
- package/dist/src/migrations/2020-01-29-idenity-note.d.ts +3 -0
- package/dist/src/migrations/2020-01-29-idenity-note.d.ts.map +1 -0
- package/dist/src/migrations/2020-01-29-idenity-note.js +18 -0
- package/dist/src/migrations/2020-01-29-idenity-note.js.map +1 -0
- package/dist/src/migrations/2020-04-17-fix-person-index.d.ts +3 -0
- package/dist/src/migrations/2020-04-17-fix-person-index.d.ts.map +1 -0
- package/dist/src/migrations/2020-04-17-fix-person-index.js +12 -0
- package/dist/src/migrations/2020-04-17-fix-person-index.js.map +1 -0
- package/dist/src/migrations/2020-05-01-170000-api-key-index.d.ts +3 -0
- package/dist/src/migrations/2020-05-01-170000-api-key-index.d.ts.map +1 -0
- package/dist/src/migrations/2020-05-01-170000-api-key-index.js +10 -0
- package/dist/src/migrations/2020-05-01-170000-api-key-index.js.map +1 -0
- package/dist/src/migrations/2020-06-08-134000-tenant-credentials.d.ts.map +1 -1
- package/dist/src/migrations/2020-06-08-134000-tenant-credentials.js +2 -50
- package/dist/src/migrations/2020-06-08-134000-tenant-credentials.js.map +1 -1
- package/dist/src/migrations/2020-08-07-110000-person-otp.d.ts +3 -0
- package/dist/src/migrations/2020-08-07-110000-person-otp.d.ts.map +1 -0
- package/dist/src/migrations/2020-08-07-110000-person-otp.js +12 -0
- package/dist/src/migrations/2020-08-07-110000-person-otp.js.map +1 -0
- package/dist/src/migrations/2020-08-17-162200-mail-templates.d.ts +3 -0
- package/dist/src/migrations/2020-08-17-162200-mail-templates.d.ts.map +1 -0
- package/dist/src/migrations/2020-08-17-162200-mail-templates.js +23 -0
- package/dist/src/migrations/2020-08-17-162200-mail-templates.js.map +1 -0
- package/dist/src/migrations/2020-08-21-143400-person-password-reset.d.ts +3 -0
- package/dist/src/migrations/2020-08-21-143400-person-password-reset.d.ts.map +1 -0
- package/dist/src/migrations/2020-08-21-143400-person-password-reset.js +23 -0
- package/dist/src/migrations/2020-08-21-143400-person-password-reset.js.map +1 -0
- package/dist/src/migrations/2020-09-07-094200-identity-provider.d.ts +3 -0
- package/dist/src/migrations/2020-09-07-094200-identity-provider.d.ts.map +1 -0
- package/dist/src/migrations/2020-09-07-094200-identity-provider.js +17 -0
- package/dist/src/migrations/2020-09-07-094200-identity-provider.js.map +1 -0
- package/dist/src/migrations/2021-03-28-134000-timestamp.d.ts +3 -0
- package/dist/src/migrations/2021-03-28-134000-timestamp.d.ts.map +1 -0
- package/dist/src/migrations/2021-03-28-134000-timestamp.js +27 -0
- package/dist/src/migrations/2021-03-28-134000-timestamp.js.map +1 -0
- package/dist/src/migrations/2021-07-26-105000-project-config.d.ts +3 -0
- package/dist/src/migrations/2021-07-26-105000-project-config.d.ts.map +1 -0
- package/dist/src/migrations/2021-07-26-105000-project-config.js +12 -0
- package/dist/src/migrations/2021-07-26-105000-project-config.js.map +1 -0
- package/dist/src/migrations/2021-07-26-132000-project-secrets.d.ts +3 -0
- package/dist/src/migrations/2021-07-26-132000-project-secrets.d.ts.map +1 -0
- package/dist/src/migrations/2021-07-26-132000-project-secrets.js +24 -0
- package/dist/src/migrations/2021-07-26-132000-project-secrets.js.map +1 -0
- package/dist/src/migrations/2021-07-27-174000-project-alias-index.d.ts +3 -0
- package/dist/src/migrations/2021-07-27-174000-project-alias-index.d.ts.map +1 -0
- package/dist/src/migrations/2021-07-27-174000-project-alias-index.js +10 -0
- package/dist/src/migrations/2021-07-27-174000-project-alias-index.js.map +1 -0
- package/dist/src/migrations/2021-11-24-130000-person-password-null.d.ts +3 -0
- package/dist/src/migrations/2021-11-24-130000-person-password-null.d.ts.map +1 -0
- package/dist/src/migrations/2021-11-24-130000-person-password-null.js +10 -0
- package/dist/src/migrations/2021-11-24-130000-person-password-null.js.map +1 -0
- package/dist/src/migrations/2021-11-24-161500-mail-template-project-null.d.ts +3 -0
- package/dist/src/migrations/2021-11-24-161500-mail-template-project-null.d.ts.map +1 -0
- package/dist/src/migrations/2021-11-24-161500-mail-template-project-null.js +18 -0
- package/dist/src/migrations/2021-11-24-161500-mail-template-project-null.js.map +1 -0
- package/dist/src/migrations/2022-01-04-144000-person-unique-identity.d.ts +3 -0
- package/dist/src/migrations/2022-01-04-144000-person-unique-identity.d.ts.map +1 -0
- package/dist/src/migrations/2022-01-04-144000-person-unique-identity.js +11 -0
- package/dist/src/migrations/2022-01-04-144000-person-unique-identity.js.map +1 -0
- package/dist/src/migrations/2022-02-09-111800-fix-crypted.d.ts +3 -0
- package/dist/src/migrations/2022-02-09-111800-fix-crypted.d.ts.map +1 -0
- package/dist/src/migrations/2022-02-09-111800-fix-crypted.js +22 -0
- package/dist/src/migrations/2022-02-09-111800-fix-crypted.js.map +1 -0
- package/dist/src/migrations/2022-02-11-153000-idp-auto-sign-up.d.ts +3 -0
- package/dist/src/migrations/2022-02-11-153000-idp-auto-sign-up.d.ts.map +1 -0
- package/dist/src/migrations/2022-02-11-153000-idp-auto-sign-up.js +11 -0
- package/dist/src/migrations/2022-02-11-153000-idp-auto-sign-up.js.map +1 -0
- package/dist/src/migrations/2022-06-29-105000-person-idp.d.ts +3 -0
- package/dist/src/migrations/2022-06-29-105000-person-idp.d.ts.map +1 -0
- package/dist/src/migrations/2022-06-29-105000-person-idp.js +23 -0
- package/dist/src/migrations/2022-06-29-105000-person-idp.js.map +1 -0
- package/dist/src/migrations/2022-07-07-135000-person-email-opt-uniq.d.ts +3 -0
- package/dist/src/migrations/2022-07-07-135000-person-email-opt-uniq.d.ts.map +1 -0
- package/dist/src/migrations/2022-07-07-135000-person-email-opt-uniq.js +12 -0
- package/dist/src/migrations/2022-07-07-135000-person-email-opt-uniq.js.map +1 -0
- package/dist/src/migrations/2022-07-07-141000-person-display-name.d.ts +3 -0
- package/dist/src/migrations/2022-07-07-141000-person-display-name.d.ts.map +1 -0
- package/dist/src/migrations/2022-07-07-141000-person-display-name.js +13 -0
- package/dist/src/migrations/2022-07-07-141000-person-display-name.js.map +1 -0
- package/dist/src/migrations/2022-07-14-145000-person-login-options.d.ts +3 -0
- package/dist/src/migrations/2022-07-14-145000-person-login-options.d.ts.map +1 -0
- package/dist/src/migrations/2022-07-14-145000-person-login-options.js +15 -0
- package/dist/src/migrations/2022-07-14-145000-person-login-options.js.map +1 -0
- package/dist/src/migrations/2022-11-08-project-update-notification.d.ts +3 -0
- package/dist/src/migrations/2022-11-08-project-update-notification.d.ts.map +1 -0
- package/dist/src/migrations/2022-11-08-project-update-notification.js +64 -0
- package/dist/src/migrations/2022-11-08-project-update-notification.js.map +1 -0
- package/dist/src/migrations/runner.d.ts +1 -1
- package/dist/src/migrations/runner.d.ts.map +1 -1
- package/dist/src/migrations/runner.js +68 -5
- package/dist/src/migrations/runner.js.map +1 -1
- package/dist/src/migrations/snapshot-factory.d.ts +5 -0
- package/dist/src/migrations/snapshot-factory.d.ts.map +1 -0
- package/dist/src/migrations/snapshot-factory.js +18 -0
- package/dist/src/migrations/snapshot-factory.js.map +1 -0
- package/dist/src/migrations/snapshot.d.ts +4 -0
- package/dist/src/migrations/snapshot.d.ts.map +1 -0
- package/dist/src/migrations/snapshot.js +202 -0
- package/dist/src/migrations/snapshot.js.map +1 -0
- package/dist/src/migrations/tenantCredentials.d.ts +4 -0
- package/dist/src/migrations/tenantCredentials.d.ts.map +1 -0
- package/dist/src/migrations/tenantCredentials.js +57 -0
- package/dist/src/migrations/tenantCredentials.js.map +1 -0
- package/dist/src/migrations/types.d.ts +2 -0
- package/dist/src/migrations/types.d.ts.map +1 -1
- package/dist/src/model/commands/idp/UpdateIdpCommand.d.ts +1 -0
- package/dist/src/model/commands/idp/UpdateIdpCommand.d.ts.map +1 -1
- package/dist/src/model/queries/membership/ProjectMembersQuery.d.ts +3 -3
- package/dist/src/model/queries/membership/ProjectMembersQuery.d.ts.map +1 -1
- package/dist/src/model/queries/membership/ProjectMembersQuery.js +22 -10
- package/dist/src/model/queries/membership/ProjectMembersQuery.js.map +1 -1
- package/dist/src/model/service/IDPSignInManager.d.ts +3 -3
- package/dist/src/model/service/IDPSignInManager.d.ts.map +1 -1
- package/dist/src/model/service/IDPSignInManager.js +13 -5
- package/dist/src/model/service/IDPSignInManager.js.map +1 -1
- package/dist/src/model/service/ProjectMemberManager.d.ts +2 -2
- package/dist/src/model/service/ProjectMemberManager.d.ts.map +1 -1
- package/dist/src/model/service/ProjectMemberManager.js +2 -2
- package/dist/src/model/service/ProjectMemberManager.js.map +1 -1
- package/dist/src/model/service/idp/IDPHandlerRegistry.d.ts +2 -2
- package/dist/src/model/service/idp/IDPHandlerRegistry.d.ts.map +1 -1
- package/dist/src/model/service/idp/IDPHandlerRegistry.js.map +1 -1
- package/dist/src/model/service/idp/IDPManager.d.ts.map +1 -1
- package/dist/src/model/service/idp/IDPManager.js +7 -2
- package/dist/src/model/service/idp/IDPManager.js.map +1 -1
- package/dist/src/model/service/idp/IdentityProviderHandler.d.ts +6 -9
- package/dist/src/model/service/idp/IdentityProviderHandler.d.ts.map +1 -1
- package/dist/src/model/service/idp/index.d.ts +3 -1
- package/dist/src/model/service/idp/index.d.ts.map +1 -1
- package/dist/src/model/service/idp/index.js +3 -1
- package/dist/src/model/service/idp/index.js.map +1 -1
- package/dist/src/model/service/idp/providers/AppleProvider.d.ts +29 -0
- package/dist/src/model/service/idp/providers/AppleProvider.d.ts.map +1 -0
- package/dist/src/model/service/idp/providers/AppleProvider.js +79 -0
- package/dist/src/model/service/idp/providers/AppleProvider.js.map +1 -0
- package/dist/src/model/service/idp/providers/FacebookProvider.d.ts +27 -0
- package/dist/src/model/service/idp/providers/FacebookProvider.d.ts.map +1 -0
- package/dist/src/model/service/idp/providers/FacebookProvider.js +137 -0
- package/dist/src/model/service/idp/providers/FacebookProvider.js.map +1 -0
- package/dist/src/model/service/idp/providers/OIDCHelpers.d.ts +10 -0
- package/dist/src/model/service/idp/providers/OIDCHelpers.d.ts.map +1 -0
- package/dist/src/model/service/idp/providers/OIDCHelpers.js +56 -0
- package/dist/src/model/service/idp/providers/OIDCHelpers.js.map +1 -0
- package/dist/src/model/service/idp/providers/OIDCProvider.d.ts +19 -0
- package/dist/src/model/service/idp/providers/OIDCProvider.d.ts.map +1 -0
- package/dist/src/model/service/idp/providers/OIDCProvider.js +40 -0
- package/dist/src/model/service/idp/providers/OIDCProvider.js.map +1 -0
- package/dist/src/model/service/idp/providers/OIDCTypes.d.ts +62 -0
- package/dist/src/model/service/idp/providers/OIDCTypes.d.ts.map +1 -0
- package/dist/src/model/service/idp/providers/OIDCTypes.js +56 -0
- package/dist/src/model/service/idp/providers/OIDCTypes.js.map +1 -0
- package/dist/src/model/service/idp/providers/helpers.d.ts +3 -0
- package/dist/src/model/service/idp/providers/helpers.d.ts.map +1 -0
- package/dist/src/model/service/idp/providers/helpers.js +40 -0
- package/dist/src/model/service/idp/providers/helpers.js.map +1 -0
- package/dist/src/model/utils/DatabaseContext.d.ts +1 -0
- package/dist/src/model/utils/DatabaseContext.d.ts.map +1 -1
- package/dist/src/model/utils/DatabaseContext.js +5 -0
- package/dist/src/model/utils/DatabaseContext.js.map +1 -1
- package/dist/src/resolvers/mutation/idp/UpdateIDPMutationResolver.d.ts.map +1 -1
- package/dist/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js +4 -3
- package/dist/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js.map +1 -1
- package/dist/src/resolvers/mutation/person/IDPMutationResolver.d.ts.map +1 -1
- package/dist/src/resolvers/mutation/person/IDPMutationResolver.js +10 -3
- package/dist/src/resolvers/mutation/person/IDPMutationResolver.js.map +1 -1
- package/dist/src/resolvers/types/ProjectTypeResolver.d.ts.map +1 -1
- package/dist/src/resolvers/types/ProjectTypeResolver.js +14 -6
- package/dist/src/resolvers/types/ProjectTypeResolver.js.map +1 -1
- package/dist/src/schema/index.d.ts +26 -8
- package/dist/src/schema/index.d.ts.map +1 -1
- package/dist/src/schema/index.js +1 -0
- package/dist/src/schema/index.js.map +1 -1
- package/dist/src/schema/tenant.graphql.d.ts.map +1 -1
- package/dist/src/schema/tenant.graphql.js +32 -6
- package/dist/src/schema/tenant.graphql.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/tests/cases/integration/db/invite.test.js +2 -2
- package/dist/tests/cases/integration/db/unmanagedInvite.test.js +2 -2
- package/dist/{src → tests/cases}/migrations/2020-06-08-134000-tenant-credentials.test.d.ts +1 -1
- package/dist/tests/cases/migrations/2020-06-08-134000-tenant-credentials.test.d.ts.map +1 -0
- package/dist/{src → tests/cases}/migrations/2020-06-08-134000-tenant-credentials.test.js +19 -9
- package/dist/tests/cases/migrations/2020-06-08-134000-tenant-credentials.test.js.map +1 -0
- package/dist/tests/src/IdPMock.d.ts +4 -4
- package/dist/tests/src/IdPMock.d.ts.map +1 -1
- package/dist/tests/src/IdPMock.js +2 -2
- package/dist/tests/src/IdPMock.js.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -13
- package/src/TenantContainer.ts +4 -2
- package/src/bin/runMigrations.ts +32 -0
- package/src/migrations/{2018-08-02-174310-init.sql → 2018-08-02-174310-init.ts} +8 -1
- package/src/migrations/{2018-09-03-140621-identity-project.sql → 2018-09-03-140621-identity-project.ts} +8 -0
- package/src/migrations/{2018-10-26-165450-setup-api-key.sql → 2018-10-26-165450-setup-api-key.ts} +8 -0
- package/src/migrations/{2018-10-26-175155-variables.sql → 2018-10-26-175155-variables.ts} +7 -0
- package/src/migrations/{2019-02-18-110949-project-slug.sql → 2019-02-18-110949-project-slug.ts} +8 -0
- package/src/migrations/2019-02-18-160155-session-expiration.ts +10 -0
- package/src/migrations/{2019-05-03-163729-api-key-disabled-at.sql → 2019-05-03-163729-api-key-disabled-at.ts} +8 -0
- package/src/migrations/2019-08-14-153300-project-slug-unique.ts +10 -0
- package/src/migrations/{2019-09-06-111000-membership.sql → 2019-09-06-111000-membership.ts} +8 -0
- package/src/migrations/2019-09-06-111001-drop-old-member.ts +10 -0
- package/src/migrations/2020-01-29-idenity-note.ts +18 -0
- package/src/migrations/2020-04-17-fix-person-index.ts +12 -0
- package/src/migrations/2020-05-01-170000-api-key-index.ts +10 -0
- package/src/migrations/2020-06-08-134000-tenant-credentials.ts +3 -54
- package/src/migrations/2020-08-07-110000-person-otp.ts +12 -0
- package/src/migrations/{2020-08-17-162200-mail-templates.sql → 2020-08-17-162200-mail-templates.ts} +8 -0
- package/src/migrations/{2020-08-21-143400-person-password-reset.sql → 2020-08-21-143400-person-password-reset.ts} +8 -0
- package/src/migrations/{2020-09-07-094200-identity-provider.sql → 2020-09-07-094200-identity-provider.ts} +8 -0
- package/src/migrations/{2021-03-28-134000-timestamp.sql → 2021-03-28-134000-timestamp.ts} +9 -0
- package/src/migrations/2021-07-26-105000-project-config.ts +12 -0
- package/src/migrations/{2021-07-26-132000-project-secrets.sql → 2021-07-26-132000-project-secrets.ts} +8 -0
- package/src/migrations/2021-07-27-174000-project-alias-index.ts +10 -0
- package/src/migrations/2021-11-24-130000-person-password-null.ts +10 -0
- package/src/migrations/{2021-11-24-161500-mail-template-project-null.sql → 2021-11-24-161500-mail-template-project-null.ts} +8 -0
- package/src/migrations/2022-01-04-144000-person-unique-identity.ts +10 -0
- package/src/migrations/{2022-02-09-111800-fix-crypted.sql → 2022-02-09-111800-fix-crypted.ts} +8 -0
- package/src/migrations/2022-02-11-153000-idp-auto-sign-up.ts +10 -0
- package/src/migrations/{2022-06-29-105000-person-idp.sql → 2022-06-29-105000-person-idp.ts} +8 -0
- package/src/migrations/2022-07-07-135000-person-email-opt-uniq.ts +11 -0
- package/src/migrations/2022-07-07-141000-person-display-name.ts +13 -0
- package/src/migrations/{2022-07-14-145000-person-login-options.sql → 2022-07-14-145000-person-login-options.ts} +9 -0
- package/src/migrations/2022-11-08-project-update-notification.ts +64 -0
- package/src/migrations/runner.ts +72 -8
- package/src/migrations/snapshot-factory.ts +21 -0
- package/src/migrations/snapshot-template-end.txt +10 -0
- package/src/migrations/snapshot-template-start.txt +6 -0
- package/src/migrations/snapshot.ts +202 -0
- package/src/migrations/tenantCredentials.ts +58 -0
- package/src/migrations/types.ts +3 -0
- package/src/model/commands/idp/UpdateIdpCommand.ts +1 -0
- package/src/model/queries/membership/ProjectMembersQuery.ts +23 -14
- package/src/model/service/IDPSignInManager.ts +13 -10
- package/src/model/service/ProjectMemberManager.ts +3 -3
- package/src/model/service/idp/IDPHandlerRegistry.ts +3 -3
- package/src/model/service/idp/IDPManager.ts +6 -2
- package/src/model/service/idp/IdentityProviderHandler.ts +7 -15
- package/src/model/service/idp/index.ts +3 -1
- package/src/model/service/idp/providers/AppleProvider.ts +65 -0
- package/src/model/service/idp/providers/FacebookProvider.ts +125 -0
- package/src/model/service/idp/providers/OIDCHelpers.ts +54 -0
- package/src/model/service/idp/providers/OIDCProvider.ts +40 -0
- package/src/model/service/idp/providers/OIDCTypes.ts +61 -0
- package/src/model/service/idp/providers/helpers.ts +12 -0
- package/src/model/utils/DatabaseContext.ts +6 -0
- package/src/resolvers/mutation/idp/UpdateIDPMutationResolver.ts +1 -0
- package/src/resolvers/mutation/person/IDPMutationResolver.ts +9 -7
- package/src/resolvers/types/ProjectTypeResolver.ts +9 -2
- package/src/schema/index.ts +28 -8
- package/src/schema/tenant.graphql.ts +32 -6
- package/src/tsconfig.json +10 -30
- package/tests/cases/integration/db/invite.test.ts +2 -2
- package/tests/cases/integration/db/unmanagedInvite.test.ts +2 -2
- package/{src → tests/cases}/migrations/2020-06-08-134000-tenant-credentials.test.ts +17 -9
- package/tests/src/IdPMock.ts +4 -4
- package/tests/tsconfig.json +2 -6
- package/tsconfig.json +2 -6
- package/dist/src/migrations/2020-06-08-134000-tenant-credentials.test.d.ts.map +0 -1
- package/dist/src/migrations/2020-06-08-134000-tenant-credentials.test.js.map +0 -1
- package/dist/src/model/service/idp/OIDCProvider.d.ts +0 -25
- package/dist/src/model/service/idp/OIDCProvider.d.ts.map +0 -1
- package/dist/src/model/service/idp/OIDCProvider.js +0 -108
- package/dist/src/model/service/idp/OIDCProvider.js.map +0 -1
- package/src/migrations/2019-02-18-160155-session-expiration.sql +0 -2
- package/src/migrations/2019-08-14-153300-project-slug-unique.sql +0 -2
- package/src/migrations/2019-09-06-111001-drop-old-member.sql +0 -2
- package/src/migrations/2020-01-29-idenity-note.sql +0 -9
- package/src/migrations/2020-04-17-fix-person-index.sql +0 -3
- package/src/migrations/2020-05-01-170000-api-key-index.sql +0 -1
- package/src/migrations/2020-08-07-110000-person-otp.sql +0 -3
- package/src/migrations/2021-07-26-105000-project-config.sql +0 -3
- package/src/migrations/2021-07-27-174000-project-alias-index.sql +0 -1
- package/src/migrations/2021-11-24-130000-person-password-null.sql +0 -1
- package/src/migrations/2022-01-04-144000-person-unique-identity.sql +0 -2
- package/src/migrations/2022-02-11-153000-idp-auto-sign-up.sql +0 -2
- package/src/migrations/2022-07-07-135000-person-email-opt-uniq.sql +0 -3
- package/src/migrations/2022-07-07-141000-person-display-name.sql +0 -4
- package/src/model/service/idp/OIDCProvider.ts +0 -100
|
@@ -28,12 +28,23 @@ const schema: DocumentNode = gql`
|
|
|
28
28
|
changePassword(personId: String!, password: String!): ChangePasswordResponse
|
|
29
29
|
changeMyPassword(currentPassword: String!, newPassword: String!): ChangeMyPasswordResponse
|
|
30
30
|
|
|
31
|
-
initSignInIDP(
|
|
32
|
-
|
|
31
|
+
initSignInIDP(
|
|
32
|
+
identityProvider: String!,
|
|
33
|
+
data: Json
|
|
34
|
+
redirectUrl: String @deprecated(reason: "use data.redirectUrl")
|
|
35
|
+
): InitSignInIDPResponse
|
|
36
|
+
signInIDP(
|
|
37
|
+
identityProvider: String!,
|
|
38
|
+
data: Json,
|
|
39
|
+
expiration: Int
|
|
40
|
+
idpResponse: IDPResponseInput, @deprecated(reason: "pass idpResponse.url as data.url")
|
|
41
|
+
redirectUrl: String @deprecated(reason: "use data.redirectUrl"),
|
|
42
|
+
sessionData: Json @deprecated(reason: "use data.sessionData"),
|
|
43
|
+
): SignInIDPResponse
|
|
33
44
|
|
|
34
45
|
# IDP management
|
|
35
46
|
addIDP(identityProvider: String!, type: String!, configuration: Json!, options: IDPOptions): AddIDPResponse
|
|
36
|
-
updateIDP(identityProvider: String!, configuration: Json, options: IDPOptions): UpdateIDPResponse
|
|
47
|
+
updateIDP(identityProvider: String!, type: String, configuration: Json, options: IDPOptions): UpdateIDPResponse
|
|
37
48
|
disableIDP(identityProvider: String!): DisableIDPResponse
|
|
38
49
|
enableIDP(identityProvider: String!): EnableIDPResponse
|
|
39
50
|
|
|
@@ -78,10 +89,10 @@ const schema: DocumentNode = gql`
|
|
|
78
89
|
updateProject(projectSlug: String!, name: String, config: Json, mergeConfig: Boolean): UpdateProjectResponse
|
|
79
90
|
|
|
80
91
|
addProjectMailTemplate(template: MailTemplate!): AddMailTemplateResponse
|
|
81
|
-
@deprecated(reason: "use
|
|
92
|
+
@deprecated(reason: "use addMailTemplate")
|
|
82
93
|
|
|
83
94
|
removeProjectMailTemplate(templateIdentifier: MailTemplateIdentifier!): RemoveMailTemplateResponse
|
|
84
|
-
@deprecated(reason: "use
|
|
95
|
+
@deprecated(reason: "use removeMailTemplate")
|
|
85
96
|
|
|
86
97
|
}
|
|
87
98
|
|
|
@@ -242,6 +253,7 @@ const schema: DocumentNode = gql`
|
|
|
242
253
|
|
|
243
254
|
enum InitSignInIDPErrorCode {
|
|
244
255
|
PROVIDER_NOT_FOUND
|
|
256
|
+
IDP_VALIDATION_FAILED
|
|
245
257
|
}
|
|
246
258
|
|
|
247
259
|
input IDPResponseInput {
|
|
@@ -607,7 +619,21 @@ const schema: DocumentNode = gql`
|
|
|
607
619
|
slug: String!
|
|
608
620
|
config: Json!
|
|
609
621
|
roles: [RoleDefinition!]!
|
|
610
|
-
members(
|
|
622
|
+
members(
|
|
623
|
+
input: ProjectMembersInput,
|
|
624
|
+
memberType: MemberType @deprecated(reason: "Use args")
|
|
625
|
+
): [ProjectIdentityRelation!]!
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
input ProjectMembersInput {
|
|
629
|
+
limit: Int
|
|
630
|
+
offset: Int
|
|
631
|
+
filter: ProjectMembersFilter
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
input ProjectMembersFilter {
|
|
635
|
+
memberType: MemberType
|
|
636
|
+
email: String
|
|
611
637
|
}
|
|
612
638
|
|
|
613
639
|
enum MemberType {
|
package/src/tsconfig.json
CHANGED
|
@@ -5,35 +5,15 @@
|
|
|
5
5
|
"esModuleInterop": true
|
|
6
6
|
},
|
|
7
7
|
"references": [
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"path": "../../database-migrations/src"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"path": "../../dic/src"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../logger/src"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"path": "../../graphql-utils/src"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "../../schema/src"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../schema-utils/src"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../typesafe/src"
|
|
37
|
-
}
|
|
8
|
+
{ "path": "../../authorization/src" },
|
|
9
|
+
{ "path": "../../config-loader/src" },
|
|
10
|
+
{ "path": "../../database/src" },
|
|
11
|
+
{ "path": "../../database-migrations/src" },
|
|
12
|
+
{ "path": "../../dic/src" },
|
|
13
|
+
{ "path": "../../logger/src" },
|
|
14
|
+
{ "path": "../../graphql-utils/src" },
|
|
15
|
+
{ "path": "../../schema/src" },
|
|
16
|
+
{ "path": "../../schema-utils/src" },
|
|
17
|
+
{ "path": "../../typesafe/src" }
|
|
38
18
|
]
|
|
39
19
|
}
|
|
@@ -40,13 +40,13 @@ test('admin can invite a user with a membership', testTenantDb(async ({ tester }
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
`)
|
|
43
|
-
assert.equal(identity, testUuid(
|
|
43
|
+
assert.equal(identity, testUuid(5))
|
|
44
44
|
assert.deepStrictEqual(resultListMembers.data, {
|
|
45
45
|
projectBySlug: {
|
|
46
46
|
members: [
|
|
47
47
|
{
|
|
48
48
|
identity: {
|
|
49
|
-
id: testUuid(
|
|
49
|
+
id: testUuid(5),
|
|
50
50
|
},
|
|
51
51
|
memberships: [
|
|
52
52
|
{
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import migration from '
|
|
1
|
+
import migration from '../../../src/migrations/2020-06-08-134000-tenant-credentials'
|
|
2
2
|
import { createMigrationBuilder } from '@contember/database-migrations'
|
|
3
3
|
import { test, assert } from 'vitest'
|
|
4
4
|
|
|
5
|
+
let uuidNum = 0
|
|
6
|
+
export const testUuid = () => '123e4567-e89b-12d3-a456-' + (uuidNum++).toString().padStart(12, '0')
|
|
5
7
|
test('generate sql with root token and login token', async () => {
|
|
6
8
|
const builder = createMigrationBuilder()
|
|
7
9
|
await migration(builder, {
|
|
@@ -9,23 +11,26 @@ test('generate sql with root token and login token', async () => {
|
|
|
9
11
|
loginTokenHash: '936a185caaa266bb9cbe981e9e05cb78cd732b0b3280eb944412bb6f8f8f07af',
|
|
10
12
|
rootTokenHash: 'c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2',
|
|
11
13
|
}),
|
|
14
|
+
providers: {
|
|
15
|
+
uuid: testUuid,
|
|
16
|
+
},
|
|
12
17
|
})
|
|
13
18
|
assert.equal(
|
|
14
19
|
builder.getSql(),
|
|
15
20
|
`
|
|
16
21
|
WITH identity AS (
|
|
17
22
|
INSERT INTO identity(id, parent_id, roles, description, created_at)
|
|
18
|
-
VALUES (
|
|
23
|
+
VALUES ($pga$123e4567-e89b-12d3-a456-000000000000$pga$, NULL, '["login"]'::JSONB, 'Login key', now()) RETURNING id
|
|
19
24
|
)
|
|
20
25
|
INSERT INTO api_key (id, token_hash, type, identity_id, disabled_at, expires_at, expiration, created_at)
|
|
21
|
-
SELECT
|
|
26
|
+
SELECT $pga$123e4567-e89b-12d3-a456-000000000001$pga$, $pga$936a185caaa266bb9cbe981e9e05cb78cd732b0b3280eb944412bb6f8f8f07af$pga$, 'permanent', identity.id, NULL, NULL, NULL, now()
|
|
22
27
|
FROM identity
|
|
23
28
|
;
|
|
24
29
|
|
|
25
30
|
WITH identity AS (
|
|
26
31
|
INSERT INTO identity(id, parent_id, roles, description, created_at)
|
|
27
32
|
VALUES (
|
|
28
|
-
|
|
33
|
+
$pga$123e4567-e89b-12d3-a456-000000000002$pga$,
|
|
29
34
|
NULL,
|
|
30
35
|
'["super_admin"]'::JSONB
|
|
31
36
|
|| (CASE WHEN NULL IS NOT NULL THEN '["person"]'::JSONB ELSE '[]'::JSONB END),
|
|
@@ -35,14 +40,14 @@ test('generate sql with root token and login token', async () => {
|
|
|
35
40
|
),
|
|
36
41
|
person AS (
|
|
37
42
|
INSERT INTO person(id, email, password_hash, identity_id)
|
|
38
|
-
SELECT
|
|
43
|
+
SELECT $pga$123e4567-e89b-12d3-a456-000000000003$pga$, NULL, NULL, identity.id
|
|
39
44
|
FROM identity
|
|
40
45
|
WHERE NULL IS NOT NULL
|
|
41
46
|
RETURNING id
|
|
42
47
|
),
|
|
43
48
|
api_key AS (
|
|
44
49
|
INSERT INTO api_key (id, token_hash, type, identity_id, disabled_at, expires_at, expiration, created_at)
|
|
45
|
-
SELECT
|
|
50
|
+
SELECT $pga$123e4567-e89b-12d3-a456-000000000004$pga$, $pga$c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2$pga$, 'permanent', identity.id, NULL, NULL, NULL, now()
|
|
46
51
|
FROM identity WHERE $pga$c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2$pga$ IS NOT NULL
|
|
47
52
|
RETURNING id
|
|
48
53
|
)
|
|
@@ -60,6 +65,9 @@ test('generate sql with both root user and token', async () => {
|
|
|
60
65
|
rootTokenHash: 'd96f62ea0f2f543aa7822a58114f75dbcc05bdf970fb15eb55eea836a1439e43',
|
|
61
66
|
rootEmail: 'john@doe.com',
|
|
62
67
|
}),
|
|
68
|
+
providers: {
|
|
69
|
+
uuid: testUuid,
|
|
70
|
+
},
|
|
63
71
|
})
|
|
64
72
|
assert.equal(
|
|
65
73
|
builder.getSql(),
|
|
@@ -67,7 +75,7 @@ test('generate sql with both root user and token', async () => {
|
|
|
67
75
|
WITH identity AS (
|
|
68
76
|
INSERT INTO identity(id, parent_id, roles, description, created_at)
|
|
69
77
|
VALUES (
|
|
70
|
-
|
|
78
|
+
$pga$123e4567-e89b-12d3-a456-000000000005$pga$,
|
|
71
79
|
NULL,
|
|
72
80
|
'["super_admin"]'::JSONB
|
|
73
81
|
|| (CASE WHEN $pga$john@doe.com$pga$ IS NOT NULL THEN '["person"]'::JSONB ELSE '[]'::JSONB END),
|
|
@@ -77,14 +85,14 @@ test('generate sql with both root user and token', async () => {
|
|
|
77
85
|
),
|
|
78
86
|
person AS (
|
|
79
87
|
INSERT INTO person(id, email, password_hash, identity_id)
|
|
80
|
-
SELECT
|
|
88
|
+
SELECT $pga$123e4567-e89b-12d3-a456-000000000006$pga$, $pga$john@doe.com$pga$, $pga$pwd-bcrypted$pga$, identity.id
|
|
81
89
|
FROM identity
|
|
82
90
|
WHERE $pga$john@doe.com$pga$ IS NOT NULL
|
|
83
91
|
RETURNING id
|
|
84
92
|
),
|
|
85
93
|
api_key AS (
|
|
86
94
|
INSERT INTO api_key (id, token_hash, type, identity_id, disabled_at, expires_at, expiration, created_at)
|
|
87
|
-
SELECT
|
|
95
|
+
SELECT $pga$123e4567-e89b-12d3-a456-000000000007$pga$, $pga$d96f62ea0f2f543aa7822a58114f75dbcc05bdf970fb15eb55eea836a1439e43$pga$, 'permanent', identity.id, NULL, NULL, NULL, now()
|
|
88
96
|
FROM identity WHERE $pga$d96f62ea0f2f543aa7822a58114f75dbcc05bdf970fb15eb55eea836a1439e43$pga$ IS NOT NULL
|
|
89
97
|
RETURNING id
|
|
90
98
|
)
|
package/tests/src/IdPMock.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { IdentityProviderHandler, IDPClaim,
|
|
1
|
+
import { IdentityProviderHandler, IDPClaim, InitIDPAuthResult } from '../../src'
|
|
2
2
|
|
|
3
|
-
export class IdPMock implements IdentityProviderHandler<any
|
|
4
|
-
initAuth(configuration: any,
|
|
3
|
+
export class IdPMock implements IdentityProviderHandler<any> {
|
|
4
|
+
initAuth(configuration: any, data: unknown): Promise<InitIDPAuthResult> {
|
|
5
5
|
return Promise.resolve({
|
|
6
6
|
authUrl: 'http://localhost',
|
|
7
7
|
sessionData: { foo: 'bar' },
|
|
8
8
|
})
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
processResponse(configuration: any,
|
|
11
|
+
processResponse(configuration: any, responseData: any): Promise<IDPClaim> {
|
|
12
12
|
return Promise.resolve({
|
|
13
13
|
externalIdentifier: configuration.externalIdentifier,
|
|
14
14
|
email: configuration.email,
|
package/tests/tsconfig.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"2020-06-08-134000-tenant-credentials.test.d.ts","sourceRoot":"","sources":["../../../src/migrations/2020-06-08-134000-tenant-credentials.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"2020-06-08-134000-tenant-credentials.test.js","sourceRoot":"","sources":["../../../src/migrations/2020-06-08-134000-tenant-credentials.test.ts"],"names":[],"mappings":";;;;;AAAA,mHAA8D;AAC9D,wEAAuE;AACvE,mCAAqC;AAErC,IAAA,aAAI,EAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;IAC/D,MAAM,OAAO,GAAG,IAAA,4CAAsB,GAAE,CAAA;IACxC,MAAM,IAAA,+CAAS,EAAC,OAAO,EAAE;QACxB,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAC5B,cAAc,EAAE,kEAAkE;YAClF,aAAa,EAAE,kEAAkE;SACjF,CAAC;KACF,CAAC,CAAA;IACF,eAAM,CAAC,KAAK,CACX,OAAO,CAAC,MAAM,EAAE,EAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCD,CACC,CAAA;AACF,CAAC,CAAC,CAAA;AAEF,IAAA,aAAI,EAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;IAC7D,MAAM,OAAO,GAAG,IAAA,4CAAsB,GAAE,CAAA;IACxC,MAAM,IAAA,+CAAS,EAAC,OAAO,EAAE;QACxB,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAC5B,oBAAoB,EAAE,cAAc;YACpC,aAAa,EAAE,kEAAkE;YACjF,SAAS,EAAE,cAAc;SACzB,CAAC;KACF,CAAC,CAAA;IACF,eAAM,CAAC,KAAK,CACX,OAAO,CAAC,MAAM,EAAE,EAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BD,CACC,CAAA;AACF,CAAC,CAAC,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as Typesafe from '@contember/typesafe';
|
|
2
|
-
import { ResponseType } from 'openid-client';
|
|
3
|
-
import { IdentityProviderHandler, IDPClaim, IDPResponse, InitIDPAuthResult } from './IdentityProviderHandler';
|
|
4
|
-
export declare type OIDCConfiguration = ReturnType<typeof OIDCConfigurationSchema>;
|
|
5
|
-
export interface SessionData {
|
|
6
|
-
nonce: string;
|
|
7
|
-
state: string;
|
|
8
|
-
}
|
|
9
|
-
declare const OIDCConfigurationSchema: Typesafe.Type<{
|
|
10
|
-
readonly url: string;
|
|
11
|
-
readonly clientId: string;
|
|
12
|
-
readonly clientSecret: string;
|
|
13
|
-
} & {
|
|
14
|
-
readonly responseType?: ResponseType | undefined;
|
|
15
|
-
readonly claims?: string | undefined;
|
|
16
|
-
}>;
|
|
17
|
-
export declare class OIDCProvider implements IdentityProviderHandler<SessionData, OIDCConfiguration> {
|
|
18
|
-
private issuerCache;
|
|
19
|
-
initAuth(configuration: OIDCConfiguration, redirectUrl: string): Promise<InitIDPAuthResult<SessionData>>;
|
|
20
|
-
processResponse(configuration: OIDCConfiguration, redirectUrl: string, idpResponse: IDPResponse, sessionData: SessionData): Promise<IDPClaim>;
|
|
21
|
-
validateConfiguration(config: unknown): OIDCConfiguration;
|
|
22
|
-
private createOIDCClient;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=OIDCProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OIDCProvider.d.ts","sourceRoot":"","sources":["../../../../../src/model/service/idp/OIDCProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAA8C,YAAY,EAAE,MAAM,eAAe,CAAA;AAExF,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAQ7G,oBAAY,iBAAiB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE1E,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACb;AAED,QAAA,MAAM,uBAAuB;;;;;;;EAU5B,CAAA;AAED,qBAAa,YAAa,YAAW,uBAAuB,CAAC,WAAW,EAAE,iBAAiB,CAAC;IAC3F,OAAO,CAAC,WAAW,CAAqC;IAE3C,QAAQ,CACpB,aAAa,EAAE,iBAAiB,EAChC,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAgB7B,eAAe,CAC3B,aAAa,EAAE,iBAAiB,EAChC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,GACtB,OAAO,CAAC,QAAQ,CAAC;IAsBb,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,iBAAiB;YAWlD,gBAAgB;CAS9B"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.OIDCProvider = void 0;
|
|
27
|
-
const Typesafe = __importStar(require("@contember/typesafe"));
|
|
28
|
-
const openid_client_1 = require("openid-client");
|
|
29
|
-
const IDPResponseError_1 = require("./IDPResponseError");
|
|
30
|
-
const IDPValidationError_1 = require("./IDPValidationError");
|
|
31
|
-
const InvalidIDPConfigurationError_1 = require("./InvalidIDPConfigurationError");
|
|
32
|
-
openid_client_1.custom.setHttpOptionsDefaults({
|
|
33
|
-
timeout: 5000,
|
|
34
|
-
});
|
|
35
|
-
const OIDCConfigurationSchema = Typesafe.intersection(Typesafe.object({
|
|
36
|
-
url: Typesafe.string,
|
|
37
|
-
clientId: Typesafe.string,
|
|
38
|
-
clientSecret: Typesafe.string,
|
|
39
|
-
}), Typesafe.partial({
|
|
40
|
-
responseType: Typesafe.enumeration('code', 'code id_token', 'code id_token token', 'code token', 'id_token', 'id_token token', 'none'),
|
|
41
|
-
claims: Typesafe.string,
|
|
42
|
-
}));
|
|
43
|
-
class OIDCProvider {
|
|
44
|
-
constructor() {
|
|
45
|
-
this.issuerCache = {};
|
|
46
|
-
}
|
|
47
|
-
async initAuth(configuration, redirectUrl) {
|
|
48
|
-
var _a;
|
|
49
|
-
const client = await this.createOIDCClient(configuration);
|
|
50
|
-
const nonce = openid_client_1.generators.nonce();
|
|
51
|
-
const state = openid_client_1.generators.state();
|
|
52
|
-
const url = client.authorizationUrl({
|
|
53
|
-
redirect_uri: redirectUrl,
|
|
54
|
-
scope: (_a = configuration.claims) !== null && _a !== void 0 ? _a : 'openid email',
|
|
55
|
-
nonce,
|
|
56
|
-
state,
|
|
57
|
-
});
|
|
58
|
-
return {
|
|
59
|
-
authUrl: url,
|
|
60
|
-
sessionData: { nonce, state },
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
async processResponse(configuration, redirectUrl, idpResponse, sessionData) {
|
|
64
|
-
const client = await this.createOIDCClient(configuration);
|
|
65
|
-
const params = client.callbackParams(idpResponse.url);
|
|
66
|
-
try {
|
|
67
|
-
const result = await client.callback(redirectUrl, params, sessionData);
|
|
68
|
-
const claims = result.claims();
|
|
69
|
-
return {
|
|
70
|
-
externalIdentifier: claims.sub,
|
|
71
|
-
email: claims.email,
|
|
72
|
-
name: claims.name,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
catch (e) {
|
|
76
|
-
if (e instanceof openid_client_1.errors.RPError) {
|
|
77
|
-
throw new IDPValidationError_1.IDPValidationError(e.message);
|
|
78
|
-
}
|
|
79
|
-
if (e instanceof openid_client_1.errors.OPError) {
|
|
80
|
-
throw new IDPResponseError_1.IDPResponseError(e.message);
|
|
81
|
-
}
|
|
82
|
-
throw e;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
validateConfiguration(config) {
|
|
86
|
-
try {
|
|
87
|
-
return OIDCConfigurationSchema(config);
|
|
88
|
-
}
|
|
89
|
-
catch (e) {
|
|
90
|
-
if (e instanceof Typesafe.ParseError) {
|
|
91
|
-
throw new InvalidIDPConfigurationError_1.InvalidIDPConfigurationError(e.message);
|
|
92
|
-
}
|
|
93
|
-
throw e;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
async createOIDCClient(configuration) {
|
|
97
|
-
var _a;
|
|
98
|
-
var _b, _c;
|
|
99
|
-
(_a = (_b = this.issuerCache)[_c = configuration.url]) !== null && _a !== void 0 ? _a : (_b[_c] = await openid_client_1.Issuer.discover(configuration.url));
|
|
100
|
-
return new this.issuerCache[configuration.url].Client({
|
|
101
|
-
client_id: configuration.clientId,
|
|
102
|
-
client_secret: configuration.clientSecret,
|
|
103
|
-
response_types: [configuration.responseType || 'code'],
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.OIDCProvider = OIDCProvider;
|
|
108
|
-
//# sourceMappingURL=OIDCProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OIDCProvider.js","sourceRoot":"","sources":["../../../../../src/model/service/idp/OIDCProvider.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
CREATE UNIQUE INDEX api_key_token_hash ON api_key(token_hash)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
CREATE INDEX project_alias ON project USING gin ((config -> 'alias'));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ALTER TABLE person ALTER COLUMN password_hash DROP NOT NULL;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import * as Typesafe from '@contember/typesafe'
|
|
2
|
-
import { Client, custom, errors, generators, Issuer, ResponseType } from 'openid-client'
|
|
3
|
-
import { IDPResponseError } from './IDPResponseError'
|
|
4
|
-
import { IdentityProviderHandler, IDPClaim, IDPResponse, InitIDPAuthResult } from './IdentityProviderHandler'
|
|
5
|
-
import { IDPValidationError } from './IDPValidationError'
|
|
6
|
-
import { InvalidIDPConfigurationError } from './InvalidIDPConfigurationError'
|
|
7
|
-
|
|
8
|
-
custom.setHttpOptionsDefaults({
|
|
9
|
-
timeout: 5000,
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
export type OIDCConfiguration = ReturnType<typeof OIDCConfigurationSchema>
|
|
13
|
-
|
|
14
|
-
export interface SessionData {
|
|
15
|
-
nonce: string
|
|
16
|
-
state: string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const OIDCConfigurationSchema = Typesafe.intersection(
|
|
20
|
-
Typesafe.object({
|
|
21
|
-
url: Typesafe.string,
|
|
22
|
-
clientId: Typesafe.string,
|
|
23
|
-
clientSecret: Typesafe.string,
|
|
24
|
-
}),
|
|
25
|
-
Typesafe.partial({
|
|
26
|
-
responseType: Typesafe.enumeration<ResponseType>('code', 'code id_token', 'code id_token token', 'code token', 'id_token', 'id_token token', 'none'),
|
|
27
|
-
claims: Typesafe.string,
|
|
28
|
-
}),
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
export class OIDCProvider implements IdentityProviderHandler<SessionData, OIDCConfiguration> {
|
|
32
|
-
private issuerCache: Record<string, Issuer<Client>> = {}
|
|
33
|
-
|
|
34
|
-
public async initAuth(
|
|
35
|
-
configuration: OIDCConfiguration,
|
|
36
|
-
redirectUrl: string,
|
|
37
|
-
): Promise<InitIDPAuthResult<SessionData>> {
|
|
38
|
-
const client = await this.createOIDCClient(configuration)
|
|
39
|
-
const nonce = generators.nonce()
|
|
40
|
-
const state = generators.state()
|
|
41
|
-
const url = client.authorizationUrl({
|
|
42
|
-
redirect_uri: redirectUrl,
|
|
43
|
-
scope: configuration.claims ?? 'openid email',
|
|
44
|
-
nonce,
|
|
45
|
-
state,
|
|
46
|
-
})
|
|
47
|
-
return {
|
|
48
|
-
authUrl: url,
|
|
49
|
-
sessionData: { nonce, state },
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public async processResponse(
|
|
54
|
-
configuration: OIDCConfiguration,
|
|
55
|
-
redirectUrl: string,
|
|
56
|
-
idpResponse: IDPResponse,
|
|
57
|
-
sessionData: SessionData,
|
|
58
|
-
): Promise<IDPClaim> {
|
|
59
|
-
const client = await this.createOIDCClient(configuration)
|
|
60
|
-
const params = client.callbackParams(idpResponse.url)
|
|
61
|
-
try {
|
|
62
|
-
const result = await client.callback(redirectUrl, params, sessionData)
|
|
63
|
-
const claims = result.claims()
|
|
64
|
-
return {
|
|
65
|
-
externalIdentifier: claims.sub,
|
|
66
|
-
email: claims.email,
|
|
67
|
-
name: claims.name,
|
|
68
|
-
}
|
|
69
|
-
} catch (e) {
|
|
70
|
-
if (e instanceof errors.RPError) {
|
|
71
|
-
throw new IDPValidationError(e.message)
|
|
72
|
-
}
|
|
73
|
-
if (e instanceof errors.OPError) {
|
|
74
|
-
throw new IDPResponseError(e.message)
|
|
75
|
-
}
|
|
76
|
-
throw e
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public validateConfiguration(config: unknown): OIDCConfiguration {
|
|
81
|
-
try {
|
|
82
|
-
return OIDCConfigurationSchema(config)
|
|
83
|
-
} catch (e) {
|
|
84
|
-
if (e instanceof Typesafe.ParseError) {
|
|
85
|
-
throw new InvalidIDPConfigurationError(e.message)
|
|
86
|
-
}
|
|
87
|
-
throw e
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
private async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {
|
|
92
|
-
this.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)
|
|
93
|
-
|
|
94
|
-
return new this.issuerCache[configuration.url].Client({
|
|
95
|
-
client_id: configuration.clientId,
|
|
96
|
-
client_secret: configuration.clientSecret,
|
|
97
|
-
response_types: [configuration.responseType || 'code'],
|
|
98
|
-
})
|
|
99
|
-
}
|
|
100
|
-
}
|