@boxyhq/saml-jackson 1.9.0 → 1.9.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/admin.d.ts +7 -3
- package/dist/controller/admin.js +17 -1
- package/dist/controller/admin.js.map +1 -1
- package/dist/controller/oauth.d.ts +3 -1
- package/dist/controller/oauth.js +321 -211
- package/dist/controller/oauth.js.map +1 -1
- package/dist/controller/saml-handler.d.ts +1 -0
- package/dist/controller/saml-handler.js +4 -2
- package/dist/controller/saml-handler.js.map +1 -1
- package/dist/controller/utils.d.ts +2 -1
- package/dist/controller/utils.js +1 -0
- package/dist/controller/utils.js.map +1 -1
- package/dist/directory-sync/DirectoryUsers.js +10 -9
- package/dist/directory-sync/DirectoryUsers.js.map +1 -1
- package/dist/directory-sync/types.d.ts +11 -0
- package/dist/directory-sync/utils.d.ts +6 -9
- package/dist/directory-sync/utils.js +35 -28
- package/dist/directory-sync/utils.js.map +1 -1
- package/dist/ee/branding/index.d.ts +15 -0
- package/dist/ee/branding/index.js +49 -0
- package/dist/ee/branding/index.js.map +1 -0
- package/dist/ee/federated-saml/app.d.ts +12 -5
- package/dist/ee/federated-saml/app.js +19 -12
- package/dist/ee/federated-saml/app.js.map +1 -1
- package/dist/ee/federated-saml/index.d.ts +3 -2
- package/dist/ee/federated-saml/index.js +2 -2
- package/dist/ee/federated-saml/index.js.map +1 -1
- package/dist/ee/federated-saml/sso.d.ts +4 -1
- package/dist/ee/federated-saml/sso.js +70 -45
- package/dist/ee/federated-saml/sso.js.map +1 -1
- package/dist/ee/federated-saml/types.d.ts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/saml/lib.d.ts +1 -0
- package/dist/saml/lib.js +3 -2
- package/dist/saml/lib.js.map +1 -1
- package/dist/saml-tracer/index.d.ts +14 -0
- package/dist/saml-tracer/index.js +87 -0
- package/dist/saml-tracer/index.js.map +1 -0
- package/dist/saml-tracer/types.d.ts +31 -0
- package/dist/saml-tracer/types.js +3 -0
- package/dist/saml-tracer/types.js.map +1 -0
- package/dist/typings.d.ts +12 -0
- package/dist/typings.js +1 -0
- package/dist/typings.js.map +1 -1
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/ee/federated-saml/app.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/ee/federated-saml/app.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kDAA+C;AAC/C,wCAAmD;AACnD,kDAAsD;AACtD,0CAAwD;AACxD,kDAA8E;AAI9E,MAAa,GAAG;IAId,YAAY,EAAE,KAAK,EAAE,IAAI,EAA4C;QACnE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,8DAA8D;IACjD,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAgB;;YAC3E,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE;gBACxD,MAAM,IAAI,oBAAY,CACpB,+FAA+F,EAC/F,GAAG,CACJ,CAAC;aACH;YAED,IAAA,gCAAwB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAE1C,MAAM,EAAE,GAAG,IAAA,aAAK,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAElC,MAAM,GAAG,GAAsB;gBAC7B,EAAE;gBACF,IAAI;gBACJ,MAAM;gBACN,OAAO;gBACP,MAAM;gBACN,QAAQ;gBACR,OAAO,EAAE,IAAI;gBACb,UAAU,EAAE,IAAI;gBAChB,YAAY,EAAE,IAAI;aACnB,CAAC;YAEF,MAAM,IAAI,CAAC,KAAK,CAAC,G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E5B,OAAO;QACT,CAAC;KAAA;IAED,+BAA+B;IAClB,WAAW;;YACtB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,4BAAqB,GAAE,CAAC;YAEpD,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,yBAAyB,CAAC;YACjE,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAE7C,MAAM,GAAG,GAAG,MAAM,IAAA,uBAAiB,EAAC;gBAClC,QAAQ;gBACR,MAAM;gBACN,QAAQ,EAAE,SAAS;aACpB,CAAC,CAAC;YAEH,OAAO;gBACL,GAAG;gBACH,QAAQ;gBACR,MAAM;gBACN,QAAQ,EAAE,SAAS;aACpB,CAAC;QACJ,CAAC;KAAA;CACF;AAlJD,kBAkJC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SSO } from './sso';
|
|
2
2
|
import { App } from './app';
|
|
3
|
-
import type { JacksonOption } from '../../typings';
|
|
4
|
-
declare const SAMLFederation: ({ db, opts }: {
|
|
3
|
+
import type { JacksonOption, SAMLTracerInstance } from '../../typings';
|
|
4
|
+
declare const SAMLFederation: ({ db, opts, samlTracer, }: {
|
|
5
5
|
db: any;
|
|
6
6
|
opts: JacksonOption;
|
|
7
|
+
samlTracer: SAMLTracerInstance;
|
|
7
8
|
}) => Promise<{
|
|
8
9
|
app: App;
|
|
9
10
|
sso: SSO;
|
|
@@ -27,7 +27,7 @@ const sso_1 = require("./sso");
|
|
|
27
27
|
const app_1 = require("./app");
|
|
28
28
|
const saml_handler_1 = require("../../controller/saml-handler");
|
|
29
29
|
// This is the main entry point for the SAML Federation module
|
|
30
|
-
const SAMLFederation = ({ db, opts }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
const SAMLFederation = ({ db, opts, samlTracer, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
31
|
const appStore = db.store('samlfed:apps');
|
|
32
32
|
const sessionStore = db.store('oauth:session', opts.db.ttl);
|
|
33
33
|
const connectionStore = db.store('saml:config');
|
|
@@ -37,7 +37,7 @@ const SAMLFederation = ({ db, opts }) => __awaiter(void 0, void 0, void 0, funct
|
|
|
37
37
|
opts,
|
|
38
38
|
});
|
|
39
39
|
const app = new app_1.App({ store: appStore, opts });
|
|
40
|
-
const sso = new sso_1.SSO({ app, samlHandler });
|
|
40
|
+
const sso = new sso_1.SSO({ app, samlHandler, samlTracer });
|
|
41
41
|
const response = {
|
|
42
42
|
app,
|
|
43
43
|
sso,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ee/federated-saml/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAC5B,+BAA4B;AAE5B,gEAA4D;AAE5D,8DAA8D;AAC9D,MAAM,cAAc,GAAG,CAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ee/federated-saml/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAC5B,+BAA4B;AAE5B,gEAA4D;AAE5D,8DAA8D;AAC9D,MAAM,cAAc,GAAG,CAAO,EAC5B,EAAE,EACF,IAAI,EACJ,UAAU,GAKX,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC1C,MAAM,YAAY,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAC5D,MAAM,eAAe,GAAG,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAEhD,MAAM,WAAW,GAAG,IAAI,0BAAW,CAAC;QAClC,UAAU,EAAE,eAAe;QAC3B,OAAO,EAAE,YAAY;QACrB,IAAI;KACL,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,IAAI,SAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,MAAM,GAAG,GAAG,IAAI,SAAG,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;IAEtD,MAAM,QAAQ,GAAG;QACf,GAAG;QACH,GAAG;KACJ,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,kBAAe,cAAc,CAAC;AAE9B,0CAAwB;AAExB,wBAAwB;AACxB,qGAAqG;AACrG,oDAAoD;AACpD,2FAA2F;AAC3F,iEAAiE;AACjE,8FAA8F;AAC9F,4HAA4H"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { App } from './app';
|
|
2
2
|
import { SAMLHandler } from '../../controller/saml-handler';
|
|
3
|
+
import type { SAMLTracerInstance } from '../../typings';
|
|
3
4
|
export declare class SSO {
|
|
4
5
|
private app;
|
|
5
6
|
private samlHandler;
|
|
6
|
-
|
|
7
|
+
private samlTracer;
|
|
8
|
+
constructor({ app, samlHandler, samlTracer, }: {
|
|
7
9
|
app: App;
|
|
8
10
|
samlHandler: SAMLHandler;
|
|
11
|
+
samlTracer: SAMLTracerInstance;
|
|
9
12
|
});
|
|
10
13
|
getAuthorizeUrl: ({ request, relayState, idp_hint, }: {
|
|
11
14
|
request: string;
|
|
@@ -16,60 +16,85 @@ exports.SSO = void 0;
|
|
|
16
16
|
const saml20_1 = __importDefault(require("@boxyhq/saml20"));
|
|
17
17
|
const error_1 = require("../../controller/error");
|
|
18
18
|
const lib_1 = require("../../saml/lib");
|
|
19
|
+
const utils_1 = require("../../controller/utils");
|
|
19
20
|
class SSO {
|
|
20
|
-
constructor({ app, samlHandler }) {
|
|
21
|
+
constructor({ app, samlHandler, samlTracer, }) {
|
|
21
22
|
// Accept the SAML Request from Service Provider, and create a new SAML Request to be sent to Identity Provider
|
|
22
23
|
this.getAuthorizeUrl = ({ request, relayState, idp_hint, }) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const { id, acsUrl, entityId, publicKey, providerName } = yield (0, lib_1.extractSAMLRequestAttributes)(request);
|
|
24
|
-
// Verify the request if it is signed
|
|
25
|
-
if (publicKey && !saml20_1.default.hasValidSignature(request, publicKey, null)) {
|
|
26
|
-
throw new error_1.JacksonError('Invalid SAML Request signature.', 400);
|
|
27
|
-
}
|
|
28
|
-
const app = yield this.app.getByEntityId(entityId);
|
|
29
|
-
if (app.acsUrl !== acsUrl) {
|
|
30
|
-
throw new error_1.JacksonError("Assertion Consumer Service URL doesn't match.", 400);
|
|
31
|
-
}
|
|
32
|
-
const response = yield this.samlHandler.resolveConnection({
|
|
33
|
-
tenant: app.tenant,
|
|
34
|
-
product: app.product,
|
|
35
|
-
idp_hint,
|
|
36
|
-
authFlow: 'saml',
|
|
37
|
-
originalParams: {
|
|
38
|
-
RelayState: relayState,
|
|
39
|
-
SAMLRequest: request,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
// If there is a redirect URL, then we need to redirect to that URL
|
|
43
|
-
if ('redirectUrl' in response) {
|
|
44
|
-
return {
|
|
45
|
-
redirectUrl: response.redirectUrl,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
24
|
let connection;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
25
|
+
let id, acsUrl, entityId, publicKey, providerName, decodedRequest, app;
|
|
26
|
+
try {
|
|
27
|
+
const parsedSAMLRequest = yield (0, lib_1.extractSAMLRequestAttributes)(request);
|
|
28
|
+
id = parsedSAMLRequest.id;
|
|
29
|
+
acsUrl = parsedSAMLRequest.acsUrl;
|
|
30
|
+
entityId = parsedSAMLRequest.entityId;
|
|
31
|
+
publicKey = parsedSAMLRequest.publicKey;
|
|
32
|
+
providerName = parsedSAMLRequest.providerName;
|
|
33
|
+
decodedRequest = parsedSAMLRequest.decodedRequest;
|
|
34
|
+
// Verify the request if it is signed
|
|
35
|
+
if (publicKey && !saml20_1.default.hasValidSignature(request, publicKey, null)) {
|
|
36
|
+
throw new error_1.JacksonError('Invalid SAML Request signature.', 400);
|
|
37
|
+
}
|
|
38
|
+
app = yield this.app.getByEntityId(entityId);
|
|
39
|
+
if (app.acsUrl !== acsUrl) {
|
|
40
|
+
throw new error_1.JacksonError("Assertion Consumer Service URL doesn't match.", 400);
|
|
41
|
+
}
|
|
42
|
+
const response = yield this.samlHandler.resolveConnection({
|
|
43
|
+
tenant: app.tenant,
|
|
44
|
+
product: app.product,
|
|
45
|
+
idp_hint,
|
|
46
|
+
authFlow: 'saml',
|
|
47
|
+
originalParams: {
|
|
48
|
+
RelayState: relayState,
|
|
49
|
+
SAMLRequest: request,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
// If there is a redirect URL, then we need to redirect to that URL
|
|
53
|
+
if ('redirectUrl' in response) {
|
|
54
|
+
return {
|
|
55
|
+
redirectUrl: response.redirectUrl,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// If there is a connection, use that connection
|
|
59
|
+
if ('connection' in response && 'idpMetadata' in response.connection) {
|
|
60
|
+
connection = response.connection;
|
|
61
|
+
}
|
|
62
|
+
if (!connection) {
|
|
63
|
+
throw new error_1.JacksonError('No SAML connection found.', 404);
|
|
64
|
+
}
|
|
65
|
+
return yield this.samlHandler.createSAMLRequest({
|
|
66
|
+
connection,
|
|
67
|
+
requestParams: {
|
|
68
|
+
id,
|
|
69
|
+
acsUrl,
|
|
70
|
+
entityId,
|
|
71
|
+
publicKey,
|
|
72
|
+
providerName,
|
|
73
|
+
relayState,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
52
76
|
}
|
|
53
|
-
|
|
54
|
-
|
|
77
|
+
catch (err) {
|
|
78
|
+
const error_description = (0, utils_1.getErrorMessage)(err);
|
|
79
|
+
this.samlTracer.saveTrace({
|
|
80
|
+
error: error_description,
|
|
81
|
+
context: {
|
|
82
|
+
tenant: (app === null || app === void 0 ? void 0 : app.tenant) || '',
|
|
83
|
+
product: (app === null || app === void 0 ? void 0 : app.product) || '',
|
|
84
|
+
clientID: (connection === null || connection === void 0 ? void 0 : connection.clientID) || '',
|
|
85
|
+
isSAMLFederated: true,
|
|
86
|
+
providerName,
|
|
87
|
+
acsUrl,
|
|
88
|
+
entityId,
|
|
89
|
+
samlRequest: decodedRequest,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
throw err;
|
|
55
93
|
}
|
|
56
|
-
const { redirectUrl } = yield this.samlHandler.createSAMLRequest({
|
|
57
|
-
connection,
|
|
58
|
-
requestParams: {
|
|
59
|
-
id,
|
|
60
|
-
acsUrl,
|
|
61
|
-
entityId,
|
|
62
|
-
publicKey,
|
|
63
|
-
providerName,
|
|
64
|
-
relayState,
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
return {
|
|
68
|
-
redirectUrl,
|
|
69
|
-
};
|
|
70
94
|
});
|
|
71
95
|
this.app = app;
|
|
72
96
|
this.samlHandler = samlHandler;
|
|
97
|
+
this.samlTracer = samlTracer;
|
|
73
98
|
}
|
|
74
99
|
}
|
|
75
100
|
exports.SSO = SSO;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sso.js","sourceRoot":"","sources":["../../../src/ee/federated-saml/sso.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4DAAkC;AAGlC,kDAAsD;AAGtD,wCAA8D;
|
|
1
|
+
{"version":3,"file":"sso.js","sourceRoot":"","sources":["../../../src/ee/federated-saml/sso.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4DAAkC;AAGlC,kDAAsD;AAGtD,wCAA8D;AAC9D,kDAAyD;AAEzD,MAAa,GAAG;IAKd,YAAY,EACV,GAAG,EACH,WAAW,EACX,UAAU,GAKX;QAMD,+GAA+G;QACxG,oBAAe,GAAG,CAAO,EAC9B,OAAO,EACP,UAAU,EACV,QAAQ,GAKT,EAAE,EAAE;YACH,IAAI,UAAqC,CAAC;YAC1C,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE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;
|
|
8
8
|
acsUrl: string;
|
|
9
9
|
entityId: string;
|
|
10
|
+
logoUrl: string | null;
|
|
11
|
+
faviconUrl: string | null;
|
|
12
|
+
primaryColor: string | null;
|
|
10
13
|
};
|
|
11
14
|
export type SAMLFederationAppWithMetadata = SAMLFederationApp & {
|
|
12
15
|
metadata: {
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { SPSAMLConfig } from './controller/sp-config';
|
|
|
9
9
|
import { SetupLinkController } from './controller/setup-link';
|
|
10
10
|
import { type ISAMLFederationController } from './ee/federated-saml';
|
|
11
11
|
import checkLicense from './ee/common/checkLicense';
|
|
12
|
+
import { BrandingController } from './ee/branding';
|
|
12
13
|
export declare const controllers: (opts: JacksonOption) => Promise<{
|
|
13
14
|
apiController: ConnectionAPIController;
|
|
14
15
|
connectionAPIController: ConnectionAPIController;
|
|
@@ -21,6 +22,7 @@ export declare const controllers: (opts: JacksonOption) => Promise<{
|
|
|
21
22
|
oidcDiscoveryController: OidcDiscoveryController;
|
|
22
23
|
spConfig: SPSAMLConfig;
|
|
23
24
|
samlFederatedController: ISAMLFederationController;
|
|
25
|
+
brandingController: IBrandingController | null;
|
|
24
26
|
checkLicense: () => Promise<boolean>;
|
|
25
27
|
}>;
|
|
26
28
|
export default controllers;
|
|
@@ -28,3 +30,4 @@ export * from './typings';
|
|
|
28
30
|
export * from './ee/federated-saml/types';
|
|
29
31
|
export type SAMLJackson = Awaited<ReturnType<typeof controllers>>;
|
|
30
32
|
export type ISetupLinkController = InstanceType<typeof SetupLinkController>;
|
|
33
|
+
export type IBrandingController = InstanceType<typeof BrandingController>;
|
package/dist/index.js
CHANGED
|
@@ -56,6 +56,8 @@ const analytics_1 = require("./controller/analytics");
|
|
|
56
56
|
const x509 = __importStar(require("./saml/x509"));
|
|
57
57
|
const federated_saml_1 = __importDefault(require("./ee/federated-saml"));
|
|
58
58
|
const checkLicense_1 = __importDefault(require("./ee/common/checkLicense"));
|
|
59
|
+
const branding_1 = require("./ee/branding");
|
|
60
|
+
const saml_tracer_1 = __importDefault(require("./saml-tracer"));
|
|
59
61
|
const defaultOpts = (opts) => {
|
|
60
62
|
const newOpts = Object.assign({}, opts);
|
|
61
63
|
if (!newOpts.externalUrl) {
|
|
@@ -89,8 +91,10 @@ const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
89
91
|
const healthCheckStore = db.store('_health:check');
|
|
90
92
|
const setupLinkStore = db.store('setup:link');
|
|
91
93
|
const certificateStore = db.store('x509:certificates');
|
|
94
|
+
const settingsStore = db.store('portal:settings');
|
|
95
|
+
const samlTracer = new saml_tracer_1.default({ db });
|
|
92
96
|
const connectionAPIController = new api_1.ConnectionAPIController({ connectionStore, opts });
|
|
93
|
-
const adminController = new admin_1.AdminController({ connectionStore });
|
|
97
|
+
const adminController = new admin_1.AdminController({ connectionStore, samlTracer });
|
|
94
98
|
const healthCheckController = new health_check_1.HealthCheckController({ healthCheckStore });
|
|
95
99
|
yield healthCheckController.init();
|
|
96
100
|
const setupLinkController = new setup_link_1.SetupLinkController({ setupLinkStore });
|
|
@@ -107,6 +111,7 @@ const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
107
111
|
sessionStore,
|
|
108
112
|
codeStore,
|
|
109
113
|
tokenStore,
|
|
114
|
+
samlTracer,
|
|
110
115
|
opts,
|
|
111
116
|
});
|
|
112
117
|
const logoutController = new logout_1.LogoutController({
|
|
@@ -117,7 +122,11 @@ const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
117
122
|
const oidcDiscoveryController = new oidc_discovery_1.OidcDiscoveryController({ opts });
|
|
118
123
|
const spConfig = new sp_config_1.SPSAMLConfig(opts);
|
|
119
124
|
const directorySyncController = yield (0, directory_sync_1.default)({ db, opts });
|
|
120
|
-
|
|
125
|
+
// Enterprise Features
|
|
126
|
+
const samlFederatedController = yield (0, federated_saml_1.default)({ db, opts, samlTracer });
|
|
127
|
+
const brandingController = (yield (0, checkLicense_1.default)(opts.boxyhqLicenseKey))
|
|
128
|
+
? new branding_1.BrandingController({ store: settingsStore })
|
|
129
|
+
: null;
|
|
121
130
|
// write pre-loaded connections if present
|
|
122
131
|
const preLoadedConnection = opts.preLoadedConnection || opts.preLoadedConfig;
|
|
123
132
|
if (preLoadedConnection && preLoadedConnection.length > 0) {
|
|
@@ -146,6 +155,7 @@ const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
146
155
|
directorySyncController,
|
|
147
156
|
oidcDiscoveryController,
|
|
148
157
|
samlFederatedController,
|
|
158
|
+
brandingController,
|
|
149
159
|
checkLicense: () => {
|
|
150
160
|
return (0, checkLicense_1.default)(opts.boxyhqLicenseKey);
|
|
151
161
|
},
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAyB;AACzB,+DAAuC;AACvC,sEAA8C;AAC9C,qDAA8D;AAC9D,8CAAqD;AACrD,0CAA2D;AAC3D,8CAAqD;AACrD,4DAAkE;AAClE,gDAAuD;AACvD,sEAAiD;AACjD,gEAAsE;AACtE,sDAAsD;AACtD,wDAA8D;AAC9D,sDAA6D;AAC7D,kDAAoC;AACpC,yEAAwF;AACxF,4EAAoD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAyB;AACzB,+DAAuC;AACvC,sEAA8C;AAC9C,qDAA8D;AAC9D,8CAAqD;AACrD,0CAA2D;AAC3D,8CAAqD;AACrD,4DAAkE;AAClE,gDAAuD;AACvD,sEAAiD;AACjD,gEAAsE;AACtE,sDAAsD;AACtD,wDAA8D;AAC9D,sDAA6D;AAC7D,kDAAoC;AACpC,yEAAwF;AACxF,4EAAoD;A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ist/saml/lib.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const extractSAMLRequestAttributes: (samlRequest: string) => Prom
|
|
|
6
6
|
entityId: string;
|
|
7
7
|
publicKey: string;
|
|
8
8
|
providerName: string;
|
|
9
|
+
decodedRequest: string;
|
|
9
10
|
}>;
|
|
10
11
|
export declare const createMetadataXML: ({ ssoUrl, entityId, x509cert, }: {
|
|
11
12
|
ssoUrl: string;
|
package/dist/saml/lib.js
CHANGED
|
@@ -61,8 +61,8 @@ const extractSAMLResponseAttributes = (decodedResponse, validateOpts) => __await
|
|
|
61
61
|
});
|
|
62
62
|
exports.extractSAMLResponseAttributes = extractSAMLResponseAttributes;
|
|
63
63
|
const extractSAMLRequestAttributes = (samlRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
-
const
|
|
65
|
-
const result = yield parseXML(
|
|
64
|
+
const decodedRequest = yield (0, exports.decodeBase64)(samlRequest, true);
|
|
65
|
+
const result = yield parseXML(decodedRequest);
|
|
66
66
|
const publicKey = result['samlp:AuthnRequest']['Signature']
|
|
67
67
|
? result['samlp:AuthnRequest']['Signature'][0]['KeyInfo'][0]['X509Data'][0]['X509Certificate'][0]
|
|
68
68
|
: null;
|
|
@@ -83,6 +83,7 @@ const extractSAMLRequestAttributes = (samlRequest) => __awaiter(void 0, void 0,
|
|
|
83
83
|
entityId,
|
|
84
84
|
publicKey,
|
|
85
85
|
providerName,
|
|
86
|
+
decodedRequest,
|
|
86
87
|
};
|
|
87
88
|
});
|
|
88
89
|
exports.extractSAMLRequestAttributes = extractSAMLRequestAttributes;
|
package/dist/saml/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/saml/lib.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA4B;AAC5B,oDAA4B;AAC5B,+BAAkC;AAClC,+BAAiC;AACjC,4DAAkC;AAClC,4DA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AAC;iBACH;aACF;SACF;KACF,CAAC;IAEF,MAAM,GAAG,GAAG,oBAAU,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;IAElE,OAAO,MAAM,gBAAI,CAAC,IAAI,CACpB,GAAG,EACH,UAAU,EACV,SAAS,EACT,0FAA0F,CAC3F,CAAC;AACJ,CAAC,CAAA,CAAC;AAjHW,QAAA,kBAAkB,sBAiH7B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Storable } from '../typings';
|
|
2
|
+
import type { SAMLTrace, Trace } from './types';
|
|
3
|
+
declare class SAMLTracer {
|
|
4
|
+
tracerStore: Storable;
|
|
5
|
+
constructor({ db }: {
|
|
6
|
+
db: any;
|
|
7
|
+
});
|
|
8
|
+
saveTrace(payload: SAMLTrace): Promise<string | undefined>;
|
|
9
|
+
getByTraceId(traceId: string): Promise<Trace>;
|
|
10
|
+
getAllTraces(pageOffset?: number, pageLimit?: number): Promise<Trace[]>;
|
|
11
|
+
/** Cleans up stale traces older than 1 week */
|
|
12
|
+
cleanUpStaleTraces(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export default SAMLTracer;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const error_code_mnemonic_1 = require("@boxyhq/error-code-mnemonic");
|
|
13
|
+
const utils_1 = require("../controller/utils");
|
|
14
|
+
const utils_2 = require("../db/utils");
|
|
15
|
+
const INTERVAL_1_WEEK_MS = 7 * 24 * 60 * 60 * 1000;
|
|
16
|
+
const INTERVAL_1_DAY_MS = 24 * 60 * 60 * 1000;
|
|
17
|
+
class SAMLTracer {
|
|
18
|
+
constructor({ db }) {
|
|
19
|
+
this.tracerStore = db.store('saml:tracer');
|
|
20
|
+
// Clean up stale traces at the start
|
|
21
|
+
this.cleanUpStaleTraces();
|
|
22
|
+
// Set timer to run every day
|
|
23
|
+
setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
this.cleanUpStaleTraces();
|
|
25
|
+
}), INTERVAL_1_DAY_MS);
|
|
26
|
+
}
|
|
27
|
+
saveTrace(payload) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
try {
|
|
30
|
+
const { context } = payload;
|
|
31
|
+
// Friendly trace id
|
|
32
|
+
const traceId = yield (0, error_code_mnemonic_1.generateMnemonic)();
|
|
33
|
+
// If timestamp present in payload use that value, else generate the current timestamp
|
|
34
|
+
const timestamp = typeof payload.timestamp === 'number' ? payload.timestamp : Date.now();
|
|
35
|
+
const traceValue = Object.assign(Object.assign({}, payload), { traceId, timestamp });
|
|
36
|
+
const { tenant, product, clientID } = context;
|
|
37
|
+
const indices = [
|
|
38
|
+
{
|
|
39
|
+
name: utils_1.IndexNames.TenantProduct,
|
|
40
|
+
value: (0, utils_2.keyFromParts)(tenant, product),
|
|
41
|
+
filterLogic: ({ tenant, product }) => !!(tenant && product),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: utils_1.IndexNames.SSOClientID,
|
|
45
|
+
value: clientID,
|
|
46
|
+
filterLogic: ({ clientID }) => !!clientID,
|
|
47
|
+
},
|
|
48
|
+
]
|
|
49
|
+
.filter(({ filterLogic }) => filterLogic(context))
|
|
50
|
+
.map(({ name, value }) => ({ name, value }));
|
|
51
|
+
yield this.tracerStore.put(traceId, traceValue, ...indices);
|
|
52
|
+
return traceId;
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
console.error(`Failed to save trace`, err);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
getByTraceId(traceId) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return (yield this.tracerStore.get(traceId));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
getAllTraces(pageOffset, pageLimit) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
return (yield this.tracerStore.getAll(pageOffset || 0, pageLimit || 0));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** Cleans up stale traces older than 1 week */
|
|
70
|
+
cleanUpStaleTraces() {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
let staleTraces = [];
|
|
73
|
+
for (let pageOffset = 0;; pageOffset++) {
|
|
74
|
+
const page = yield this.getAllTraces(pageOffset, 50);
|
|
75
|
+
if (page.length === 0) {
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
staleTraces = staleTraces.concat(page.filter(({ timestamp }) => Date.now() - timestamp > INTERVAL_1_WEEK_MS));
|
|
79
|
+
}
|
|
80
|
+
for (let i = 0; i < staleTraces.length; i++) {
|
|
81
|
+
yield this.tracerStore.delete(staleTraces[i].traceId);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.default = SAMLTracer;
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/saml-tracer/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,qEAA+D;AAC/D,+CAAiD;AACjD,uCA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AC9B,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,kBAAkB,CAAC,CAC5E,CAAC;aACH;YAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC3C,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;aACvD;QACH,CAAC;KAAA;CACF;AAED,kBAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SAMLProfile } from '@boxyhq/saml20/dist/typings';
|
|
2
|
+
import SAMLTracer from '.';
|
|
3
|
+
export interface Trace {
|
|
4
|
+
traceId: string;
|
|
5
|
+
timestamp: number;
|
|
6
|
+
error: string;
|
|
7
|
+
context: {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface SAMLTrace extends Omit<Trace, 'traceId' | 'timestamp'> {
|
|
12
|
+
timestamp?: number /** Can be passed in from outside else will be set to Date.now() */;
|
|
13
|
+
context: Trace['context'] & {
|
|
14
|
+
tenant: string;
|
|
15
|
+
product: string;
|
|
16
|
+
clientID: string;
|
|
17
|
+
redirectUri?: string;
|
|
18
|
+
requestedOIDCFlow?: boolean;
|
|
19
|
+
isSAMLFederated?: boolean;
|
|
20
|
+
isIDPFlow?: boolean;
|
|
21
|
+
relayState?: string;
|
|
22
|
+
providerName?: string;
|
|
23
|
+
acsUrl?: string;
|
|
24
|
+
entityId?: string;
|
|
25
|
+
samlRequest?: string;
|
|
26
|
+
samlResponse?: string;
|
|
27
|
+
issuer?: string;
|
|
28
|
+
profile?: SAMLProfile;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export type SAMLTracerInstance = InstanceType<typeof SAMLTracer>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/saml-tracer/types.ts"],"names":[],"mappings":""}
|
package/dist/typings.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { JWK } from 'jose';
|
|
2
2
|
import type { IssuerMetadata } from 'openid-client';
|
|
3
3
|
export * from './ee/federated-saml/types';
|
|
4
|
+
export * from './saml-tracer/types';
|
|
4
5
|
export * from './directory-sync/types';
|
|
5
6
|
interface SSOConnection {
|
|
6
7
|
defaultRedirectUrl: string;
|
|
@@ -144,6 +145,8 @@ export interface IOAuthController {
|
|
|
144
145
|
}
|
|
145
146
|
export interface IAdminController {
|
|
146
147
|
getAllConnection(pageOffset?: number, pageLimit?: number): any;
|
|
148
|
+
getAllSAMLTraces(pageOffset: number, pageLimit: number): any;
|
|
149
|
+
getSAMLTraceById(traceId: string): any;
|
|
147
150
|
}
|
|
148
151
|
export interface IHealthCheckController {
|
|
149
152
|
status(): Promise<{
|
|
@@ -400,3 +403,12 @@ export type SetupLink = {
|
|
|
400
403
|
validTill: number;
|
|
401
404
|
};
|
|
402
405
|
export type SetupLinkService = 'sso' | 'dsync';
|
|
406
|
+
export type AdminPortalSettings = {
|
|
407
|
+
branding: AdminPortalBranding;
|
|
408
|
+
};
|
|
409
|
+
export type AdminPortalBranding = {
|
|
410
|
+
logoUrl: string | null;
|
|
411
|
+
faviconUrl: string | null;
|
|
412
|
+
primaryColor: string | null;
|
|
413
|
+
companyName: string | null;
|
|
414
|
+
};
|
package/dist/typings.js
CHANGED
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ee/federated-saml/types"), exports);
|
|
18
|
+
__exportStar(require("./saml-tracer/types"), exports);
|
|
18
19
|
__exportStar(require("./directory-sync/types"), exports);
|
|
19
20
|
//# sourceMappingURL=typings.js.map
|
package/dist/typings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typings.js","sourceRoot":"","sources":["../src/typings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,4DAA0C;AAC1C,yDAAuC"}
|
|
1
|
+
{"version":3,"file":"typings.js","sourceRoot":"","sources":["../src/typings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,4DAA0C;AAC1C,sDAAoC;AACpC,yDAAuC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boxyhq/saml-jackson",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "SAML Jackson library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"SAML 2.0"
|
|
@@ -41,15 +41,16 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@boxyhq/saml20": "1.1.3",
|
|
44
|
+
"@boxyhq/error-code-mnemonic": "0.1.0",
|
|
44
45
|
"@opentelemetry/api": "1.4.0",
|
|
45
|
-
"@aws-sdk/credential-providers": "3.
|
|
46
|
+
"@aws-sdk/credential-providers": "3.282.0",
|
|
46
47
|
"axios": "1.3.4",
|
|
47
|
-
"jose": "4.
|
|
48
|
+
"jose": "4.13.1",
|
|
48
49
|
"marked": "4.2.12",
|
|
49
50
|
"mixpanel": "0.17.0",
|
|
50
51
|
"mongodb": "5.1.0",
|
|
51
52
|
"mssql": "9.1.1",
|
|
52
|
-
"mysql2": "3.
|
|
53
|
+
"mysql2": "3.2.0",
|
|
53
54
|
"node-forge": "1.3.1",
|
|
54
55
|
"openid-client": "5.4.0",
|
|
55
56
|
"pg": "8.9.0",
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
65
|
"@faker-js/faker": "7.6.0",
|
|
65
|
-
"@types/node": "18.14.
|
|
66
|
+
"@types/node": "18.14.6",
|
|
66
67
|
"@types/sinon": "10.0.13",
|
|
67
68
|
"@types/tap": "15.0.8",
|
|
68
69
|
"cross-env": "7.0.3",
|