@boxyhq/saml-jackson 1.0.2 → 1.0.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.
@@ -61,7 +61,7 @@ const validateResponse = (rawResponse, validateOpts) => __awaiter(void 0, void 0
61
61
  }
62
62
  return profile;
63
63
  });
64
- function getEncodedClientId(client_id) {
64
+ function getEncodedTenantProduct(client_id) {
65
65
  try {
66
66
  const sp = new URLSearchParams(client_id);
67
67
  const tenant = sp.get('tenant');
@@ -128,7 +128,7 @@ class OAuthController {
128
128
  }
129
129
  authorize(body) {
130
130
  return __awaiter(this, void 0, void 0, function* () {
131
- const { response_type = 'code', client_id, redirect_uri, state, tenant, product, code_challenge, code_challenge_method = '',
131
+ const { response_type = 'code', client_id, redirect_uri, state, tenant, product, access_type, code_challenge, code_challenge_method = '',
132
132
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
133
133
  provider = 'saml', idp_hint, } = body;
134
134
  let requestedTenant = tenant;
@@ -169,9 +169,13 @@ class OAuthController {
169
169
  samlConfig = resolvedSamlConfig;
170
170
  }
171
171
  }
172
- else if (client_id && client_id !== '' && client_id !== 'undefined' && client_id !== 'null') {
172
+ else if ((client_id && client_id !== '' && client_id !== 'undefined' && client_id !== 'null') ||
173
+ (access_type && access_type !== '' && access_type !== 'undefined' && access_type !== 'null')) {
173
174
  // if tenant and product are encoded in the client_id then we parse it and check for the relevant config(s)
174
- const sp = getEncodedClientId(client_id);
175
+ let sp = getEncodedTenantProduct(client_id);
176
+ if (!sp && access_type) {
177
+ sp = getEncodedTenantProduct(access_type);
178
+ }
175
179
  if (sp && sp.tenant && sp.product) {
176
180
  requestedTenant = sp.tenant;
177
181
  requestedProduct = sp.product;
@@ -204,6 +208,10 @@ class OAuthController {
204
208
  }
205
209
  else {
206
210
  samlConfig = yield this.configStore.get(client_id);
211
+ if (samlConfig) {
212
+ requestedTenant = samlConfig.tenant;
213
+ requestedProduct = samlConfig.product;
214
+ }
207
215
  }
208
216
  }
209
217
  else {
@@ -456,7 +464,7 @@ class OAuthController {
456
464
  else if (client_id && client_secret) {
457
465
  // check if we have an encoded client_id
458
466
  if (client_id !== 'dummy') {
459
- const sp = getEncodedClientId(client_id);
467
+ const sp = getEncodedTenantProduct(client_id);
460
468
  if (!sp) {
461
469
  // OAuth flow
462
470
  if (client_id !== codeVal.clientID || client_secret !== codeVal.clientSecret) {
package/dist/typings.d.ts CHANGED
@@ -51,6 +51,7 @@ export interface OAuthReqBody {
51
51
  state: string;
52
52
  tenant?: string;
53
53
  product?: string;
54
+ access_type?: string;
54
55
  code_challenge: string;
55
56
  code_challenge_method: 'plain' | 'S256' | '';
56
57
  provider: 'saml';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "SAML Jackson library",
5
5
  "keywords": [
6
6
  "SAML 2.0"
@@ -43,7 +43,7 @@
43
43
  "mongodb": "4.5.0",
44
44
  "mysql2": "2.3.3",
45
45
  "pg": "8.7.3",
46
- "redis": "4.0.6",
46
+ "redis": "4.1.0",
47
47
  "reflect-metadata": "0.1.13",
48
48
  "ripemd160": "2.0.2",
49
49
  "typeorm": "0.3.6",
@@ -51,19 +51,19 @@
51
51
  "xmlbuilder": "15.1.1"
52
52
  },
53
53
  "devDependencies": {
54
- "@types/node": "17.0.30",
54
+ "@types/node": "17.0.31",
55
55
  "@types/sinon": "10.0.11",
56
56
  "@types/tap": "15.0.7",
57
- "@typescript-eslint/eslint-plugin": "5.21.0",
58
- "@typescript-eslint/parser": "5.21.0",
57
+ "@typescript-eslint/eslint-plugin": "5.23.0",
58
+ "@typescript-eslint/parser": "5.23.0",
59
59
  "cross-env": "7.0.3",
60
- "eslint": "8.14.0",
60
+ "eslint": "8.15.0",
61
61
  "eslint-config-prettier": "8.5.0",
62
62
  "prettier": "2.6.2",
63
- "sinon": "13.0.2",
64
- "tap": "16.1.0",
63
+ "sinon": "14.0.0",
64
+ "tap": "16.2.0",
65
65
  "ts-node": "10.7.0",
66
- "tsconfig-paths": "3.14.1",
66
+ "tsconfig-paths": "4.0.0",
67
67
  "typescript": "4.6.4"
68
68
  },
69
69
  "engines": {