@boxyhq/saml-jackson 1.32.0 → 1.33.1-beta.1
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/controller/api.js +17 -7
- package/dist/controller/api.js.map +1 -1
- package/dist/controller/connection/oidc.js +17 -7
- package/dist/controller/connection/oidc.js.map +1 -1
- package/dist/controller/connection/saml.js +17 -7
- package/dist/controller/connection/saml.js.map +1 -1
- package/dist/controller/logout.js +17 -7
- package/dist/controller/logout.js.map +1 -1
- package/dist/controller/oauth/oidc-client.d.ts +9 -4
- package/dist/controller/oauth/oidc-client.js +80 -11
- package/dist/controller/oauth/oidc-client.js.map +1 -1
- package/dist/controller/oauth/oidc-issuer.d.ts +2 -0
- package/dist/controller/oauth/oidc-issuer.js +25 -0
- package/dist/controller/oauth/oidc-issuer.js.map +1 -0
- package/dist/controller/oauth.js +97 -46
- package/dist/controller/oauth.js.map +1 -1
- package/dist/controller/setup-link.js +17 -7
- package/dist/controller/setup-link.js.map +1 -1
- package/dist/controller/sso-handler.d.ts +10 -2
- package/dist/controller/sso-handler.js +34 -12
- package/dist/controller/sso-handler.js.map +1 -1
- package/dist/controller/utils.d.ts +5 -3
- package/dist/controller/utils.js +27 -9
- package/dist/controller/utils.js.map +1 -1
- package/dist/db/db.js +17 -7
- package/dist/db/db.js.map +1 -1
- package/dist/db/dynamoDb.js +17 -7
- package/dist/db/dynamoDb.js.map +1 -1
- package/dist/db/mem.js +17 -7
- package/dist/db/mem.js.map +1 -1
- package/dist/db/mongo.js +17 -7
- package/dist/db/mongo.js.map +1 -1
- package/dist/db/redis.js +17 -7
- package/dist/db/redis.js.map +1 -1
- package/dist/db/sql/sql.js +17 -7
- package/dist/db/sql/sql.js.map +1 -1
- package/dist/db/store.js +17 -7
- package/dist/db/store.js.map +1 -1
- package/dist/directory-sync/batch-events/queue.js +17 -7
- package/dist/directory-sync/batch-events/queue.js.map +1 -1
- package/dist/directory-sync/scim/DirectoryConfig.js +17 -7
- package/dist/directory-sync/scim/DirectoryConfig.js.map +1 -1
- package/dist/directory-sync/scim/Groups.js +17 -7
- package/dist/directory-sync/scim/Groups.js.map +1 -1
- package/dist/ee/identity-federation/idp-login.js +20 -14
- package/dist/ee/identity-federation/idp-login.js.map +1 -1
- package/dist/ee/identity-federation/sso.js +16 -11
- package/dist/ee/identity-federation/sso.js.map +1 -1
- package/dist/event/axios.d.ts +2 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/loadConnection.js +17 -7
- package/dist/loadConnection.js.map +1 -1
- package/dist/saml/lib.js +17 -7
- package/dist/saml/lib.js.map +1 -1
- package/dist/saml/x509.js +17 -7
- package/dist/saml/x509.js.map +1 -1
- package/dist/src/controller/admin.d.ts +27 -0
- package/dist/src/controller/admin.js +60 -0
- package/dist/src/controller/admin.js.map +1 -0
- package/dist/src/controller/analytics.d.ts +16 -0
- package/dist/src/controller/analytics.js +79 -0
- package/dist/src/controller/analytics.js.map +1 -0
- package/dist/src/controller/api.d.ts +557 -0
- package/dist/src/controller/api.js +806 -0
- package/dist/src/controller/api.js.map +1 -0
- package/dist/src/controller/connection/oidc.d.ts +7 -0
- package/dist/src/controller/connection/oidc.js +181 -0
- package/dist/src/controller/connection/oidc.js.map +1 -0
- package/dist/src/controller/connection/saml.d.ts +7 -0
- package/dist/src/controller/connection/saml.js +250 -0
- package/dist/src/controller/connection/saml.js.map +1 -0
- package/dist/src/controller/error.d.ts +10 -0
- package/dist/src/controller/error.js +13 -0
- package/dist/src/controller/error.js.map +1 -0
- package/dist/src/controller/health-check.d.ts +11 -0
- package/dist/src/controller/health-check.js +51 -0
- package/dist/src/controller/health-check.js.map +1 -0
- package/dist/src/controller/logout.d.ts +18 -0
- package/dist/src/controller/logout.js +132 -0
- package/dist/src/controller/logout.js.map +1 -0
- package/dist/src/controller/oauth/allowed.d.ts +1 -0
- package/dist/src/controller/oauth/allowed.js +30 -0
- package/dist/src/controller/oauth/allowed.js.map +1 -0
- package/dist/src/controller/oauth/code-verifier.d.ts +1 -0
- package/dist/src/controller/oauth/code-verifier.js +8 -0
- package/dist/src/controller/oauth/code-verifier.js.map +1 -0
- package/dist/src/controller/oauth/oidc-client.d.ts +12 -0
- package/dist/src/controller/oauth/oidc-client.js +89 -0
- package/dist/src/controller/oauth/oidc-client.js.map +1 -0
- package/dist/src/controller/oauth/redirect.d.ts +1 -0
- package/dist/src/controller/oauth/redirect.js +13 -0
- package/dist/src/controller/oauth/redirect.js.map +1 -0
- package/dist/src/controller/oauth.d.ts +142 -0
- package/dist/src/controller/oauth.js +1112 -0
- package/dist/src/controller/oauth.js.map +1 -0
- package/dist/src/controller/oidc-discovery.d.ts +22 -0
- package/dist/src/controller/oidc-discovery.js +47 -0
- package/dist/src/controller/oidc-discovery.js.map +1 -0
- package/dist/src/controller/setup-link.d.ts +307 -0
- package/dist/src/controller/setup-link.js +462 -0
- package/dist/src/controller/setup-link.js.map +1 -0
- package/dist/src/controller/sp-config.d.ts +22 -0
- package/dist/src/controller/sp-config.js +89 -0
- package/dist/src/controller/sp-config.js.map +1 -0
- package/dist/src/controller/sso-handler.d.ts +66 -0
- package/dist/src/controller/sso-handler.js +306 -0
- package/dist/src/controller/sso-handler.js.map +1 -0
- package/dist/src/controller/utils.d.ts +84 -0
- package/dist/src/controller/utils.js +328 -0
- package/dist/src/controller/utils.js.map +1 -0
- package/dist/src/cron/lock.d.ts +18 -0
- package/dist/src/cron/lock.js +98 -0
- package/dist/src/cron/lock.js.map +1 -0
- package/dist/src/db/db.d.ts +5 -0
- package/dist/src/db/db.js +178 -0
- package/dist/src/db/db.js.map +1 -0
- package/dist/src/db/defaultDb.d.ts +2 -0
- package/dist/src/db/defaultDb.js +18 -0
- package/dist/src/db/defaultDb.js.map +1 -0
- package/dist/src/db/dynamoDb.d.ts +19 -0
- package/dist/src/db/dynamoDb.js +320 -0
- package/dist/src/db/dynamoDb.js.map +1 -0
- package/dist/src/db/encrypter.d.ts +3 -0
- package/dist/src/db/encrypter.js +22 -0
- package/dist/src/db/encrypter.js.map +1 -0
- package/dist/src/db/mem.d.ts +23 -0
- package/dist/src/db/mem.js +186 -0
- package/dist/src/db/mem.js.map +1 -0
- package/dist/src/db/mongo.d.ts +22 -0
- package/dist/src/db/mongo.js +177 -0
- package/dist/src/db/mongo.js.map +1 -0
- package/dist/src/db/planetscale/entity/JacksonIndex.d.ts +5 -0
- package/dist/src/db/planetscale/entity/JacksonIndex.js +32 -0
- package/dist/src/db/planetscale/entity/JacksonIndex.js.map +1 -0
- package/dist/src/db/planetscale/entity/JacksonStore.d.ts +9 -0
- package/dist/src/db/planetscale/entity/JacksonStore.js +63 -0
- package/dist/src/db/planetscale/entity/JacksonStore.js.map +1 -0
- package/dist/src/db/planetscale/entity/JacksonTTL.d.ts +4 -0
- package/dist/src/db/planetscale/entity/JacksonTTL.js +27 -0
- package/dist/src/db/planetscale/entity/JacksonTTL.js.map +1 -0
- package/dist/src/db/redis.d.ts +18 -0
- package/dist/src/db/redis.js +214 -0
- package/dist/src/db/redis.js.map +1 -0
- package/dist/src/db/sql/entity/JacksonIndex.d.ts +7 -0
- package/dist/src/db/sql/entity/JacksonIndex.js +39 -0
- package/dist/src/db/sql/entity/JacksonIndex.js.map +1 -0
- package/dist/src/db/sql/entity/JacksonStore.d.ts +9 -0
- package/dist/src/db/sql/entity/JacksonStore.js +61 -0
- package/dist/src/db/sql/entity/JacksonStore.js.map +1 -0
- package/dist/src/db/sql/entity/JacksonTTL.d.ts +4 -0
- package/dist/src/db/sql/entity/JacksonTTL.js +27 -0
- package/dist/src/db/sql/entity/JacksonTTL.js.map +1 -0
- package/dist/src/db/sql/mariadb/entity/JacksonIndex.d.ts +7 -0
- package/dist/src/db/sql/mariadb/entity/JacksonIndex.js +39 -0
- package/dist/src/db/sql/mariadb/entity/JacksonIndex.js.map +1 -0
- package/dist/src/db/sql/mariadb/entity/JacksonStore.d.ts +9 -0
- package/dist/src/db/sql/mariadb/entity/JacksonStore.js +63 -0
- package/dist/src/db/sql/mariadb/entity/JacksonStore.js.map +1 -0
- package/dist/src/db/sql/mariadb/entity/JacksonTTL.d.ts +4 -0
- package/dist/src/db/sql/mariadb/entity/JacksonTTL.js +27 -0
- package/dist/src/db/sql/mariadb/entity/JacksonTTL.js.map +1 -0
- package/dist/src/db/sql/mssql/entity/JacksonIndex.d.ts +7 -0
- package/dist/src/db/sql/mssql/entity/JacksonIndex.js +39 -0
- package/dist/src/db/sql/mssql/entity/JacksonIndex.js.map +1 -0
- package/dist/src/db/sql/mssql/entity/JacksonStore.d.ts +9 -0
- package/dist/src/db/sql/mssql/entity/JacksonStore.js +61 -0
- package/dist/src/db/sql/mssql/entity/JacksonStore.js.map +1 -0
- package/dist/src/db/sql/mssql/entity/JacksonTTL.d.ts +4 -0
- package/dist/src/db/sql/mssql/entity/JacksonTTL.js +27 -0
- package/dist/src/db/sql/mssql/entity/JacksonTTL.js.map +1 -0
- package/dist/src/db/sql/mssql.d.ts +1 -0
- package/dist/src/db/sql/mssql.js +44 -0
- package/dist/src/db/sql/mssql.js.map +1 -0
- package/dist/src/db/sql/sql.d.ts +32 -0
- package/dist/src/db/sql/sql.js +318 -0
- package/dist/src/db/sql/sql.js.map +1 -0
- package/dist/src/db/sql/sqlite/entity/JacksonIndex.d.ts +7 -0
- package/dist/src/db/sql/sqlite/entity/JacksonIndex.js +39 -0
- package/dist/src/db/sql/sqlite/entity/JacksonIndex.js.map +1 -0
- package/dist/src/db/sql/sqlite/entity/JacksonStore.d.ts +9 -0
- package/dist/src/db/sql/sqlite/entity/JacksonStore.js +61 -0
- package/dist/src/db/sql/sqlite/entity/JacksonStore.js.map +1 -0
- package/dist/src/db/sql/sqlite/entity/JacksonTTL.d.ts +4 -0
- package/dist/src/db/sql/sqlite/entity/JacksonTTL.js +27 -0
- package/dist/src/db/sql/sqlite/entity/JacksonTTL.js.map +1 -0
- package/dist/src/db/store.d.ts +5 -0
- package/dist/src/db/store.js +65 -0
- package/dist/src/db/store.js.map +1 -0
- package/dist/src/db/utils.d.ts +16 -0
- package/dist/src/db/utils.js +28 -0
- package/dist/src/db/utils.js.map +1 -0
- package/dist/src/directory-sync/batch-events/queue.d.ts +40 -0
- package/dist/src/directory-sync/batch-events/queue.js +225 -0
- package/dist/src/directory-sync/batch-events/queue.js.map +1 -0
- package/dist/src/directory-sync/index.d.ts +27 -0
- package/dist/src/directory-sync/index.js +97 -0
- package/dist/src/directory-sync/index.js.map +1 -0
- package/dist/src/directory-sync/non-scim/google/api.d.ts +36 -0
- package/dist/src/directory-sync/non-scim/google/api.js +143 -0
- package/dist/src/directory-sync/non-scim/google/api.js.map +1 -0
- package/dist/src/directory-sync/non-scim/google/index.d.ts +12 -0
- package/dist/src/directory-sync/non-scim/google/index.js +10 -0
- package/dist/src/directory-sync/non-scim/google/index.js.map +1 -0
- package/dist/src/directory-sync/non-scim/google/oauth.d.ts +27 -0
- package/dist/src/directory-sync/non-scim/google/oauth.js +105 -0
- package/dist/src/directory-sync/non-scim/google/oauth.js.map +1 -0
- package/dist/src/directory-sync/non-scim/index.d.ts +24 -0
- package/dist/src/directory-sync/non-scim/index.js +85 -0
- package/dist/src/directory-sync/non-scim/index.js.map +1 -0
- package/dist/src/directory-sync/non-scim/syncGroupMembers.d.ts +23 -0
- package/dist/src/directory-sync/non-scim/syncGroupMembers.js +105 -0
- package/dist/src/directory-sync/non-scim/syncGroupMembers.js.map +1 -0
- package/dist/src/directory-sync/non-scim/syncGroups.d.ts +24 -0
- package/dist/src/directory-sync/non-scim/syncGroups.js +120 -0
- package/dist/src/directory-sync/non-scim/syncGroups.js.map +1 -0
- package/dist/src/directory-sync/non-scim/syncUsers.d.ts +24 -0
- package/dist/src/directory-sync/non-scim/syncUsers.js +120 -0
- package/dist/src/directory-sync/non-scim/syncUsers.js.map +1 -0
- package/dist/src/directory-sync/non-scim/utils.d.ts +36 -0
- package/dist/src/directory-sync/non-scim/utils.js +109 -0
- package/dist/src/directory-sync/non-scim/utils.js.map +1 -0
- package/dist/src/directory-sync/request.d.ts +14 -0
- package/dist/src/directory-sync/request.js +29 -0
- package/dist/src/directory-sync/request.js.map +1 -0
- package/dist/src/directory-sync/scim/Base.d.ts +12 -0
- package/dist/src/directory-sync/scim/Base.js +23 -0
- package/dist/src/directory-sync/scim/Base.js.map +1 -0
- package/dist/src/directory-sync/scim/DirectoryConfig.d.ts +343 -0
- package/dist/src/directory-sync/scim/DirectoryConfig.js +580 -0
- package/dist/src/directory-sync/scim/DirectoryConfig.js.map +1 -0
- package/dist/src/directory-sync/scim/DirectoryGroups.d.ts +28 -0
- package/dist/src/directory-sync/scim/DirectoryGroups.js +252 -0
- package/dist/src/directory-sync/scim/DirectoryGroups.js.map +1 -0
- package/dist/src/directory-sync/scim/DirectoryUsers.d.ts +25 -0
- package/dist/src/directory-sync/scim/DirectoryUsers.js +193 -0
- package/dist/src/directory-sync/scim/DirectoryUsers.js.map +1 -0
- package/dist/src/directory-sync/scim/Groups.d.ts +166 -0
- package/dist/src/directory-sync/scim/Groups.js +348 -0
- package/dist/src/directory-sync/scim/Groups.js.map +1 -0
- package/dist/src/directory-sync/scim/Users.d.ts +99 -0
- package/dist/src/directory-sync/scim/Users.js +215 -0
- package/dist/src/directory-sync/scim/Users.js.map +1 -0
- package/dist/src/directory-sync/scim/WebhookEventsLogger.d.ts +101 -0
- package/dist/src/directory-sync/scim/WebhookEventsLogger.js +165 -0
- package/dist/src/directory-sync/scim/WebhookEventsLogger.js.map +1 -0
- package/dist/src/directory-sync/scim/transform.d.ts +6 -0
- package/dist/src/directory-sync/scim/transform.js +37 -0
- package/dist/src/directory-sync/scim/transform.js.map +1 -0
- package/dist/src/directory-sync/scim/utils.d.ts +33 -0
- package/dist/src/directory-sync/scim/utils.js +129 -0
- package/dist/src/directory-sync/scim/utils.js.map +1 -0
- package/dist/src/directory-sync/types.d.ts +195 -0
- package/dist/src/directory-sync/types.js +10 -0
- package/dist/src/directory-sync/types.js.map +1 -0
- package/dist/src/directory-sync/utils.d.ts +19 -0
- package/dist/src/directory-sync/utils.js +56 -0
- package/dist/src/directory-sync/utils.js.map +1 -0
- package/dist/src/ee/branding/index.d.ts +17 -0
- package/dist/src/ee/branding/index.js +49 -0
- package/dist/src/ee/branding/index.js.map +1 -0
- package/dist/src/ee/common/checkLicense.d.ts +3 -0
- package/dist/src/ee/common/checkLicense.js +23 -0
- package/dist/src/ee/common/checkLicense.js.map +1 -0
- package/dist/src/ee/identity-federation/app.d.ts +328 -0
- package/dist/src/ee/identity-federation/app.js +532 -0
- package/dist/src/ee/identity-federation/app.js.map +1 -0
- package/dist/src/ee/identity-federation/idp-login.d.ts +18 -0
- package/dist/src/ee/identity-federation/idp-login.js +98 -0
- package/dist/src/ee/identity-federation/idp-login.js.map +1 -0
- package/dist/src/ee/identity-federation/index.d.ts +15 -0
- package/dist/src/ee/identity-federation/index.js +43 -0
- package/dist/src/ee/identity-federation/index.js.map +1 -0
- package/dist/src/ee/identity-federation/sso.d.ts +24 -0
- package/dist/src/ee/identity-federation/sso.js +124 -0
- package/dist/src/ee/identity-federation/sso.js.map +1 -0
- package/dist/src/ee/identity-federation/types.d.ts +38 -0
- package/dist/src/ee/identity-federation/types.js +2 -0
- package/dist/src/ee/identity-federation/types.js.map +1 -0
- package/dist/src/ee/ory/ory.d.ts +18 -0
- package/dist/src/ee/ory/ory.js +195 -0
- package/dist/src/ee/ory/ory.js.map +1 -0
- package/dist/src/ee/product/index.d.ts +14 -0
- package/dist/src/ee/product/index.js +45 -0
- package/dist/src/ee/product/index.js.map +1 -0
- package/dist/src/event/axios.d.ts +2 -0
- package/dist/src/event/axios.js +27 -0
- package/dist/src/event/axios.js.map +1 -0
- package/dist/src/event/index.d.ts +11 -0
- package/dist/src/event/index.js +53 -0
- package/dist/src/event/index.js.map +1 -0
- package/dist/src/event/types.d.ts +21 -0
- package/dist/src/event/types.js +2 -0
- package/dist/src/event/types.js.map +1 -0
- package/dist/src/event/utils.d.ts +4 -0
- package/dist/src/event/utils.js +33 -0
- package/dist/src/event/utils.js.map +1 -0
- package/dist/src/event/webhook.d.ts +3 -0
- package/dist/src/event/webhook.js +34 -0
- package/dist/src/event/webhook.js.map +1 -0
- package/dist/src/index.d.ts +35 -0
- package/dist/src/index.js +161 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/loadConnection.d.ts +4 -0
- package/dist/src/loadConnection.js +38 -0
- package/dist/src/loadConnection.js.map +1 -0
- package/dist/src/opentelemetry/metrics.d.ts +14 -0
- package/dist/src/opentelemetry/metrics.js +64 -0
- package/dist/src/opentelemetry/metrics.js.map +1 -0
- package/dist/src/saml/claims.d.ts +12 -0
- package/dist/src/saml/claims.js +57 -0
- package/dist/src/saml/claims.js.map +1 -0
- package/dist/src/saml/lib.d.ts +8 -0
- package/dist/src/saml/lib.js +29 -0
- package/dist/src/saml/lib.js.map +1 -0
- package/dist/src/saml/x509.d.ts +9 -0
- package/dist/src/saml/x509.js +93 -0
- package/dist/src/saml/x509.js.map +1 -0
- package/dist/src/sso-traces/index.d.ts +114 -0
- package/dist/src/sso-traces/index.js +229 -0
- package/dist/src/sso-traces/index.js.map +1 -0
- package/dist/src/sso-traces/types.d.ts +44 -0
- package/dist/src/sso-traces/types.js +2 -0
- package/dist/src/sso-traces/types.js.map +1 -0
- package/dist/src/typings.d.ts +540 -0
- package/dist/src/typings.js +5 -0
- package/dist/src/typings.js.map +1 -0
- package/dist/typeorm.d.ts +3 -0
- package/dist/typeorm.js +58 -0
- package/dist/typeorm.js.map +1 -0
- package/dist/typings.d.ts +1 -1
- package/package.json +13 -13
@@ -0,0 +1,93 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
10
|
+
import * as forge from 'node-forge';
|
11
|
+
import crypto from 'crypto';
|
12
|
+
const pki = forge.pki;
|
13
|
+
let certificateStore;
|
14
|
+
let cachedCertificate;
|
15
|
+
let jacksonOption;
|
16
|
+
export const init = (store, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
+
certificateStore = store;
|
18
|
+
jacksonOption = opts;
|
19
|
+
return yield getDefaultCertificate();
|
20
|
+
});
|
21
|
+
const generateCertificate = () => {
|
22
|
+
const today = new Date();
|
23
|
+
const keys = pki.rsa.generateKeyPair(2048);
|
24
|
+
const cert = pki.createCertificate();
|
25
|
+
cert.publicKey = keys.publicKey;
|
26
|
+
cert.serialNumber = '01';
|
27
|
+
cert.validity.notBefore = new Date();
|
28
|
+
cert.validity.notAfter = new Date(today.setFullYear(today.getFullYear() + 30));
|
29
|
+
const attrs = [
|
30
|
+
{
|
31
|
+
name: 'commonName',
|
32
|
+
value: 'BoxyHQ Jackson',
|
33
|
+
},
|
34
|
+
];
|
35
|
+
cert.setSubject(attrs);
|
36
|
+
cert.setIssuer(attrs);
|
37
|
+
cert.setExtensions([
|
38
|
+
{
|
39
|
+
name: 'basicConstraints',
|
40
|
+
cA: false,
|
41
|
+
},
|
42
|
+
{
|
43
|
+
name: 'keyUsage',
|
44
|
+
keyCertSign: false,
|
45
|
+
digitalSignature: true,
|
46
|
+
nonRepudiation: false,
|
47
|
+
keyEncipherment: false,
|
48
|
+
dataEncipherment: false,
|
49
|
+
},
|
50
|
+
]);
|
51
|
+
// self-sign certificate
|
52
|
+
cert.sign(keys.privateKey, forge.md.sha256.create());
|
53
|
+
return {
|
54
|
+
publicKey: pki.certificateToPem(cert),
|
55
|
+
privateKey: pki.privateKeyToPem(keys.privateKey),
|
56
|
+
};
|
57
|
+
};
|
58
|
+
export const getDefaultCertificate = () => __awaiter(void 0, void 0, void 0, function* () {
|
59
|
+
var _a, _b;
|
60
|
+
if (cachedCertificate && !(yield isCertificateExpired(cachedCertificate.publicKey))) {
|
61
|
+
return cachedCertificate;
|
62
|
+
}
|
63
|
+
if (!certificateStore) {
|
64
|
+
throw new Error('Certificate store not initialized');
|
65
|
+
}
|
66
|
+
if (!jacksonOption) {
|
67
|
+
throw new Error('Jackson option not initialized');
|
68
|
+
}
|
69
|
+
// If the user has provided a certificate, use that instead of the default.
|
70
|
+
// We expect the developer to provide base64 encoded keys, so we need to decode them.
|
71
|
+
if (((_a = jacksonOption.certs) === null || _a === void 0 ? void 0 : _a.privateKey) && ((_b = jacksonOption.certs) === null || _b === void 0 ? void 0 : _b.publicKey)) {
|
72
|
+
cachedCertificate = {
|
73
|
+
publicKey: Buffer.from(jacksonOption.certs.publicKey, 'base64').toString('utf-8'),
|
74
|
+
privateKey: Buffer.from(jacksonOption.certs.privateKey, 'base64').toString('utf-8'),
|
75
|
+
};
|
76
|
+
return cachedCertificate;
|
77
|
+
}
|
78
|
+
// Otherwise, use the default certificate.
|
79
|
+
cachedCertificate = yield certificateStore.get('default');
|
80
|
+
// If certificate is expired let it drop through so it creates a new cert
|
81
|
+
if (cachedCertificate && !(yield isCertificateExpired(cachedCertificate.publicKey))) {
|
82
|
+
return cachedCertificate;
|
83
|
+
}
|
84
|
+
// If default certificate is not found or has expired, create one and store it.
|
85
|
+
cachedCertificate = generateCertificate();
|
86
|
+
yield certificateStore.put('default', cachedCertificate);
|
87
|
+
return cachedCertificate;
|
88
|
+
});
|
89
|
+
const isCertificateExpired = (publicKey) => __awaiter(void 0, void 0, void 0, function* () {
|
90
|
+
const { validTo } = new crypto.X509Certificate(publicKey);
|
91
|
+
return !(validTo != 'Bad time value' && new Date(validTo) > new Date());
|
92
|
+
});
|
93
|
+
//# sourceMappingURL=x509.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"x509.js","sourceRoot":"","sources":["../../../src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K,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;SACpF,CAAC;QAEF,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,0CAA0C;IAC1C,iBAAiB,GAAG,MAAM,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAE1D,yEAAyE;IACzE,IAAI,iBAAiB,IAAI,CAAC,CAAC,MAAM,oBAAoB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QACpF,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,+EAA+E;IAC/E,iBAAiB,GAAG,mBAAmB,EAAE,CAAC;IAE1C,MAAM,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAEzD,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAA,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAO,SAAiB,EAAE,EAAE;IACvD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAE1D,OAAO,CAAC,CAAC,OAAO,IAAI,gBAAgB,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAA,CAAC"}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
import { GetByProductParams, Records, Storable } from '../typings';
|
2
|
+
import type { SSOTrace, Trace } from './types';
|
3
|
+
/**
|
4
|
+
* @swagger
|
5
|
+
* definitions:
|
6
|
+
* SSOTrace:
|
7
|
+
* type: object
|
8
|
+
* properties:
|
9
|
+
* traceId:
|
10
|
+
* type: string
|
11
|
+
* description: Trace ID
|
12
|
+
* error:
|
13
|
+
* type: string
|
14
|
+
* description: Error
|
15
|
+
* timestamp:
|
16
|
+
* type: string
|
17
|
+
* description: Timestamp
|
18
|
+
* context:
|
19
|
+
* type: object
|
20
|
+
* properties:
|
21
|
+
* tenant:
|
22
|
+
* type: string
|
23
|
+
* description: Tenant
|
24
|
+
* product:
|
25
|
+
* type: string
|
26
|
+
* description: Product
|
27
|
+
* clientID:
|
28
|
+
* type: string
|
29
|
+
* description: Connection client ID
|
30
|
+
* issuer:
|
31
|
+
* type: string
|
32
|
+
* description: Issuer
|
33
|
+
* relayState:
|
34
|
+
* type: string
|
35
|
+
* description: Relay state
|
36
|
+
* samlResponse:
|
37
|
+
* type: string
|
38
|
+
* description: SAML response
|
39
|
+
* isSAMLFederated:
|
40
|
+
* type: boolean
|
41
|
+
* description: Indicates if SAML is federated
|
42
|
+
* isOIDCFederated:
|
43
|
+
* type: boolean
|
44
|
+
* description: Indicates if OIDC is federated
|
45
|
+
* isIdPFlow:
|
46
|
+
* type: boolean
|
47
|
+
* description: Indicates if request is from IdP
|
48
|
+
*/
|
49
|
+
declare class SSOTraces {
|
50
|
+
tracesStore: Storable;
|
51
|
+
constructor({ tracesStore }: {
|
52
|
+
tracesStore: any;
|
53
|
+
});
|
54
|
+
saveTrace(payload: SSOTrace): Promise<string | undefined>;
|
55
|
+
/**
|
56
|
+
* @swagger
|
57
|
+
* /api/v1/sso-traces:
|
58
|
+
* get:
|
59
|
+
* summary: Get trace by ID
|
60
|
+
* parameters:
|
61
|
+
* - name: id
|
62
|
+
* description: Trace ID
|
63
|
+
* in: query
|
64
|
+
* required: true
|
65
|
+
* type: string
|
66
|
+
* tags:
|
67
|
+
* - SSO Traces
|
68
|
+
* produces:
|
69
|
+
* - application/json
|
70
|
+
* responses:
|
71
|
+
* '200':
|
72
|
+
* description: Success
|
73
|
+
* schema:
|
74
|
+
* $ref: '#/definitions/SSOTrace'
|
75
|
+
*/
|
76
|
+
getByTraceId(traceId: string): Promise<Trace>;
|
77
|
+
getAllTraces(pageOffset?: number, pageLimit?: number, pageToken?: string): Promise<Records<Trace>>;
|
78
|
+
/** Cleans up stale traces older than 1 week */
|
79
|
+
cleanUpStaleTraces(): Promise<void>;
|
80
|
+
/**
|
81
|
+
* @swagger
|
82
|
+
* /api/v1/sso-traces/product:
|
83
|
+
* get:
|
84
|
+
* summary: Get all traces for a product
|
85
|
+
* parameters:
|
86
|
+
* - $ref: '#/parameters/product'
|
87
|
+
* - $ref: '#/parameters/pageOffset'
|
88
|
+
* - $ref: '#/parameters/pageLimit'
|
89
|
+
* - $ref: '#/parameters/pageToken'
|
90
|
+
* tags:
|
91
|
+
* - SSO Traces
|
92
|
+
* produces:
|
93
|
+
* - application/json
|
94
|
+
* responses:
|
95
|
+
* '200':
|
96
|
+
* description: Success
|
97
|
+
* content:
|
98
|
+
* application/json:
|
99
|
+
* schema:
|
100
|
+
* type: object
|
101
|
+
* properties:
|
102
|
+
* data:
|
103
|
+
* type: array
|
104
|
+
* items:
|
105
|
+
* $ref: '#/definitions/SSOTrace'
|
106
|
+
* pageToken:
|
107
|
+
* type: string
|
108
|
+
* description: token for pagination
|
109
|
+
*/
|
110
|
+
getTracesByProduct(params: GetByProductParams): Promise<Records<any>>;
|
111
|
+
deleteTracesByProduct(product: string): Promise<void>;
|
112
|
+
countByProduct(product: string): Promise<number | undefined>;
|
113
|
+
}
|
114
|
+
export default SSOTraces;
|
@@ -0,0 +1,229 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
10
|
+
import { generateMnemonic } from '@boxyhq/error-code-mnemonic';
|
11
|
+
import { IndexNames } from '../controller/utils';
|
12
|
+
import { keyFromParts } from '../db/utils';
|
13
|
+
import { JacksonError } from '../controller/error';
|
14
|
+
const INTERVAL_1_WEEK_MS = 7 * 24 * 60 * 60 * 1000;
|
15
|
+
const INTERVAL_1_DAY_MS = 24 * 60 * 60 * 1000;
|
16
|
+
/**
|
17
|
+
* @swagger
|
18
|
+
* definitions:
|
19
|
+
* SSOTrace:
|
20
|
+
* type: object
|
21
|
+
* properties:
|
22
|
+
* traceId:
|
23
|
+
* type: string
|
24
|
+
* description: Trace ID
|
25
|
+
* error:
|
26
|
+
* type: string
|
27
|
+
* description: Error
|
28
|
+
* timestamp:
|
29
|
+
* type: string
|
30
|
+
* description: Timestamp
|
31
|
+
* context:
|
32
|
+
* type: object
|
33
|
+
* properties:
|
34
|
+
* tenant:
|
35
|
+
* type: string
|
36
|
+
* description: Tenant
|
37
|
+
* product:
|
38
|
+
* type: string
|
39
|
+
* description: Product
|
40
|
+
* clientID:
|
41
|
+
* type: string
|
42
|
+
* description: Connection client ID
|
43
|
+
* issuer:
|
44
|
+
* type: string
|
45
|
+
* description: Issuer
|
46
|
+
* relayState:
|
47
|
+
* type: string
|
48
|
+
* description: Relay state
|
49
|
+
* samlResponse:
|
50
|
+
* type: string
|
51
|
+
* description: SAML response
|
52
|
+
* isSAMLFederated:
|
53
|
+
* type: boolean
|
54
|
+
* description: Indicates if SAML is federated
|
55
|
+
* isOIDCFederated:
|
56
|
+
* type: boolean
|
57
|
+
* description: Indicates if OIDC is federated
|
58
|
+
* isIdPFlow:
|
59
|
+
* type: boolean
|
60
|
+
* description: Indicates if request is from IdP
|
61
|
+
*/
|
62
|
+
class SSOTraces {
|
63
|
+
constructor({ tracesStore }) {
|
64
|
+
this.tracesStore = tracesStore;
|
65
|
+
// Clean up stale traces at the start
|
66
|
+
this.cleanUpStaleTraces();
|
67
|
+
// Set timer to run every day
|
68
|
+
setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
69
|
+
this.cleanUpStaleTraces();
|
70
|
+
}), INTERVAL_1_DAY_MS);
|
71
|
+
}
|
72
|
+
saveTrace(payload) {
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
74
|
+
try {
|
75
|
+
const { context } = payload;
|
76
|
+
// Friendly trace id
|
77
|
+
const traceId = yield generateMnemonic();
|
78
|
+
// If timestamp present in payload use that value, else generate the current timestamp
|
79
|
+
const timestamp = typeof payload.timestamp === 'number' ? payload.timestamp : Date.now();
|
80
|
+
const traceValue = Object.assign(Object.assign({}, payload), { traceId, timestamp });
|
81
|
+
const { tenant, product, clientID } = context;
|
82
|
+
const indices = [
|
83
|
+
{
|
84
|
+
name: IndexNames.TenantProduct,
|
85
|
+
value: keyFromParts(tenant, product),
|
86
|
+
filterLogic: ({ tenant, product }) => !!(tenant && product),
|
87
|
+
},
|
88
|
+
{
|
89
|
+
name: IndexNames.SSOClientID,
|
90
|
+
value: clientID,
|
91
|
+
filterLogic: ({ clientID }) => !!clientID,
|
92
|
+
},
|
93
|
+
{
|
94
|
+
name: IndexNames.Product,
|
95
|
+
value: product,
|
96
|
+
filterLogic: ({ product }) => !!product,
|
97
|
+
},
|
98
|
+
]
|
99
|
+
.filter(({ filterLogic }) => filterLogic(context))
|
100
|
+
.map(({ name, value }) => ({ name, value }));
|
101
|
+
yield this.tracesStore.put(traceId, traceValue, ...indices);
|
102
|
+
return traceId;
|
103
|
+
}
|
104
|
+
catch (err) {
|
105
|
+
console.error(`Failed to save trace`, err);
|
106
|
+
}
|
107
|
+
});
|
108
|
+
}
|
109
|
+
/**
|
110
|
+
* @swagger
|
111
|
+
* /api/v1/sso-traces:
|
112
|
+
* get:
|
113
|
+
* summary: Get trace by ID
|
114
|
+
* parameters:
|
115
|
+
* - name: id
|
116
|
+
* description: Trace ID
|
117
|
+
* in: query
|
118
|
+
* required: true
|
119
|
+
* type: string
|
120
|
+
* tags:
|
121
|
+
* - SSO Traces
|
122
|
+
* produces:
|
123
|
+
* - application/json
|
124
|
+
* responses:
|
125
|
+
* '200':
|
126
|
+
* description: Success
|
127
|
+
* schema:
|
128
|
+
* $ref: '#/definitions/SSOTrace'
|
129
|
+
*/
|
130
|
+
getByTraceId(traceId) {
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
132
|
+
return (yield this.tracesStore.get(traceId));
|
133
|
+
});
|
134
|
+
}
|
135
|
+
getAllTraces(pageOffset, pageLimit, pageToken) {
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
137
|
+
return yield this.tracesStore.getAll(pageOffset || 0, pageLimit || 0, pageToken);
|
138
|
+
});
|
139
|
+
}
|
140
|
+
/** Cleans up stale traces older than 1 week */
|
141
|
+
cleanUpStaleTraces() {
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
143
|
+
let staleTraces = [];
|
144
|
+
for (let pageOffset = 0, pageTokenMap = {};; pageOffset += 50) {
|
145
|
+
const { data: page, pageToken: nextPageToken } = yield this.getAllTraces(pageOffset, 50, pageTokenMap[pageOffset]);
|
146
|
+
pageTokenMap[pageOffset + 50] = nextPageToken;
|
147
|
+
if (page.length === 0) {
|
148
|
+
break;
|
149
|
+
}
|
150
|
+
staleTraces = staleTraces.concat(page.filter(({ timestamp }) => Date.now() - timestamp > INTERVAL_1_WEEK_MS));
|
151
|
+
}
|
152
|
+
for (let i = 0; i < staleTraces.length; i++) {
|
153
|
+
yield this.tracesStore.delete(staleTraces[i].traceId);
|
154
|
+
}
|
155
|
+
});
|
156
|
+
}
|
157
|
+
/**
|
158
|
+
* @swagger
|
159
|
+
* /api/v1/sso-traces/product:
|
160
|
+
* get:
|
161
|
+
* summary: Get all traces for a product
|
162
|
+
* parameters:
|
163
|
+
* - $ref: '#/parameters/product'
|
164
|
+
* - $ref: '#/parameters/pageOffset'
|
165
|
+
* - $ref: '#/parameters/pageLimit'
|
166
|
+
* - $ref: '#/parameters/pageToken'
|
167
|
+
* tags:
|
168
|
+
* - SSO Traces
|
169
|
+
* produces:
|
170
|
+
* - application/json
|
171
|
+
* responses:
|
172
|
+
* '200':
|
173
|
+
* description: Success
|
174
|
+
* content:
|
175
|
+
* application/json:
|
176
|
+
* schema:
|
177
|
+
* type: object
|
178
|
+
* properties:
|
179
|
+
* data:
|
180
|
+
* type: array
|
181
|
+
* items:
|
182
|
+
* $ref: '#/definitions/SSOTrace'
|
183
|
+
* pageToken:
|
184
|
+
* type: string
|
185
|
+
* description: token for pagination
|
186
|
+
*/
|
187
|
+
getTracesByProduct(params) {
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
189
|
+
const { product, pageOffset, pageLimit, pageToken } = params;
|
190
|
+
if (!product) {
|
191
|
+
throw new JacksonError('Please provide a `product`.', 400);
|
192
|
+
}
|
193
|
+
const traces = yield this.tracesStore.getByIndex({
|
194
|
+
name: IndexNames.Product,
|
195
|
+
value: product,
|
196
|
+
}, pageOffset, pageLimit, pageToken);
|
197
|
+
return traces;
|
198
|
+
});
|
199
|
+
}
|
200
|
+
deleteTracesByProduct(product) {
|
201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
202
|
+
let pageToken;
|
203
|
+
do {
|
204
|
+
const res = yield this.getTracesByProduct({
|
205
|
+
product,
|
206
|
+
pageOffset: 0,
|
207
|
+
pageLimit: 50,
|
208
|
+
});
|
209
|
+
if (!res.data || !res.data.length) {
|
210
|
+
break;
|
211
|
+
}
|
212
|
+
pageToken = res.pageToken;
|
213
|
+
// deleting traces in batches of 50
|
214
|
+
// deleting in the loop right away as we get the traces
|
215
|
+
yield this.tracesStore.deleteMany((res.data || []).map((t) => t.traceId));
|
216
|
+
} while (pageToken);
|
217
|
+
});
|
218
|
+
}
|
219
|
+
countByProduct(product) {
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
221
|
+
return yield this.tracesStore.getCount({
|
222
|
+
name: IndexNames.Product,
|
223
|
+
value: product,
|
224
|
+
});
|
225
|
+
});
|
226
|
+
}
|
227
|
+
}
|
228
|
+
export default SSOTraces;
|
229
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["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
3
|
+
import { OIDCIdPInitiatedReq } from '../typings';
|
4
|
+
export interface Trace {
|
5
|
+
traceId: string;
|
6
|
+
timestamp: number;
|
7
|
+
error: string;
|
8
|
+
context: {
|
9
|
+
[key: string]: unknown;
|
10
|
+
};
|
11
|
+
}
|
12
|
+
export interface SSOTrace extends Omit<Trace, 'traceId' | 'timestamp'> {
|
13
|
+
timestamp?: number /** Can be passed in from outside else will be set to Date.now() */;
|
14
|
+
context: {
|
15
|
+
tenant: string;
|
16
|
+
product: string;
|
17
|
+
clientID: string;
|
18
|
+
redirectUri?: string;
|
19
|
+
requestedOIDCFlow?: boolean;
|
20
|
+
isSAMLFederated?: boolean;
|
21
|
+
isOIDCFederated?: boolean;
|
22
|
+
isIdPFlow?: boolean;
|
23
|
+
relayState?: string;
|
24
|
+
providerName?: string;
|
25
|
+
acsUrl?: string;
|
26
|
+
entityId?: string;
|
27
|
+
samlRequest?: string;
|
28
|
+
samlResponse?: string;
|
29
|
+
issuer?: string;
|
30
|
+
profile?: SAMLProfile;
|
31
|
+
error?: string;
|
32
|
+
error_description?: string;
|
33
|
+
error_uri?: string;
|
34
|
+
session_state_from_op_error?: string;
|
35
|
+
scope_from_op_error?: string;
|
36
|
+
stack?: string;
|
37
|
+
oidcTokenSet?: {
|
38
|
+
id_token?: string;
|
39
|
+
access_token?: string;
|
40
|
+
};
|
41
|
+
oidcIdPRequest?: OIDCIdPInitiatedReq;
|
42
|
+
};
|
43
|
+
}
|
44
|
+
export type SSOTracesInstance = InstanceType<typeof SSOTraces>;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/sso-traces/types.ts"],"names":[],"mappings":""}
|