@abtnode/auth 1.16.8-beta-186fd5aa → 1.16.8-beta-56e84f3c
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/lib/passport.js +11 -1
- package/lib/server.js +3 -1
- package/package.json +12 -12
package/lib/passport.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
2
|
|
|
3
3
|
const Joi = require('joi');
|
|
4
|
+
const joinUrl = require('url-join');
|
|
4
5
|
const pick = require('lodash/pick');
|
|
5
6
|
const { create: createVC } = require('@arcblock/vc');
|
|
6
|
-
const {
|
|
7
|
+
const {
|
|
8
|
+
ROLES,
|
|
9
|
+
VC_TYPE_GENERAL_PASSPORT,
|
|
10
|
+
PASSPORT_STATUS,
|
|
11
|
+
WELLKNOWN_SERVICE_PATH_PREFIX,
|
|
12
|
+
} = require('@abtnode/constant');
|
|
7
13
|
const createPassportSvg = require('./util/create-passport-svg');
|
|
8
14
|
|
|
9
15
|
const SPEC_VERSION = '1.0.0';
|
|
@@ -171,6 +177,9 @@ const createUserPassport = (vc, { status = PASSPORT_STATUS.VALID, role = ROLES.G
|
|
|
171
177
|
return x;
|
|
172
178
|
};
|
|
173
179
|
|
|
180
|
+
const getPassportClaimUrl = (baseUrl) =>
|
|
181
|
+
baseUrl ? joinUrl(baseUrl, WELLKNOWN_SERVICE_PATH_PREFIX, '/lost-passport') : '';
|
|
182
|
+
|
|
174
183
|
module.exports = {
|
|
175
184
|
validatePassport,
|
|
176
185
|
createPassport,
|
|
@@ -183,4 +192,5 @@ module.exports = {
|
|
|
183
192
|
getRoleFromLocalPassport,
|
|
184
193
|
getRoleFromExternalPassport,
|
|
185
194
|
createUserPassport,
|
|
195
|
+
getPassportClaimUrl,
|
|
186
196
|
};
|
package/lib/server.js
CHANGED
|
@@ -45,6 +45,7 @@ const {
|
|
|
45
45
|
getRoleFromLocalPassport,
|
|
46
46
|
getRoleFromExternalPassport,
|
|
47
47
|
createUserPassport,
|
|
48
|
+
getPassportClaimUrl,
|
|
48
49
|
} = require('./passport');
|
|
49
50
|
const logger = require('./logger');
|
|
50
51
|
|
|
@@ -256,7 +257,7 @@ const authenticateBySession = async ({ node, userDid, locale, allowedRoles = ['o
|
|
|
256
257
|
|
|
257
258
|
const getAuthVcClaim =
|
|
258
259
|
({ node, launchBlocklet, blocklet, options }) =>
|
|
259
|
-
async ({ extraParams: { locale, passportId }, context: { didwallet } }) => {
|
|
260
|
+
async ({ extraParams: { locale, passportId }, context: { didwallet, baseUrl } }) => {
|
|
260
261
|
checkWalletVersion({ didwallet, locale });
|
|
261
262
|
|
|
262
263
|
const baseClaim = {
|
|
@@ -290,6 +291,7 @@ const getAuthVcClaim =
|
|
|
290
291
|
...baseClaim,
|
|
291
292
|
trustedIssuers,
|
|
292
293
|
...(options || {}),
|
|
294
|
+
claimUrl: getPassportClaimUrl(baseUrl),
|
|
293
295
|
};
|
|
294
296
|
};
|
|
295
297
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.8-beta-
|
|
6
|
+
"version": "1.16.8-beta-56e84f3c",
|
|
7
7
|
"description": "Simple lib to manage auth in ABT Node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@abtnode/constant": "1.16.8-beta-
|
|
24
|
-
"@abtnode/logger": "1.16.8-beta-
|
|
25
|
-
"@abtnode/util": "1.16.8-beta-
|
|
26
|
-
"@arcblock/did": "1.18.
|
|
27
|
-
"@arcblock/vc": "1.18.
|
|
28
|
-
"@blocklet/constant": "1.16.8-beta-
|
|
29
|
-
"@blocklet/meta": "1.16.8-beta-
|
|
30
|
-
"@ocap/mcrypto": "1.18.
|
|
31
|
-
"@ocap/util": "1.18.
|
|
32
|
-
"@ocap/wallet": "1.18.
|
|
23
|
+
"@abtnode/constant": "1.16.8-beta-56e84f3c",
|
|
24
|
+
"@abtnode/logger": "1.16.8-beta-56e84f3c",
|
|
25
|
+
"@abtnode/util": "1.16.8-beta-56e84f3c",
|
|
26
|
+
"@arcblock/did": "1.18.80",
|
|
27
|
+
"@arcblock/vc": "1.18.80",
|
|
28
|
+
"@blocklet/constant": "1.16.8-beta-56e84f3c",
|
|
29
|
+
"@blocklet/meta": "1.16.8-beta-56e84f3c",
|
|
30
|
+
"@ocap/mcrypto": "1.18.80",
|
|
31
|
+
"@ocap/util": "1.18.80",
|
|
32
|
+
"@ocap/wallet": "1.18.80",
|
|
33
33
|
"joi": "17.7.0",
|
|
34
34
|
"jsonwebtoken": "^9.0.0",
|
|
35
35
|
"lodash": "^4.17.21",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"jest": "^27.5.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "2abfe83fcd951169a59719addb3dc3c1bbf8789f"
|
|
45
45
|
}
|