@boxyhq/saml-jackson 0.4.2 → 0.4.3
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.js +25 -2
- package/dist/db/sql/sql.js +3 -1
- package/package.json +2 -2
package/dist/controller/oauth.js
CHANGED
@@ -141,6 +141,12 @@ class OAuthController {
|
|
141
141
|
publicKey: samlConfig.certs.publicKey,
|
142
142
|
});
|
143
143
|
const sessionId = crypto_1.default.randomBytes(16).toString('hex');
|
144
|
+
const requestedParams = {
|
145
|
+
tenant,
|
146
|
+
product,
|
147
|
+
client_id,
|
148
|
+
state,
|
149
|
+
};
|
144
150
|
yield this.sessionStore.put(sessionId, {
|
145
151
|
id: samlReq.id,
|
146
152
|
redirect_uri,
|
@@ -148,6 +154,7 @@ class OAuthController {
|
|
148
154
|
state,
|
149
155
|
code_challenge,
|
150
156
|
code_challenge_method,
|
157
|
+
requested: requestedParams,
|
151
158
|
});
|
152
159
|
const relayState = relayStatePrefix + sessionId;
|
153
160
|
let redirectUrl;
|
@@ -213,6 +220,7 @@ class OAuthController {
|
|
213
220
|
profile,
|
214
221
|
clientID: samlConfig.clientID,
|
215
222
|
clientSecret: samlConfig.clientSecret,
|
223
|
+
requested: session.requested,
|
216
224
|
};
|
217
225
|
if (session) {
|
218
226
|
codeVal.session = session;
|
@@ -228,6 +236,13 @@ class OAuthController {
|
|
228
236
|
params.state = session.state;
|
229
237
|
}
|
230
238
|
const redirectUrl = redirect.success((session && session.redirect_uri) || samlConfig.defaultRedirectUrl, params);
|
239
|
+
// delete the session
|
240
|
+
try {
|
241
|
+
yield this.sessionStore.delete(RelayState);
|
242
|
+
}
|
243
|
+
catch (_err) {
|
244
|
+
// ignore error
|
245
|
+
}
|
231
246
|
return { redirect_url: redirectUrl };
|
232
247
|
});
|
233
248
|
}
|
@@ -333,7 +348,15 @@ class OAuthController {
|
|
333
348
|
}
|
334
349
|
// store details against a token
|
335
350
|
const token = crypto_1.default.randomBytes(20).toString('hex');
|
336
|
-
|
351
|
+
const tokenVal = Object.assign(Object.assign({}, codeVal.profile), { requested: codeVal.requested });
|
352
|
+
yield this.tokenStore.put(token, tokenVal);
|
353
|
+
// delete the code
|
354
|
+
try {
|
355
|
+
yield this.codeStore.delete(code);
|
356
|
+
}
|
357
|
+
catch (_err) {
|
358
|
+
// ignore error
|
359
|
+
}
|
337
360
|
return {
|
338
361
|
access_token: token,
|
339
362
|
token_type: 'bearer',
|
@@ -377,7 +400,7 @@ class OAuthController {
|
|
377
400
|
if (!rsp || !rsp.claims) {
|
378
401
|
throw new error_1.JacksonError('Invalid token', 403);
|
379
402
|
}
|
380
|
-
return rsp.claims;
|
403
|
+
return Object.assign(Object.assign({}, rsp.claims), { requested: rsp.requested });
|
381
404
|
});
|
382
405
|
}
|
383
406
|
}
|
package/dist/db/sql/sql.js
CHANGED
@@ -178,8 +178,10 @@ class Sql {
|
|
178
178
|
}
|
179
179
|
delete(namespace, key) {
|
180
180
|
return __awaiter(this, void 0, void 0, function* () {
|
181
|
+
const dbKey = dbutils.key(namespace, key);
|
182
|
+
yield this.ttlRepository.remove({ key: dbKey });
|
181
183
|
return yield this.storeRepository.remove({
|
182
|
-
key:
|
184
|
+
key: dbKey,
|
183
185
|
});
|
184
186
|
});
|
185
187
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@boxyhq/saml-jackson",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.3",
|
4
4
|
"description": "SAML Jackson library",
|
5
5
|
"keywords": [
|
6
6
|
"SAML 2.0"
|
@@ -70,6 +70,6 @@
|
|
70
70
|
"typescript": "4.5.5"
|
71
71
|
},
|
72
72
|
"engines": {
|
73
|
-
"node": ">=14.x"
|
73
|
+
"node": ">=14.18.1 <=16.x"
|
74
74
|
}
|
75
75
|
}
|