serverless-offline 10.2.0 → 10.3.0
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/README.md +2 -0
- package/package.json +4 -4
- package/src/ServerlessOffline.js +13 -35
- package/src/config/commandOptions.js +19 -19
- package/src/events/http/Http.js +37 -1
- package/src/events/http/HttpServer.js +7 -4
- package/src/events/http/createJWTAuthScheme.js +5 -9
- package/src/events/http/lambda-events/LambdaProxyIntegrationEvent.js +3 -3
- package/src/events/http/lambda-events/LambdaProxyIntegrationEventV2.js +11 -9
- package/src/events/http/lambda-events/VelocityContext.js +2 -5
- package/src/events/websocket/HttpServer.js +1 -1
package/README.md
CHANGED
|
@@ -141,6 +141,8 @@ Used to disable cookie-validation on hapi.js-server.
|
|
|
141
141
|
|
|
142
142
|
#### disableScheduledEvents
|
|
143
143
|
|
|
144
|
+
_This option is deprecated and will be removed in the next major version. If you want to disable the event, please define it in the 'events.schedule.enabled' section of the serverless config._
|
|
145
|
+
|
|
144
146
|
Disables all scheduled events. Overrides configurations in serverless.yml.
|
|
145
147
|
|
|
146
148
|
#### dockerHost
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dedicatedTo": "Blue, a great migrating bird.",
|
|
3
3
|
"name": "serverless-offline",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.3.0",
|
|
5
5
|
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -86,16 +86,16 @@
|
|
|
86
86
|
"@hapi/h2o2": "^9.1.0",
|
|
87
87
|
"@hapi/hapi": "^20.2.2",
|
|
88
88
|
"@serverless/utils": "^6.7.0",
|
|
89
|
-
"aws-sdk": "^2.
|
|
89
|
+
"aws-sdk": "^2.1223.0",
|
|
90
90
|
"boxen": "^7.0.0",
|
|
91
91
|
"chalk": "^5.0.1",
|
|
92
92
|
"execa": "^6.1.0",
|
|
93
93
|
"fs-extra": "^10.1.0",
|
|
94
94
|
"java-invoke-local": "0.0.6",
|
|
95
|
+
"jose": "^4.9.3",
|
|
95
96
|
"js-string-escape": "^1.0.1",
|
|
96
97
|
"jsonpath-plus": "^7.2.0",
|
|
97
98
|
"jsonschema": "^1.4.1",
|
|
98
|
-
"jsonwebtoken": "^8.5.1",
|
|
99
99
|
"jszip": "^3.10.1",
|
|
100
100
|
"luxon": "^3.0.3",
|
|
101
101
|
"node-fetch": "^3.2.10",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@istanbuljs/esm-loader-hook": "^0.2.0",
|
|
111
111
|
"archiver": "^5.3.1",
|
|
112
|
-
"eslint": "^8.
|
|
112
|
+
"eslint": "^8.24.0",
|
|
113
113
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
114
114
|
"eslint-config-prettier": "^8.5.0",
|
|
115
115
|
"eslint-plugin-import": "^2.25.4",
|
package/src/ServerlessOffline.js
CHANGED
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
SERVER_SHUTDOWN_TIMEOUT,
|
|
8
8
|
} from './config/index.js'
|
|
9
9
|
import { gray, orange } from './config/colors.js'
|
|
10
|
-
import { createApiKey } from './utils/index.js'
|
|
11
10
|
|
|
12
11
|
export default class ServerlessOffline {
|
|
13
12
|
#cliOptions = null
|
|
@@ -62,12 +61,22 @@ export default class ServerlessOffline {
|
|
|
62
61
|
async start() {
|
|
63
62
|
this.#mergeOptions()
|
|
64
63
|
|
|
64
|
+
if (this.#options.disableScheduledEvents) {
|
|
65
|
+
log.notice()
|
|
66
|
+
log.warning(
|
|
67
|
+
orange(`'--disableScheduledEvents' is deprecated and will be removed in the next major version.
|
|
68
|
+
Please disable the event in the 'events.schedule.enabled' section of the serverless config.
|
|
69
|
+
If you are experiencing any issues please let us know: https://github.com/dherault/serverless-offline/issues`),
|
|
70
|
+
)
|
|
71
|
+
log.notice()
|
|
72
|
+
}
|
|
73
|
+
|
|
65
74
|
const { httpEvents, lambdas, scheduleEvents, webSocketEvents } =
|
|
66
75
|
this.#getEvents()
|
|
67
76
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
if (lambdas.length > 0) {
|
|
78
|
+
await this.#createLambda(lambdas)
|
|
79
|
+
}
|
|
71
80
|
|
|
72
81
|
const eventModules = []
|
|
73
82
|
|
|
@@ -266,8 +275,6 @@ export default class ServerlessOffline {
|
|
|
266
275
|
|
|
267
276
|
const functionKeys = service.getAllFunctions()
|
|
268
277
|
|
|
269
|
-
let hasPrivateHttpEvent = false
|
|
270
|
-
|
|
271
278
|
functionKeys.forEach((functionKey) => {
|
|
272
279
|
const functionDefinition = service.getFunction(functionKey)
|
|
273
280
|
|
|
@@ -337,10 +344,6 @@ export default class ServerlessOffline {
|
|
|
337
344
|
}
|
|
338
345
|
}
|
|
339
346
|
|
|
340
|
-
if (http?.private) {
|
|
341
|
-
hasPrivateHttpEvent = true
|
|
342
|
-
}
|
|
343
|
-
|
|
344
347
|
httpEvents.push(httpEvent)
|
|
345
348
|
}
|
|
346
349
|
|
|
@@ -360,31 +363,6 @@ export default class ServerlessOffline {
|
|
|
360
363
|
})
|
|
361
364
|
})
|
|
362
365
|
|
|
363
|
-
// for simple API Key authentication model
|
|
364
|
-
if (hasPrivateHttpEvent) {
|
|
365
|
-
if (this.#options.apiKey) {
|
|
366
|
-
log.notice()
|
|
367
|
-
log.warning(
|
|
368
|
-
orange(`'--apiKey' is deprecated and will be removed in the next major version.
|
|
369
|
-
Please define the apiKey value in the 'provider.apiGateway.apiKeys' section of the serverless config.
|
|
370
|
-
If you are experiencing any issues please let us know: https://github.com/dherault/serverless-offline/issues`),
|
|
371
|
-
)
|
|
372
|
-
log.notice()
|
|
373
|
-
} else {
|
|
374
|
-
this.#options.apiKey = createApiKey()
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
log.notice(`Key with token: ${this.#options.apiKey}`)
|
|
378
|
-
|
|
379
|
-
if (this.#options.noAuth) {
|
|
380
|
-
log.notice(
|
|
381
|
-
`Authorizers are turned off. You do not need to use 'x-api-key' header.`,
|
|
382
|
-
)
|
|
383
|
-
} else {
|
|
384
|
-
log.notice(`Remember to use 'x-api-key' on the request headers.`)
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
366
|
return {
|
|
389
367
|
httpEvents,
|
|
390
368
|
lambdas,
|
|
@@ -22,46 +22,46 @@ export default {
|
|
|
22
22
|
corsExposedHeaders: {
|
|
23
23
|
type: 'string',
|
|
24
24
|
usage:
|
|
25
|
-
'Used to build the Access-Control-Exposed-Headers response header for CORS support',
|
|
25
|
+
'Used to build the Access-Control-Exposed-Headers response header for CORS support.',
|
|
26
26
|
},
|
|
27
27
|
disableCookieValidation: {
|
|
28
28
|
type: 'boolean',
|
|
29
|
-
usage: 'Used to disable cookie-validation on hapi.js-server',
|
|
29
|
+
usage: 'Used to disable cookie-validation on hapi.js-server.',
|
|
30
30
|
},
|
|
31
31
|
disableScheduledEvents: {
|
|
32
32
|
type: 'boolean',
|
|
33
33
|
usage:
|
|
34
|
-
'Disables all scheduled events. Overrides configurations in serverless.yml. Default: false',
|
|
34
|
+
'[This option is deprecated] Disables all scheduled events. Overrides configurations in serverless.yml. Default: false.',
|
|
35
35
|
},
|
|
36
36
|
dockerHost: {
|
|
37
37
|
type: 'string',
|
|
38
|
-
usage: 'The host name of Docker. Default: localhost',
|
|
38
|
+
usage: 'The host name of Docker. Default: localhost.',
|
|
39
39
|
},
|
|
40
40
|
dockerHostServicePath: {
|
|
41
41
|
type: 'string',
|
|
42
42
|
usage:
|
|
43
|
-
'Defines service path which is used by SLS running inside Docker container',
|
|
43
|
+
'Defines service path which is used by SLS running inside Docker container.',
|
|
44
44
|
},
|
|
45
45
|
dockerNetwork: {
|
|
46
46
|
type: 'string',
|
|
47
|
-
usage: 'The network that the Docker container will connect to',
|
|
47
|
+
usage: 'The network that the Docker container will connect to.',
|
|
48
48
|
},
|
|
49
49
|
dockerReadOnly: {
|
|
50
50
|
type: 'boolean',
|
|
51
|
-
usage: 'Marks if the docker code layer should be read only. Default: true',
|
|
51
|
+
usage: 'Marks if the docker code layer should be read only. Default: true.',
|
|
52
52
|
},
|
|
53
53
|
enforceSecureCookies: {
|
|
54
54
|
type: 'boolean',
|
|
55
|
-
usage: 'Enforce secure cookies',
|
|
55
|
+
usage: 'Enforce secure cookies.',
|
|
56
56
|
},
|
|
57
57
|
host: {
|
|
58
58
|
shortcut: 'o',
|
|
59
59
|
type: 'string',
|
|
60
|
-
usage: 'The host name to listen on. Default: localhost',
|
|
60
|
+
usage: 'The host name to listen on. Default: localhost.',
|
|
61
61
|
},
|
|
62
62
|
httpPort: {
|
|
63
63
|
type: 'string',
|
|
64
|
-
usage: 'HTTP port to listen on. Default: 3000',
|
|
64
|
+
usage: 'HTTP port to listen on. Default: 3000.',
|
|
65
65
|
},
|
|
66
66
|
httpsProtocol: {
|
|
67
67
|
shortcut: 'H',
|
|
@@ -76,20 +76,20 @@ export default {
|
|
|
76
76
|
},
|
|
77
77
|
lambdaPort: {
|
|
78
78
|
type: 'string',
|
|
79
|
-
usage: 'Lambda http port to listen on. Default: 3002',
|
|
79
|
+
usage: 'Lambda http port to listen on. Default: 3002.',
|
|
80
80
|
},
|
|
81
81
|
layersDir: {
|
|
82
82
|
type: 'string',
|
|
83
83
|
usage:
|
|
84
|
-
'The directory layers should be stored in. Default: {codeDir}/.serverless-offline/layers',
|
|
84
|
+
'The directory layers should be stored in. Default: {codeDir}/.serverless-offline/layers.',
|
|
85
85
|
},
|
|
86
86
|
localEnvironment: {
|
|
87
87
|
type: 'boolean',
|
|
88
|
-
usage: 'Copy local environment variables. Default: false',
|
|
88
|
+
usage: 'Copy local environment variables. Default: false.',
|
|
89
89
|
},
|
|
90
90
|
noAuth: {
|
|
91
91
|
type: 'boolean',
|
|
92
|
-
usage: 'Turns off all authorizers',
|
|
92
|
+
usage: 'Turns off all authorizers.',
|
|
93
93
|
},
|
|
94
94
|
noPrependStageInUrl: {
|
|
95
95
|
type: 'boolean',
|
|
@@ -125,24 +125,24 @@ export default {
|
|
|
125
125
|
},
|
|
126
126
|
useDocker: {
|
|
127
127
|
type: 'boolean',
|
|
128
|
-
usage: 'Uses docker for node/python/ruby/provided',
|
|
128
|
+
usage: 'Uses docker for node/python/ruby/provided.',
|
|
129
129
|
},
|
|
130
130
|
useInProcess: {
|
|
131
131
|
type: 'boolean',
|
|
132
|
-
usage: "Run handlers in the same process as 'serverless-offline'",
|
|
132
|
+
usage: "Run handlers in the same process as 'serverless-offline'.",
|
|
133
133
|
},
|
|
134
134
|
webSocketHardTimeout: {
|
|
135
135
|
type: 'string',
|
|
136
136
|
usage:
|
|
137
|
-
'Set WebSocket hard timeout in seconds to reproduce AWS limits (https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table). Default: 7200 (2 hours)',
|
|
137
|
+
'Set WebSocket hard timeout in seconds to reproduce AWS limits (https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table). Default: 7200 (2 hours).',
|
|
138
138
|
},
|
|
139
139
|
webSocketIdleTimeout: {
|
|
140
140
|
type: 'string',
|
|
141
141
|
usage:
|
|
142
|
-
'Set WebSocket idle timeout in seconds to reproduce AWS limits (https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table). Default: 600 (10 minutes)',
|
|
142
|
+
'Set WebSocket idle timeout in seconds to reproduce AWS limits (https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table). Default: 600 (10 minutes).',
|
|
143
143
|
},
|
|
144
144
|
websocketPort: {
|
|
145
145
|
type: 'string',
|
|
146
|
-
usage: 'Websocket port to listen on. Default: 3001',
|
|
146
|
+
usage: 'Websocket port to listen on. Default: 3001.',
|
|
147
147
|
},
|
|
148
148
|
}
|
package/src/events/http/Http.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import { log } from '@serverless/utils/log.js'
|
|
1
2
|
import HttpEventDefinition from './HttpEventDefinition.js'
|
|
2
3
|
import HttpServer from './HttpServer.js'
|
|
4
|
+
import { orange } from '../../config/colors.js'
|
|
5
|
+
import { createApiKey } from '../../utils/index.js'
|
|
3
6
|
|
|
4
7
|
export default class Http {
|
|
8
|
+
#hasPrivateHttpEvent = false
|
|
9
|
+
|
|
5
10
|
#httpServer = null
|
|
6
11
|
|
|
12
|
+
#options = null
|
|
13
|
+
|
|
7
14
|
constructor(serverless, options, lambda) {
|
|
8
15
|
this.#httpServer = new HttpServer(serverless, options, lambda)
|
|
16
|
+
this.#options = options
|
|
9
17
|
}
|
|
10
18
|
|
|
11
19
|
start() {
|
|
@@ -28,10 +36,38 @@ export default class Http {
|
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
create(events) {
|
|
31
|
-
events.forEach(({ functionKey, handler, http }) => {
|
|
39
|
+
events.forEach(({ functionKey, handler, http, private: priv }) => {
|
|
32
40
|
this.#createEvent(functionKey, http, handler)
|
|
41
|
+
|
|
42
|
+
if (priv) {
|
|
43
|
+
this.#hasPrivateHttpEvent = true
|
|
44
|
+
}
|
|
33
45
|
})
|
|
34
46
|
|
|
47
|
+
if (this.#hasPrivateHttpEvent) {
|
|
48
|
+
if (this.#options.apiKey) {
|
|
49
|
+
log.notice()
|
|
50
|
+
log.warning(
|
|
51
|
+
orange(`'--apiKey' is deprecated and will be removed in the next major version.
|
|
52
|
+
Please define the apiKey value in the 'provider.apiGateway.apiKeys' section of the serverless config.
|
|
53
|
+
If you are experiencing any issues please let us know: https://github.com/dherault/serverless-offline/issues`),
|
|
54
|
+
)
|
|
55
|
+
log.notice()
|
|
56
|
+
} else {
|
|
57
|
+
this.#options.apiKey = createApiKey()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
log.notice(`Key with token: ${this.#options.apiKey}`)
|
|
61
|
+
|
|
62
|
+
if (this.#options.noAuth) {
|
|
63
|
+
log.notice(
|
|
64
|
+
`Authorizers are turned off. You do not need to use 'x-api-key' header.`,
|
|
65
|
+
)
|
|
66
|
+
} else {
|
|
67
|
+
log.notice(`Remember to use 'x-api-key' on the request headers.`)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
35
71
|
this.#httpServer.writeRoutesTerminal()
|
|
36
72
|
}
|
|
37
73
|
|
|
@@ -440,7 +440,7 @@ export default class HttpServer {
|
|
|
440
440
|
!this.#apiKeysValues.has(apiKey)
|
|
441
441
|
) {
|
|
442
442
|
log.debug(
|
|
443
|
-
`Method ${method} of function ${functionKey} token ${apiKey} not valid
|
|
443
|
+
`Method '${method}' of function '${functionKey}' token '${apiKey}' not valid.`,
|
|
444
444
|
)
|
|
445
445
|
|
|
446
446
|
return errorResponse()
|
|
@@ -452,15 +452,18 @@ export default class HttpServer {
|
|
|
452
452
|
) {
|
|
453
453
|
const { usageIdentifierKey } = request.auth.credentials
|
|
454
454
|
|
|
455
|
-
if (
|
|
455
|
+
if (
|
|
456
|
+
usageIdentifierKey !== this.#options.apiKey &&
|
|
457
|
+
!this.#apiKeysValues.has(usageIdentifierKey)
|
|
458
|
+
) {
|
|
456
459
|
log.debug(
|
|
457
|
-
`Method ${method} of function ${functionKey} token ${usageIdentifierKey} not valid
|
|
460
|
+
`Method '${method}' of function '${functionKey}' token '${usageIdentifierKey}' not valid.`,
|
|
458
461
|
)
|
|
459
462
|
|
|
460
463
|
return errorResponse()
|
|
461
464
|
}
|
|
462
465
|
} else {
|
|
463
|
-
log.debug(`Missing x-api-key on private function ${functionKey}
|
|
466
|
+
log.debug(`Missing 'x-api-key' on private function '${functionKey}'.`)
|
|
464
467
|
|
|
465
468
|
return errorResponse()
|
|
466
469
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Boom from '@hapi/boom'
|
|
2
2
|
import { log } from '@serverless/utils/log.js'
|
|
3
|
-
import {
|
|
3
|
+
import { decodeJwt } from 'jose'
|
|
4
4
|
|
|
5
5
|
const { isArray } = Array
|
|
6
6
|
|
|
@@ -35,18 +35,14 @@ export default function createAuthScheme(jwtOptions) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
try {
|
|
38
|
-
const
|
|
39
|
-
if (!decoded) {
|
|
40
|
-
return Boom.unauthorized('JWT not decoded')
|
|
41
|
-
}
|
|
38
|
+
const claims = decodeJwt(jwtToken)
|
|
42
39
|
|
|
43
|
-
const expirationDate = new Date(
|
|
40
|
+
const expirationDate = new Date(claims.exp * 1000)
|
|
44
41
|
if (expirationDate.valueOf() < Date.now()) {
|
|
45
42
|
return Boom.unauthorized('JWT Token expired')
|
|
46
43
|
}
|
|
47
44
|
|
|
48
|
-
const { aud, iss, scope } =
|
|
49
|
-
const clientId = decoded.payload.client_id
|
|
45
|
+
const { aud, iss, scope, client_id: clientId } = claims
|
|
50
46
|
if (iss !== jwtOptions.issuerUrl) {
|
|
51
47
|
log.notice(`JWT Token not from correct issuer url`)
|
|
52
48
|
|
|
@@ -91,7 +87,7 @@ export default function createAuthScheme(jwtOptions) {
|
|
|
91
87
|
// return resolve(
|
|
92
88
|
return h.authenticated({
|
|
93
89
|
credentials: {
|
|
94
|
-
claims
|
|
90
|
+
claims,
|
|
95
91
|
scopes,
|
|
96
92
|
},
|
|
97
93
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer'
|
|
2
2
|
import { env } from 'node:process'
|
|
3
3
|
import { log } from '@serverless/utils/log.js'
|
|
4
|
-
import {
|
|
4
|
+
import { decodeJwt } from 'jose'
|
|
5
5
|
import {
|
|
6
6
|
createUniqueId,
|
|
7
7
|
formatToClfTime,
|
|
@@ -122,8 +122,8 @@ export default class LambdaProxyIntegrationEvent {
|
|
|
122
122
|
|
|
123
123
|
if (token) {
|
|
124
124
|
try {
|
|
125
|
-
claims =
|
|
126
|
-
if (claims
|
|
125
|
+
claims = decodeJwt(token)
|
|
126
|
+
if (claims.scope) {
|
|
127
127
|
scopes = claims.scope.split(' ')
|
|
128
128
|
// In AWS HTTP Api the scope property is removed from the decoded JWT
|
|
129
129
|
// I'm leaving this property because I'm not sure how all of the authorizers
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer'
|
|
2
2
|
import { env } from 'node:process'
|
|
3
3
|
import { log } from '@serverless/utils/log.js'
|
|
4
|
-
import {
|
|
4
|
+
import { decodeJwt } from 'jose'
|
|
5
5
|
import {
|
|
6
6
|
formatToClfTime,
|
|
7
7
|
lowerCaseKeys,
|
|
@@ -105,8 +105,8 @@ export default class LambdaProxyIntegrationEventV2 {
|
|
|
105
105
|
|
|
106
106
|
if (token) {
|
|
107
107
|
try {
|
|
108
|
-
claims =
|
|
109
|
-
if (claims
|
|
108
|
+
claims = decodeJwt(token)
|
|
109
|
+
if (claims.scope) {
|
|
110
110
|
scopes = claims.scope.split(' ')
|
|
111
111
|
// In AWS HTTP Api the scope property is removed from the decoded JWT
|
|
112
112
|
// I'm leaving this property because I'm not sure how all of the authorizers
|
|
@@ -129,12 +129,14 @@ export default class LambdaProxyIntegrationEventV2 {
|
|
|
129
129
|
const requestTime = formatToClfTime(received)
|
|
130
130
|
const requestTimeEpoch = received
|
|
131
131
|
|
|
132
|
-
const cookies =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
const cookies = this.#request.state
|
|
133
|
+
? entries(this.#request.state).flatMap(([key, value]) => {
|
|
134
|
+
if (isArray(value)) {
|
|
135
|
+
return value.map((v) => `${key}=${v}`)
|
|
136
|
+
}
|
|
137
|
+
return `${key}=${value}`
|
|
138
|
+
})
|
|
139
|
+
: undefined
|
|
138
140
|
|
|
139
141
|
return {
|
|
140
142
|
body,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer'
|
|
2
2
|
import { env } from 'node:process'
|
|
3
3
|
import jsEscapeString from 'js-string-escape'
|
|
4
|
-
import {
|
|
4
|
+
import { decodeJwt } from 'jose'
|
|
5
5
|
import {
|
|
6
6
|
createUniqueId,
|
|
7
7
|
isPlainObject,
|
|
@@ -83,10 +83,7 @@ export default class VelocityContext {
|
|
|
83
83
|
|
|
84
84
|
if (token) {
|
|
85
85
|
try {
|
|
86
|
-
|
|
87
|
-
if (claims) {
|
|
88
|
-
assign(authorizer, { claims })
|
|
89
|
-
}
|
|
86
|
+
assign(authorizer, { claims: decodeJwt(token) })
|
|
90
87
|
} catch {
|
|
91
88
|
// Nothing
|
|
92
89
|
}
|