@boxyhq/saml-jackson 0.2.0-beta.151 → 0.2.1-beta.155
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/package.json +1 -1
- package/src/controller/api.js +2 -2
- package/src/controller/oauth.js +10 -8
- package/src/db/db.js +7 -1
- package/src/db/mem.js +1 -1
- package/src/db/mongo.js +1 -1
- package/src/db/redis.js +1 -1
- package/src/db/sql/sql.js +4 -6
package/package.json
CHANGED
package/src/controller/api.js
CHANGED
@@ -10,7 +10,7 @@ let configStore;
|
|
10
10
|
const extractHostName = (url) => {
|
11
11
|
try {
|
12
12
|
const pUrl = new URL(url);
|
13
|
-
if(pUrl.hostname.startsWith('www.')) {
|
13
|
+
if (pUrl.hostname.startsWith('www.')) {
|
14
14
|
return pUrl.hostname.substring(4);
|
15
15
|
}
|
16
16
|
return pUrl.hostname;
|
@@ -56,7 +56,7 @@ const config = async (body) => {
|
|
56
56
|
{
|
57
57
|
idpMetadata,
|
58
58
|
defaultRedirectUrl,
|
59
|
-
redirectUrl: JSON.parse(redirectUrl),
|
59
|
+
redirectUrl: JSON.parse(redirectUrl), // redirectUrl is a stringified array
|
60
60
|
tenant,
|
61
61
|
product,
|
62
62
|
clientID,
|
package/src/controller/oauth.js
CHANGED
@@ -258,14 +258,16 @@ const token = async (body) => {
|
|
258
258
|
|
259
259
|
if (client_id && client_secret) {
|
260
260
|
// check if we have an encoded client_id
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
261
|
+
if (client_id !== 'dummy' && client_secret !== 'dummy') {
|
262
|
+
const sp = getEncodedClientId(client_id);
|
263
|
+
if (!sp) {
|
264
|
+
// OAuth flow
|
265
|
+
if (
|
266
|
+
client_id !== codeVal.clientID ||
|
267
|
+
client_secret !== codeVal.clientSecret
|
268
|
+
) {
|
269
|
+
throw new JacksonError('Invalid client_id or client_secret', 401);
|
270
|
+
}
|
269
271
|
}
|
270
272
|
}
|
271
273
|
} else if (code_verifier) {
|
package/src/db/db.js
CHANGED
@@ -23,7 +23,13 @@ class DB {
|
|
23
23
|
throw new Error('secondary indexes not allow on a store with ttl');
|
24
24
|
}
|
25
25
|
|
26
|
-
return await this.db.put(
|
26
|
+
return await this.db.put(
|
27
|
+
namespace,
|
28
|
+
key,
|
29
|
+
JSON.stringify(val),
|
30
|
+
ttl,
|
31
|
+
...indexes
|
32
|
+
);
|
27
33
|
}
|
28
34
|
|
29
35
|
async delete(namespace, key) {
|
package/src/db/mem.js
CHANGED
package/src/db/mongo.js
CHANGED
package/src/db/redis.js
CHANGED
package/src/db/sql/sql.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
|
2
|
+
|
1
3
|
require('reflect-metadata');
|
2
4
|
const typeorm = require('typeorm');
|
3
5
|
const JacksonStore = require('./model/JacksonStore.js');
|
@@ -79,7 +81,7 @@ class Sql {
|
|
79
81
|
key: dbutils.key(namespace, key),
|
80
82
|
});
|
81
83
|
|
82
|
-
if (res) {
|
84
|
+
if (res && res.value) {
|
83
85
|
return JSON.parse(res.value);
|
84
86
|
}
|
85
87
|
|
@@ -99,17 +101,13 @@ class Sql {
|
|
99
101
|
});
|
100
102
|
}
|
101
103
|
|
102
|
-
if (res && res.store) {
|
103
|
-
return JSON.parse(res.store.value);
|
104
|
-
}
|
105
|
-
|
106
104
|
return ret;
|
107
105
|
}
|
108
106
|
|
109
107
|
async put(namespace, key, val, ttl = 0, ...indexes) {
|
110
108
|
await this.connection.transaction(async (transactionalEntityManager) => {
|
111
109
|
const dbKey = dbutils.key(namespace, key);
|
112
|
-
const store = new JacksonStore(dbKey,
|
110
|
+
const store = new JacksonStore(dbKey, val);
|
113
111
|
await transactionalEntityManager.save(store);
|
114
112
|
|
115
113
|
if (ttl) {
|