@defra/lis-hubs-infra-access 0.6.0 → 0.7.0-lreg-406.alpha.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/auth/logging.js +14 -14
package/package.json
CHANGED
package/src/auth/logging.js
CHANGED
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
* @param {object} request Hapi request.
|
|
4
4
|
*/
|
|
5
5
|
export function logMissingHubServiceJwt(request) {
|
|
6
|
+
const headerPresent = typeof request.headers?.authorization === 'string'
|
|
7
|
+
|
|
6
8
|
request.logger?.warn?.(
|
|
7
|
-
{
|
|
8
|
-
authorizationHeaderPresent:
|
|
9
|
-
typeof request.headers?.authorization === 'string'
|
|
10
|
-
},
|
|
11
|
-
'Hub service JWT missing or bearer authorization header is malformed'
|
|
9
|
+
`Hub service JWT missing or bearer authorization header is malformed [authorizationHeaderPresent=${headerPresent}]`
|
|
12
10
|
)
|
|
13
11
|
}
|
|
14
12
|
|
|
@@ -18,13 +16,15 @@ export function logMissingHubServiceJwt(request) {
|
|
|
18
16
|
* @param {Error & { code?: string, claim?: string, reason?: string }} error Validation error.
|
|
19
17
|
*/
|
|
20
18
|
export function logInvalidHubServiceJwt(request, error) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
const diagnostics = [
|
|
20
|
+
['code', error?.code],
|
|
21
|
+
['claim', error?.claim],
|
|
22
|
+
['reason', error?.reason],
|
|
23
|
+
['message', error?.message]
|
|
24
|
+
]
|
|
25
|
+
.filter(([, value]) => value !== undefined)
|
|
26
|
+
.map(([name, value]) => `${name}=${value}`)
|
|
27
|
+
.join(' | ')
|
|
28
|
+
|
|
29
|
+
request.logger?.warn?.(`Hub service JWT validation failed [${diagnostics}]`)
|
|
30
30
|
}
|