@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,806 @@
|
|
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 dbutils from '../db/utils';
|
11
|
+
import * as metrics from '../opentelemetry/metrics';
|
12
|
+
import { JacksonError } from './error';
|
13
|
+
import { IndexNames, appID, transformConnections, transformConnection, isConnectionActive } from './utils';
|
14
|
+
import oidcConnection from './connection/oidc';
|
15
|
+
import samlConnection from './connection/saml';
|
16
|
+
export class ConnectionAPIController {
|
17
|
+
constructor({ connectionStore, opts, eventController, oryController }) {
|
18
|
+
this.connectionStore = connectionStore;
|
19
|
+
this.opts = opts;
|
20
|
+
this.eventController = eventController;
|
21
|
+
this.oryController = oryController;
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* @swagger
|
25
|
+
* definitions:
|
26
|
+
* Connection:
|
27
|
+
* type: object
|
28
|
+
* example:
|
29
|
+
* {
|
30
|
+
* "idpMetadata": {
|
31
|
+
* "sso": {
|
32
|
+
* "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxsso/saml",
|
33
|
+
* "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxsso/saml"
|
34
|
+
* },
|
35
|
+
* "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
|
36
|
+
* "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
|
37
|
+
* "loginType": "idp",
|
38
|
+
* "provider": "okta.com"
|
39
|
+
* },
|
40
|
+
* "defaultRedirectUrl": "https://hoppscotch.io/",
|
41
|
+
* "redirectUrl": ["https://hoppscotch.io/"],
|
42
|
+
* "tenant": "hoppscotch.io",
|
43
|
+
* "product": "API Engine",
|
44
|
+
* "name": "Hoppscotch-SP",
|
45
|
+
* "description": "SP for hoppscotch.io",
|
46
|
+
* "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
|
47
|
+
* "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
|
48
|
+
* "deactivated": false
|
49
|
+
* }
|
50
|
+
* validationErrorsPost:
|
51
|
+
* description: Please provide rawMetadata or encodedRawMetadata | Please provide a defaultRedirectUrl | Please provide redirectUrl | redirectUrl is invalid | Exceeded maximum number of allowed redirect urls | defaultRedirectUrl is invalid | Please provide tenant | Please provide product | Please provide a friendly name | Description should not exceed 100 characters | Strategy: xxxx not supported | Please provide the clientId from OpenID Provider | Please provide the clientSecret from OpenID Provider | Please provide the discoveryUrl for the OpenID Provider
|
52
|
+
*
|
53
|
+
* parameters:
|
54
|
+
* nameParamPost:
|
55
|
+
* name: name
|
56
|
+
* description: Name/identifier for the connection
|
57
|
+
* type: string
|
58
|
+
* in: formData
|
59
|
+
* labelParamPost:
|
60
|
+
* name: label
|
61
|
+
* description: An internal label to identify the connection
|
62
|
+
* type: string
|
63
|
+
* in: formData
|
64
|
+
* descriptionParamPost:
|
65
|
+
* name: description
|
66
|
+
* description: A short description for the connection not more than 100 characters
|
67
|
+
* type: string
|
68
|
+
* in: formData
|
69
|
+
* encodedRawMetadataParamPost:
|
70
|
+
* name: encodedRawMetadata
|
71
|
+
* description: Base64 encoding of the XML metadata
|
72
|
+
* in: formData
|
73
|
+
* type: string
|
74
|
+
* rawMetadataParamPost:
|
75
|
+
* name: rawMetadata
|
76
|
+
* description: Raw XML metadata
|
77
|
+
* in: formData
|
78
|
+
* type: string
|
79
|
+
* metadataUrlParamPost:
|
80
|
+
* name: metadataUrl
|
81
|
+
* description: URL containing raw XML metadata
|
82
|
+
* in: formData
|
83
|
+
* type: string
|
84
|
+
* defaultRedirectUrlParamPost:
|
85
|
+
* name: defaultRedirectUrl
|
86
|
+
* description: The redirect URL to use in the IdP login flow
|
87
|
+
* in: formData
|
88
|
+
* required: true
|
89
|
+
* type: string
|
90
|
+
* redirectUrlParamPost:
|
91
|
+
* name: redirectUrl
|
92
|
+
* description: JSON encoded array containing a list of allowed redirect URLs
|
93
|
+
* in: formData
|
94
|
+
* required: true
|
95
|
+
* type: string
|
96
|
+
* tenantParamPost:
|
97
|
+
* name: tenant
|
98
|
+
* description: Tenant
|
99
|
+
* in: formData
|
100
|
+
* required: true
|
101
|
+
* type: string
|
102
|
+
* productParamPost:
|
103
|
+
* name: product
|
104
|
+
* description: Product
|
105
|
+
* in: formData
|
106
|
+
* required: true
|
107
|
+
* type: string
|
108
|
+
* oidcDiscoveryUrlPost:
|
109
|
+
* name: oidcDiscoveryUrl
|
110
|
+
* description: well-known URL where the OpenID Provider configuration is exposed
|
111
|
+
* in: formData
|
112
|
+
* type: string
|
113
|
+
* oidcMetadataPost:
|
114
|
+
* name: oidcMetadata
|
115
|
+
* description: metadata (JSON) for the OpenID Provider in the absence of discoveryUrl
|
116
|
+
* in: formData
|
117
|
+
* type: string
|
118
|
+
* oidcClientIdPost:
|
119
|
+
* name: oidcClientId
|
120
|
+
* description: clientId of the application set up on the OpenID Provider
|
121
|
+
* in: formData
|
122
|
+
* type: string
|
123
|
+
* oidcClientSecretPost:
|
124
|
+
* name: oidcClientSecret
|
125
|
+
* description: clientSecret of the application set up on the OpenID Provider
|
126
|
+
* in: formData
|
127
|
+
* type: string
|
128
|
+
* sortOrder:
|
129
|
+
* name: sortOrder
|
130
|
+
* description: Indicate the position of the connection in the IdP selection screen
|
131
|
+
* in: formData
|
132
|
+
* type: number
|
133
|
+
* required: false
|
134
|
+
* forceAuthn:
|
135
|
+
* name: forceAuthn
|
136
|
+
* description: Require a new authentication instead of reusing an existing session.
|
137
|
+
* in: formData
|
138
|
+
* type: boolean
|
139
|
+
* required: false
|
140
|
+
* /api/v1/sso:
|
141
|
+
* post:
|
142
|
+
* summary: Create SSO connection
|
143
|
+
* operationId: create-sso-connection
|
144
|
+
* tags: [Single Sign-On]
|
145
|
+
* produces:
|
146
|
+
* - application/json
|
147
|
+
* consumes:
|
148
|
+
* - application/x-www-form-urlencoded
|
149
|
+
* - application/json
|
150
|
+
* parameters:
|
151
|
+
* - $ref: '#/parameters/nameParamPost'
|
152
|
+
* - $ref: '#/parameters/labelParamPost'
|
153
|
+
* - $ref: '#/parameters/descriptionParamPost'
|
154
|
+
* - $ref: '#/parameters/encodedRawMetadataParamPost'
|
155
|
+
* - $ref: '#/parameters/rawMetadataParamPost'
|
156
|
+
* - $ref: '#/parameters/metadataUrlParamPost'
|
157
|
+
* - $ref: '#/parameters/defaultRedirectUrlParamPost'
|
158
|
+
* - $ref: '#/parameters/redirectUrlParamPost'
|
159
|
+
* - $ref: '#/parameters/tenantParamPost'
|
160
|
+
* - $ref: '#/parameters/productParamPost'
|
161
|
+
* - $ref: '#/parameters/oidcDiscoveryUrlPost'
|
162
|
+
* - $ref: '#/parameters/oidcMetadataPost'
|
163
|
+
* - $ref: '#/parameters/oidcClientIdPost'
|
164
|
+
* - $ref: '#/parameters/oidcClientSecretPost'
|
165
|
+
* - $ref: '#/parameters/sortOrder'
|
166
|
+
* - $ref: '#/parameters/forceAuthn'
|
167
|
+
* responses:
|
168
|
+
* 200:
|
169
|
+
* description: Success
|
170
|
+
* schema:
|
171
|
+
* $ref: '#/definitions/Connection'
|
172
|
+
* 400:
|
173
|
+
* $ref: '#/definitions/validationErrorsPost'
|
174
|
+
* 401:
|
175
|
+
* description: Unauthorized
|
176
|
+
*/
|
177
|
+
createSAMLConnection(body) {
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
179
|
+
metrics.increment('createConnection');
|
180
|
+
const connection = yield samlConnection.create(body, this.connectionStore, this.oryController);
|
181
|
+
yield this.eventController.notify('sso.created', connection);
|
182
|
+
return connection;
|
183
|
+
});
|
184
|
+
}
|
185
|
+
// For backwards compatibility
|
186
|
+
config(...args) {
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
188
|
+
return this.createSAMLConnection(...args);
|
189
|
+
});
|
190
|
+
}
|
191
|
+
createOIDCConnection(body) {
|
192
|
+
return __awaiter(this, void 0, void 0, function* () {
|
193
|
+
metrics.increment('createConnection');
|
194
|
+
if (!this.opts.oidcPath) {
|
195
|
+
throw new JacksonError('Please set OpenID response handler path (oidcPath) on Jackson', 500);
|
196
|
+
}
|
197
|
+
const connection = yield oidcConnection.create(body, this.connectionStore, this.oryController);
|
198
|
+
yield this.eventController.notify('sso.created', connection);
|
199
|
+
return connection;
|
200
|
+
});
|
201
|
+
}
|
202
|
+
/**
|
203
|
+
* @swagger
|
204
|
+
* definitions:
|
205
|
+
* validationErrorsPatch:
|
206
|
+
* description: Please provide clientID | Please provide clientSecret | clientSecret mismatch | Tenant/Product config mismatch with IdP metadata | Description should not exceed 100 characters| redirectUrl is invalid | Exceeded maximum number of allowed redirect urls | defaultRedirectUrl is invalid | Tenant/Product config mismatch with OIDC Provider metadata
|
207
|
+
* parameters:
|
208
|
+
* clientIDParamPatch:
|
209
|
+
* name: clientID
|
210
|
+
* description: Client ID for the connection
|
211
|
+
* type: string
|
212
|
+
* in: formData
|
213
|
+
* required: true
|
214
|
+
* clientSecretParamPatch:
|
215
|
+
* name: clientSecret
|
216
|
+
* description: Client Secret for the connection
|
217
|
+
* type: string
|
218
|
+
* in: formData
|
219
|
+
* required: true
|
220
|
+
* tenantParamPatch:
|
221
|
+
* name: tenant
|
222
|
+
* description: Tenant
|
223
|
+
* in: formData
|
224
|
+
* required: true
|
225
|
+
* type: string
|
226
|
+
* productParamPatch:
|
227
|
+
* name: product
|
228
|
+
* description: Product
|
229
|
+
* in: formData
|
230
|
+
* required: true
|
231
|
+
* type: string
|
232
|
+
* nameParamPatch:
|
233
|
+
* name: name
|
234
|
+
* description: Name/identifier for the connection
|
235
|
+
* type: string
|
236
|
+
* in: formData
|
237
|
+
* labelParamPatch:
|
238
|
+
* name: label
|
239
|
+
* description: An internal label to identify the connection
|
240
|
+
* type: string
|
241
|
+
* in: formData
|
242
|
+
* descriptionParamPatch:
|
243
|
+
* name: description
|
244
|
+
* description: A short description for the connection not more than 100 characters
|
245
|
+
* type: string
|
246
|
+
* in: formData
|
247
|
+
* encodedRawMetadataParamPatch:
|
248
|
+
* name: encodedRawMetadata
|
249
|
+
* description: Base64 encoding of the XML metadata
|
250
|
+
* in: formData
|
251
|
+
* type: string
|
252
|
+
* rawMetadataParamPatch:
|
253
|
+
* name: rawMetadata
|
254
|
+
* description: Raw XML metadata
|
255
|
+
* in: formData
|
256
|
+
* type: string
|
257
|
+
* metadataUrlParamPatch:
|
258
|
+
* name: metadataUrl
|
259
|
+
* description: URL containing raw XML metadata
|
260
|
+
* in: formData
|
261
|
+
* type: string
|
262
|
+
* oidcDiscoveryUrlPatch:
|
263
|
+
* name: oidcDiscoveryUrl
|
264
|
+
* description: well-known URL where the OpenID Provider configuration is exposed
|
265
|
+
* in: formData
|
266
|
+
* type: string
|
267
|
+
* oidcMetadataPatch:
|
268
|
+
* name: oidcMetadata
|
269
|
+
* description: metadata (JSON) for the OpenID Provider in the absence of discoveryUrl
|
270
|
+
* in: formData
|
271
|
+
* type: string
|
272
|
+
* oidcClientIdPatch:
|
273
|
+
* name: oidcClientId
|
274
|
+
* description: clientId of the application set up on the OpenID Provider
|
275
|
+
* in: formData
|
276
|
+
* type: string
|
277
|
+
* oidcClientSecretPatch:
|
278
|
+
* name: oidcClientSecret
|
279
|
+
* description: clientSecret of the application set up on the OpenID Provider
|
280
|
+
* in: formData
|
281
|
+
* type: string
|
282
|
+
* defaultRedirectUrlParamPatch:
|
283
|
+
* name: defaultRedirectUrl
|
284
|
+
* description: The redirect URL to use in the IdP login flow
|
285
|
+
* in: formData
|
286
|
+
* type: string
|
287
|
+
* redirectUrlParamPatch:
|
288
|
+
* name: redirectUrl
|
289
|
+
* description: JSON encoded array containing a list of allowed redirect URLs
|
290
|
+
* in: formData
|
291
|
+
* type: string
|
292
|
+
* deactivatedParamPatch:
|
293
|
+
* name: deactivated
|
294
|
+
* description: Connection status
|
295
|
+
* in: formData
|
296
|
+
* required: false
|
297
|
+
* type: boolean
|
298
|
+
* sortOrderParamPatch:
|
299
|
+
* name: sortOrder
|
300
|
+
* description: Indicate the position of the connection in the IdP selection screen
|
301
|
+
* in: formData
|
302
|
+
* type: number
|
303
|
+
* required: false
|
304
|
+
* forceAuthnParamPatch:
|
305
|
+
* name: forceAuthn
|
306
|
+
* description: Require a new authentication instead of reusing an existing session.
|
307
|
+
* in: formData
|
308
|
+
* type: boolean
|
309
|
+
* required: false
|
310
|
+
* /api/v1/sso:
|
311
|
+
* patch:
|
312
|
+
* summary: Update SSO Connection
|
313
|
+
* operationId: update-sso-connection
|
314
|
+
* tags: [Single Sign-On]
|
315
|
+
* consumes:
|
316
|
+
* - application/json
|
317
|
+
* - application/x-www-form-urlencoded
|
318
|
+
* parameters:
|
319
|
+
* - $ref: '#/parameters/clientIDParamPatch'
|
320
|
+
* - $ref: '#/parameters/clientSecretParamPatch'
|
321
|
+
* - $ref: '#/parameters/nameParamPatch'
|
322
|
+
* - $ref: '#/parameters/labelParamPatch'
|
323
|
+
* - $ref: '#/parameters/descriptionParamPatch'
|
324
|
+
* - $ref: '#/parameters/encodedRawMetadataParamPatch'
|
325
|
+
* - $ref: '#/parameters/rawMetadataParamPatch'
|
326
|
+
* - $ref: '#/parameters/metadataUrlParamPatch'
|
327
|
+
* - $ref: '#/parameters/oidcDiscoveryUrlPatch'
|
328
|
+
* - $ref: '#/parameters/oidcMetadataPatch'
|
329
|
+
* - $ref: '#/parameters/oidcClientIdPatch'
|
330
|
+
* - $ref: '#/parameters/oidcClientSecretPatch'
|
331
|
+
* - $ref: '#/parameters/defaultRedirectUrlParamPatch'
|
332
|
+
* - $ref: '#/parameters/redirectUrlParamPatch'
|
333
|
+
* - $ref: '#/parameters/tenantParamPatch'
|
334
|
+
* - $ref: '#/parameters/productParamPatch'
|
335
|
+
* - $ref: '#/parameters/deactivatedParamPatch'
|
336
|
+
* - $ref: '#/parameters/sortOrderParamPatch'
|
337
|
+
* - $ref: '#/parameters/forceAuthnParamPatch'
|
338
|
+
* responses:
|
339
|
+
* 204:
|
340
|
+
* description: Success
|
341
|
+
* 400:
|
342
|
+
* $ref: '#/definitions/validationErrorsPatch'
|
343
|
+
* 401:
|
344
|
+
* description: Unauthorized
|
345
|
+
* 500:
|
346
|
+
* description: Please set OpenID response handler path (oidcPath) on Jackson
|
347
|
+
*/
|
348
|
+
updateSAMLConnection(body) {
|
349
|
+
return __awaiter(this, void 0, void 0, function* () {
|
350
|
+
const connection = yield samlConnection.update(body, this.connectionStore, this.getConnections.bind(this), this.oryController);
|
351
|
+
if ('deactivated' in body) {
|
352
|
+
if (isConnectionActive(connection)) {
|
353
|
+
yield this.eventController.notify('sso.activated', connection);
|
354
|
+
}
|
355
|
+
else {
|
356
|
+
yield this.eventController.notify('sso.deactivated', connection);
|
357
|
+
}
|
358
|
+
}
|
359
|
+
});
|
360
|
+
}
|
361
|
+
// For backwards compatibility
|
362
|
+
updateConfig(...args) {
|
363
|
+
return __awaiter(this, void 0, void 0, function* () {
|
364
|
+
yield this.updateSAMLConnection(...args);
|
365
|
+
});
|
366
|
+
}
|
367
|
+
updateOIDCConnection(body) {
|
368
|
+
return __awaiter(this, void 0, void 0, function* () {
|
369
|
+
if (!this.opts.oidcPath) {
|
370
|
+
throw new JacksonError('Please set OpenID response handler path (oidcPath) on Jackson', 500);
|
371
|
+
}
|
372
|
+
const connection = yield oidcConnection.update(body, this.connectionStore, this.getConnections.bind(this), this.oryController);
|
373
|
+
if ('deactivated' in body) {
|
374
|
+
if (isConnectionActive(connection)) {
|
375
|
+
yield this.eventController.notify('sso.activated', connection);
|
376
|
+
}
|
377
|
+
else {
|
378
|
+
yield this.eventController.notify('sso.deactivated', connection);
|
379
|
+
}
|
380
|
+
}
|
381
|
+
});
|
382
|
+
}
|
383
|
+
getIDPEntityID(body) {
|
384
|
+
const tenant = 'tenant' in body ? body.tenant : undefined;
|
385
|
+
const product = 'product' in body ? body.product : undefined;
|
386
|
+
if (!tenant || !product) {
|
387
|
+
throw new JacksonError('Please provide `tenant` and `product`.', 400);
|
388
|
+
}
|
389
|
+
else {
|
390
|
+
return `${this.opts.samlAudience}/${appID(tenant, product)}`;
|
391
|
+
}
|
392
|
+
}
|
393
|
+
/**
|
394
|
+
* @swagger
|
395
|
+
* parameters:
|
396
|
+
* tenantParamGet:
|
397
|
+
* in: query
|
398
|
+
* name: tenant
|
399
|
+
* type: string
|
400
|
+
* description: Tenant (Optional if clientID provided)
|
401
|
+
* productParamGet:
|
402
|
+
* in: query
|
403
|
+
* name: product
|
404
|
+
* type: string
|
405
|
+
* description: Product (Optional if clientID provided)
|
406
|
+
* clientIDParamGet:
|
407
|
+
* in: query
|
408
|
+
* name: clientID
|
409
|
+
* type: string
|
410
|
+
* description: Client ID (Optional if tenant/product provided)
|
411
|
+
* strategyParamGet:
|
412
|
+
* in: query
|
413
|
+
* name: strategy
|
414
|
+
* type: string
|
415
|
+
* description: Strategy which can help to filter connections with tenant/product query
|
416
|
+
* sortParamGet:
|
417
|
+
* in: query
|
418
|
+
* name: sort
|
419
|
+
* type: string
|
420
|
+
* description: If present, the connections will be sorted by `sortOrder`. It won't consider if pagination is used.
|
421
|
+
* definitions:
|
422
|
+
* Connection:
|
423
|
+
* type: object
|
424
|
+
* properties:
|
425
|
+
* clientID:
|
426
|
+
* type: string
|
427
|
+
* description: Connection clientID
|
428
|
+
* clientSecret:
|
429
|
+
* type: string
|
430
|
+
* description: Connection clientSecret
|
431
|
+
* name:
|
432
|
+
* type: string
|
433
|
+
* description: Connection name
|
434
|
+
* label:
|
435
|
+
* type: string
|
436
|
+
* description: Connection label
|
437
|
+
* description:
|
438
|
+
* type: string
|
439
|
+
* description: Connection description
|
440
|
+
* redirectUrl:
|
441
|
+
* type: string
|
442
|
+
* description: A list of allowed redirect URLs
|
443
|
+
* defaultRedirectUrl:
|
444
|
+
* type: string
|
445
|
+
* description: The redirect URL to use in the IdP login flow
|
446
|
+
* tenant:
|
447
|
+
* type: string
|
448
|
+
* description: Connection tenant
|
449
|
+
* product:
|
450
|
+
* type: string
|
451
|
+
* description: Connection product
|
452
|
+
* idpMetadata:
|
453
|
+
* type: object
|
454
|
+
* description: SAML IdP metadata
|
455
|
+
* oidcProvider:
|
456
|
+
* type: object
|
457
|
+
* description: OIDC IdP metadata
|
458
|
+
* deactivated:
|
459
|
+
* type: boolean
|
460
|
+
* description: Connection status
|
461
|
+
* sortOrder:
|
462
|
+
* type: number
|
463
|
+
* description: Connection sort order
|
464
|
+
* responses:
|
465
|
+
* '200Get':
|
466
|
+
* description: Success
|
467
|
+
* schema:
|
468
|
+
* type: array
|
469
|
+
* items:
|
470
|
+
* $ref: '#/definitions/Connection'
|
471
|
+
* '400Get':
|
472
|
+
* description: Please provide `clientID` or `tenant` and `product`.
|
473
|
+
* '401Get':
|
474
|
+
* description: Unauthorized
|
475
|
+
* /api/v1/sso:
|
476
|
+
* get:
|
477
|
+
* summary: Get SSO Connections
|
478
|
+
* parameters:
|
479
|
+
* - $ref: '#/parameters/tenantParamGet'
|
480
|
+
* - $ref: '#/parameters/productParamGet'
|
481
|
+
* - $ref: '#/parameters/clientIDParamGet'
|
482
|
+
* - $ref: '#/parameters/strategyParamGet'
|
483
|
+
* - $ref: '#/parameters/sortParamGet'
|
484
|
+
* operationId: get-connections
|
485
|
+
* tags: [Single Sign-On]
|
486
|
+
* responses:
|
487
|
+
* '200':
|
488
|
+
* $ref: '#/responses/200Get'
|
489
|
+
* '400':
|
490
|
+
* $ref: '#/responses/400Get'
|
491
|
+
* '401':
|
492
|
+
* $ref: '#/responses/401Get'
|
493
|
+
*/
|
494
|
+
getConnections(body) {
|
495
|
+
return __awaiter(this, void 0, void 0, function* () {
|
496
|
+
const clientID = 'clientID' in body ? body.clientID : undefined;
|
497
|
+
const tenant = 'tenant' in body ? body.tenant : undefined;
|
498
|
+
const product = 'product' in body ? body.product : undefined;
|
499
|
+
const strategy = 'strategy' in body ? body.strategy : undefined;
|
500
|
+
const entityId = 'entityId' in body ? body.entityId : undefined;
|
501
|
+
metrics.increment('getConnections');
|
502
|
+
let connections = null;
|
503
|
+
// Fetch connections by entityId
|
504
|
+
if (entityId) {
|
505
|
+
const result = yield this.connectionStore.getByIndex({
|
506
|
+
name: IndexNames.EntityID,
|
507
|
+
value: entityId,
|
508
|
+
});
|
509
|
+
if (!result || typeof result !== 'object') {
|
510
|
+
connections = [];
|
511
|
+
}
|
512
|
+
else {
|
513
|
+
connections = result.data;
|
514
|
+
}
|
515
|
+
}
|
516
|
+
// Fetch connections by clientID
|
517
|
+
else if (clientID) {
|
518
|
+
const result = yield this.connectionStore.get(clientID);
|
519
|
+
if (!result || typeof result !== 'object') {
|
520
|
+
connections = [];
|
521
|
+
}
|
522
|
+
else {
|
523
|
+
connections = [result];
|
524
|
+
}
|
525
|
+
}
|
526
|
+
// Fetch connections by multiple tenants
|
527
|
+
else if (tenant && product && Array.isArray(tenant)) {
|
528
|
+
const tenants = tenant.filter((t) => t).filter((t, i, a) => a.indexOf(t) === i);
|
529
|
+
const result = yield Promise.all(tenants.map((t) => __awaiter(this, void 0, void 0, function* () {
|
530
|
+
return this.connectionStore.getByIndex({
|
531
|
+
name: IndexNames.TenantProduct,
|
532
|
+
value: dbutils.keyFromParts(t, product),
|
533
|
+
});
|
534
|
+
})));
|
535
|
+
if (!result || !result.length) {
|
536
|
+
connections = [];
|
537
|
+
}
|
538
|
+
else {
|
539
|
+
connections = result.flatMap((r) => r.data);
|
540
|
+
}
|
541
|
+
}
|
542
|
+
// Fetch connections by tenant and product
|
543
|
+
else if (tenant && product && !Array.isArray(tenant)) {
|
544
|
+
const result = yield this.connectionStore.getByIndex({
|
545
|
+
name: IndexNames.TenantProduct,
|
546
|
+
value: dbutils.keyFromParts(tenant, product),
|
547
|
+
});
|
548
|
+
if (!result || !result.data.length) {
|
549
|
+
connections = [];
|
550
|
+
}
|
551
|
+
else {
|
552
|
+
connections = result.data;
|
553
|
+
}
|
554
|
+
// Filter connections by strategy
|
555
|
+
if (connections && connections.length > 0 && strategy) {
|
556
|
+
connections = connections.filter((connection) => {
|
557
|
+
if (strategy === 'saml') {
|
558
|
+
return 'idpMetadata' in connection;
|
559
|
+
}
|
560
|
+
if (strategy === 'oidc') {
|
561
|
+
return 'oidcProvider' in connection;
|
562
|
+
}
|
563
|
+
return false;
|
564
|
+
});
|
565
|
+
}
|
566
|
+
}
|
567
|
+
if (connections) {
|
568
|
+
const sort = 'sort' in body ? body.sort : false;
|
569
|
+
if (sort) {
|
570
|
+
connections.sort((a, b) => (b.sortOrder || 0) - (a.sortOrder || 0));
|
571
|
+
}
|
572
|
+
return transformConnections(connections);
|
573
|
+
}
|
574
|
+
throw new JacksonError('Please provide `clientID` or `tenant` and `product`.', 400);
|
575
|
+
});
|
576
|
+
}
|
577
|
+
getConfig(body) {
|
578
|
+
return __awaiter(this, void 0, void 0, function* () {
|
579
|
+
const clientID = 'clientID' in body ? body.clientID : undefined;
|
580
|
+
const tenant = 'tenant' in body ? body.tenant : undefined;
|
581
|
+
const product = 'product' in body ? body.product : undefined;
|
582
|
+
metrics.increment('getConnections');
|
583
|
+
if (clientID) {
|
584
|
+
const samlConfig = yield this.connectionStore.get(clientID);
|
585
|
+
return samlConfig || {};
|
586
|
+
}
|
587
|
+
if (tenant && product) {
|
588
|
+
const samlConfigs = (yield this.connectionStore.getByIndex({
|
589
|
+
name: IndexNames.TenantProduct,
|
590
|
+
value: dbutils.keyFromParts(tenant, product),
|
591
|
+
})).data;
|
592
|
+
if (!samlConfigs || !samlConfigs.length) {
|
593
|
+
return {};
|
594
|
+
}
|
595
|
+
return Object.assign({}, samlConfigs[0]);
|
596
|
+
}
|
597
|
+
throw new JacksonError('Please provide `clientID` or `tenant` and `product`.', 400);
|
598
|
+
});
|
599
|
+
}
|
600
|
+
/**
|
601
|
+
* @swagger
|
602
|
+
* parameters:
|
603
|
+
* clientIDDel:
|
604
|
+
* name: clientID
|
605
|
+
* in: query
|
606
|
+
* type: string
|
607
|
+
* description: Client ID (Optional if tenant/product provided)
|
608
|
+
* clientSecretDel:
|
609
|
+
* name: clientSecret
|
610
|
+
* in: query
|
611
|
+
* type: string
|
612
|
+
* description: Client Secret (Optional if tenant/product provided)
|
613
|
+
* tenantDel:
|
614
|
+
* name: tenant
|
615
|
+
* in: query
|
616
|
+
* type: string
|
617
|
+
* description: Tenant (Optional if clientID/Secret provided)
|
618
|
+
* productDel:
|
619
|
+
* name: product
|
620
|
+
* in: query
|
621
|
+
* type: string
|
622
|
+
* description: Product (Optional if clientID/Secret provided)
|
623
|
+
* strategyDel:
|
624
|
+
* name: strategy
|
625
|
+
* in: query
|
626
|
+
* type: string
|
627
|
+
* description: Strategy which can help to filter connections with tenant/product query
|
628
|
+
* /api/v1/sso:
|
629
|
+
* delete:
|
630
|
+
* parameters:
|
631
|
+
* - $ref: '#/parameters/clientIDDel'
|
632
|
+
* - $ref: '#/parameters/clientSecretDel'
|
633
|
+
* - $ref: '#/parameters/tenantDel'
|
634
|
+
* - $ref: '#/parameters/productDel'
|
635
|
+
* - $ref: '#/parameters/strategyDel'
|
636
|
+
* summary: Delete SSO Connections
|
637
|
+
* operationId: delete-sso-connection
|
638
|
+
* tags: [Single Sign-On]
|
639
|
+
* responses:
|
640
|
+
* '200':
|
641
|
+
* description: Success
|
642
|
+
* '400':
|
643
|
+
* description: clientSecret mismatch | Please provide `clientID` and `clientSecret` or `tenant` and `product`.
|
644
|
+
* '401':
|
645
|
+
* description: Unauthorized
|
646
|
+
*/
|
647
|
+
deleteConnections(body) {
|
648
|
+
return __awaiter(this, void 0, void 0, function* () {
|
649
|
+
const clientID = 'clientID' in body ? body.clientID : undefined;
|
650
|
+
const clientSecret = 'clientSecret' in body ? body.clientSecret : undefined;
|
651
|
+
const tenant = 'tenant' in body ? body.tenant : undefined;
|
652
|
+
const product = 'product' in body ? body.product : undefined;
|
653
|
+
const strategy = 'strategy' in body ? body.strategy : undefined;
|
654
|
+
metrics.increment('deleteConnections');
|
655
|
+
if (clientID && clientSecret) {
|
656
|
+
const connection = yield this.connectionStore.get(clientID);
|
657
|
+
if (!connection) {
|
658
|
+
return;
|
659
|
+
}
|
660
|
+
if (connection.clientSecret === clientSecret) {
|
661
|
+
yield this.connectionStore.delete(clientID);
|
662
|
+
yield this.eventController.notify('sso.deleted', transformConnection(connection));
|
663
|
+
}
|
664
|
+
else {
|
665
|
+
throw new JacksonError('clientSecret mismatch', 400);
|
666
|
+
}
|
667
|
+
return;
|
668
|
+
}
|
669
|
+
if (tenant && product) {
|
670
|
+
const connections = (yield this.connectionStore.getByIndex({
|
671
|
+
name: IndexNames.TenantProduct,
|
672
|
+
value: dbutils.keyFromParts(tenant, product),
|
673
|
+
})).data;
|
674
|
+
if (!connections || !connections.length) {
|
675
|
+
return;
|
676
|
+
}
|
677
|
+
// filter if strategy is passed
|
678
|
+
const filteredConnections = strategy
|
679
|
+
? connections.filter((connection) => {
|
680
|
+
if (strategy === 'saml') {
|
681
|
+
if (connection.idpMetadata) {
|
682
|
+
return true;
|
683
|
+
}
|
684
|
+
}
|
685
|
+
if (strategy === 'oidc') {
|
686
|
+
if (connection.oidcProvider) {
|
687
|
+
return true;
|
688
|
+
}
|
689
|
+
}
|
690
|
+
return false;
|
691
|
+
})
|
692
|
+
: connections;
|
693
|
+
for (const conf of transformConnections(filteredConnections)) {
|
694
|
+
yield this.connectionStore.delete(conf.clientID);
|
695
|
+
yield this.eventController.notify('sso.deleted', conf);
|
696
|
+
}
|
697
|
+
return;
|
698
|
+
}
|
699
|
+
throw new JacksonError('Please provide `clientID` and `clientSecret` or `tenant` and `product`.', 400);
|
700
|
+
});
|
701
|
+
}
|
702
|
+
deleteConfig(body) {
|
703
|
+
return __awaiter(this, void 0, void 0, function* () {
|
704
|
+
yield this.deleteConnections(Object.assign(Object.assign({}, body), { strategy: 'saml' }));
|
705
|
+
});
|
706
|
+
}
|
707
|
+
/**
|
708
|
+
* @swagger
|
709
|
+
* parameters:
|
710
|
+
* productParamGet:
|
711
|
+
* in: query
|
712
|
+
* name: product
|
713
|
+
* type: string
|
714
|
+
* description: Product
|
715
|
+
* required: true
|
716
|
+
* definitions:
|
717
|
+
* Connection:
|
718
|
+
* type: object
|
719
|
+
* properties:
|
720
|
+
* clientID:
|
721
|
+
* type: string
|
722
|
+
* description: Connection clientID
|
723
|
+
* clientSecret:
|
724
|
+
* type: string
|
725
|
+
* description: Connection clientSecret
|
726
|
+
* name:
|
727
|
+
* type: string
|
728
|
+
* description: Connection name
|
729
|
+
* description:
|
730
|
+
* type: string
|
731
|
+
* description: Connection description
|
732
|
+
* redirectUrl:
|
733
|
+
* type: string
|
734
|
+
* description: A list of allowed redirect URLs
|
735
|
+
* defaultRedirectUrl:
|
736
|
+
* type: string
|
737
|
+
* description: The redirect URL to use in the IdP login flow
|
738
|
+
* tenant:
|
739
|
+
* type: string
|
740
|
+
* description: Connection tenant
|
741
|
+
* product:
|
742
|
+
* type: string
|
743
|
+
* description: Connection product
|
744
|
+
* idpMetadata:
|
745
|
+
* type: object
|
746
|
+
* description: SAML IdP metadata
|
747
|
+
* oidcProvider:
|
748
|
+
* type: object
|
749
|
+
* description: OIDC IdP metadata
|
750
|
+
* responses:
|
751
|
+
* '200GetByProduct':
|
752
|
+
* description: Success
|
753
|
+
* content:
|
754
|
+
* application/json:
|
755
|
+
* schema:
|
756
|
+
* type: object
|
757
|
+
* properties:
|
758
|
+
* data:
|
759
|
+
* type: array
|
760
|
+
* items:
|
761
|
+
* $ref: '#/definitions/Connection'
|
762
|
+
* pageToken:
|
763
|
+
* type: string
|
764
|
+
* description: token for pagination
|
765
|
+
* '400Get':
|
766
|
+
* description: Please provide a `product`.
|
767
|
+
* '401Get':
|
768
|
+
* description: Unauthorized
|
769
|
+
* /api/v1/sso/product:
|
770
|
+
* get:
|
771
|
+
* summary: Get SSO Connections by product
|
772
|
+
* parameters:
|
773
|
+
* - $ref: '#/parameters/productParamGet'
|
774
|
+
* - $ref: '#/parameters/pageOffset'
|
775
|
+
* - $ref: '#/parameters/pageLimit'
|
776
|
+
* - $ref: '#/parameters/pageToken'
|
777
|
+
* operationId: get-connections-by-product
|
778
|
+
* tags: [Single Sign-On]
|
779
|
+
* responses:
|
780
|
+
* '200':
|
781
|
+
* $ref: '#/responses/200GetByProduct'
|
782
|
+
* '400':
|
783
|
+
* $ref: '#/responses/400Get'
|
784
|
+
* '401':
|
785
|
+
* $ref: '#/responses/401Get'
|
786
|
+
*/
|
787
|
+
getConnectionsByProduct(body) {
|
788
|
+
return __awaiter(this, void 0, void 0, function* () {
|
789
|
+
const { product, pageOffset, pageLimit, pageToken } = body;
|
790
|
+
if (!product) {
|
791
|
+
throw new JacksonError('Please provide a `product`.', 400);
|
792
|
+
}
|
793
|
+
const connections = yield this.connectionStore.getByIndex({
|
794
|
+
name: IndexNames.Product,
|
795
|
+
value: product,
|
796
|
+
}, pageOffset, pageLimit, pageToken);
|
797
|
+
return { data: transformConnections(connections.data), pageToken };
|
798
|
+
});
|
799
|
+
}
|
800
|
+
getCount(idx) {
|
801
|
+
return __awaiter(this, void 0, void 0, function* () {
|
802
|
+
return yield this.connectionStore.getCount(idx);
|
803
|
+
});
|
804
|
+
}
|
805
|
+
}
|
806
|
+
//# sourceMappingURL=api.js.map
|