@jcbuisson/express-x 1.5.1 → 1.5.2
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/common-hooks.mjs +0 -17
- package/src/index.mjs +1 -1
package/package.json
CHANGED
package/src/common-hooks.mjs
CHANGED
|
@@ -12,23 +12,6 @@ export async function hashPassword(context) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
export async function authenticate(context) {
|
|
16
|
-
console.log('authenticate hook', context.transport, context.name, context.action, context?.connection?.accessToken)
|
|
17
|
-
return context
|
|
18
|
-
|
|
19
|
-
if (context.transport === 'ws') {
|
|
20
|
-
// for WS transport, just check that connection.accessToken is set and valid
|
|
21
|
-
if (!context?.connection?.accessToken) throw new Error("WS connection is not secured by a JWT access token")
|
|
22
|
-
// TODO: check token validity
|
|
23
|
-
|
|
24
|
-
} else if (context.transport === 'http') {
|
|
25
|
-
// for HTTP transport, check that the associated request has a header with a valid JWT
|
|
26
|
-
// TODO: check headers for access token
|
|
27
|
-
}
|
|
28
|
-
return (context)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
15
|
// remove `field` from `result`
|
|
33
16
|
export function protect(field) {
|
|
34
17
|
return async (context) => {
|