@boxyhq/saml-jackson 0.3.6-beta.592 → 0.3.6-beta.604
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/oauth.d.ts +1 -0
- package/dist/controller/oauth.js +20 -10
- package/dist/controller/utils.d.ts +1 -0
- package/dist/controller/utils.js +25 -1
- package/dist/saml/saml.js +1 -1
- package/dist/typings.d.ts +1 -0
- package/package.json +1 -3
package/dist/controller/oauth.js
CHANGED
@@ -40,9 +40,6 @@ const allowed = __importStar(require("./oauth/allowed"));
|
|
40
40
|
const codeVerifier = __importStar(require("./oauth/code-verifier"));
|
41
41
|
const redirect = __importStar(require("./oauth/redirect"));
|
42
42
|
const utils_1 = require("./utils");
|
43
|
-
const util_1 = require("util");
|
44
|
-
const zlib_1 = require("zlib");
|
45
|
-
const deflateRawAsync = (0, util_1.promisify)(zlib_1.deflateRaw);
|
46
43
|
const relayStatePrefix = 'boxyhq_jackson_';
|
47
44
|
function getEncodedClientId(client_id) {
|
48
45
|
try {
|
@@ -133,13 +130,26 @@ class OAuthController {
|
|
133
130
|
code_challenge,
|
134
131
|
code_challenge_method,
|
135
132
|
});
|
136
|
-
|
137
|
-
const samlReqEnc =
|
138
|
-
const
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
133
|
+
const relayState = relayStatePrefix + sessionId;
|
134
|
+
const samlReqEnc = Buffer.from(samlReq.request).toString('base64');
|
135
|
+
const { sso } = samlConfig.idpMetadata;
|
136
|
+
let redirectUrl = '';
|
137
|
+
let authorizeForm = '';
|
138
|
+
// HTTP redirect binding
|
139
|
+
if ('redirectUrl' in sso) {
|
140
|
+
redirectUrl = redirect.success(sso.redirectUrl, {
|
141
|
+
RelayState: relayState,
|
142
|
+
SAMLRequest: samlReqEnc,
|
143
|
+
});
|
144
|
+
}
|
145
|
+
// HTTP POST binding
|
146
|
+
if ('postUrl' in sso) {
|
147
|
+
authorizeForm = (0, utils_1.createAuthorizeForm)(relayState, samlReqEnc, sso.postUrl);
|
148
|
+
}
|
149
|
+
return {
|
150
|
+
redirect_url: redirectUrl,
|
151
|
+
authorize_form: authorizeForm,
|
152
|
+
};
|
143
153
|
});
|
144
154
|
}
|
145
155
|
samlResponse(body) {
|
package/dist/controller/utils.js
CHANGED
@@ -1,8 +1,32 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.IndexNames = void 0;
|
3
|
+
exports.createAuthorizeForm = exports.IndexNames = void 0;
|
4
4
|
var IndexNames;
|
5
5
|
(function (IndexNames) {
|
6
6
|
IndexNames["EntityID"] = "entityID";
|
7
7
|
IndexNames["TenantProduct"] = "tenantProduct";
|
8
8
|
})(IndexNames = exports.IndexNames || (exports.IndexNames = {}));
|
9
|
+
const createAuthorizeForm = (relayState, samlReqEnc, postUrl) => {
|
10
|
+
const formElements = [
|
11
|
+
'<!DOCTYPE html>',
|
12
|
+
'<html>',
|
13
|
+
'<head>',
|
14
|
+
'<meta charset="utf-8">',
|
15
|
+
'<meta http-equiv="x-ua-compatible" content="ie=edge">',
|
16
|
+
'</head>',
|
17
|
+
'<body onload="document.forms[0].submit()">',
|
18
|
+
'<noscript>',
|
19
|
+
'<p>Note: Since your browser does not support JavaScript, you must press the Continue button once to proceed.</p>',
|
20
|
+
'</noscript>',
|
21
|
+
'<form method="post" action="' + encodeURI(postUrl) + '">',
|
22
|
+
'<input type="hidden" name="RelayState" value="' + relayState + '"/>',
|
23
|
+
'<input type="hidden" name="SAMLRequest" value="' + samlReqEnc + '"/>',
|
24
|
+
'<input type="submit" value="Continue" />',
|
25
|
+
'</form>',
|
26
|
+
'<script>document.forms[0].style.display="none";</script>',
|
27
|
+
'</body>',
|
28
|
+
'</html>',
|
29
|
+
];
|
30
|
+
return formElements.join('');
|
31
|
+
};
|
32
|
+
exports.createAuthorizeForm = createAuthorizeForm;
|
package/dist/saml/saml.js
CHANGED
@@ -68,7 +68,7 @@ const request = ({ ssoUrl, entityID, callbackUrl, isPassive = false, forceAuthn
|
|
68
68
|
'@ID': id,
|
69
69
|
'@Version': '2.0',
|
70
70
|
'@IssueInstant': date,
|
71
|
-
'@ProtocolBinding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-
|
71
|
+
'@ProtocolBinding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
|
72
72
|
'@Destination': ssoUrl,
|
73
73
|
'saml:Issuer': {
|
74
74
|
'@xmlns:saml': 'urn:oasis:names:tc:SAML:2.0:assertion',
|
package/dist/typings.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@boxyhq/saml-jackson",
|
3
|
-
"version": "0.3.6-beta.
|
3
|
+
"version": "0.3.6-beta.604",
|
4
4
|
"description": "SAML 2.0 service",
|
5
5
|
"keywords": [
|
6
6
|
"SAML 2.0"
|
@@ -34,8 +34,6 @@
|
|
34
34
|
"@boxyhq/saml20": "0.2.0",
|
35
35
|
"@peculiar/webcrypto": "1.2.3",
|
36
36
|
"@peculiar/x509": "1.6.1",
|
37
|
-
"cors": "2.8.5",
|
38
|
-
"express": "4.17.2",
|
39
37
|
"mongodb": "4.3.0",
|
40
38
|
"mysql2": "2.3.3",
|
41
39
|
"pg": "8.7.1",
|