@defra/lis-hubs-infra-access 0.11.0 → 0.12.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/package.json +2 -2
- package/src/auth/logging.js +5 -4
- package/src/auth/plugin.js +3 -1
- package/src/auth/tokens/jwt.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra/lis-hubs-infra-access",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Shared hub access and capability resolution for the livestock platform.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"author": "Defra DDTS",
|
|
34
34
|
"license": "OGL-UK-3.0",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@defra/lis-hubs-infra-core": "^0.
|
|
36
|
+
"@defra/lis-hubs-infra-core": "^0.4.0",
|
|
37
37
|
"@defra/lis-hubs-infra-registry": "^0.1.0",
|
|
38
38
|
"jose": "6.2.8",
|
|
39
39
|
"eslint-plugin-jsdoc": "^63.0.8",
|
package/src/auth/logging.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { logger } from '@defra/lis-hubs-infra-core'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Logs the absence of a usable hub-service bearer token without logging credentials.
|
|
3
5
|
* @param {object} request Hapi request.
|
|
@@ -5,17 +7,16 @@
|
|
|
5
7
|
export function logMissingHubServiceJwt(request) {
|
|
6
8
|
const headerPresent = typeof request.headers?.authorization === 'string'
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
logger.warn(
|
|
9
11
|
`Hub service JWT missing or bearer authorization header is malformed [authorizationHeaderPresent=${headerPresent}]`
|
|
10
12
|
)
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Logs safe JWT validation diagnostics without logging credentials or claims.
|
|
15
|
-
* @param {object} request Hapi request.
|
|
16
17
|
* @param {Error & { code?: string, claim?: string, reason?: string }} error Validation error.
|
|
17
18
|
*/
|
|
18
|
-
export function logInvalidHubServiceJwt(
|
|
19
|
+
export function logInvalidHubServiceJwt(error) {
|
|
19
20
|
const diagnostics = [
|
|
20
21
|
['code', error?.code],
|
|
21
22
|
['claim', error?.claim],
|
|
@@ -26,5 +27,5 @@ export function logInvalidHubServiceJwt(request, error) {
|
|
|
26
27
|
.map(([name, value]) => `${name}=${value}`)
|
|
27
28
|
.join(' | ')
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
logger.warn(`Hub service JWT validation failed [${diagnostics}]`)
|
|
30
31
|
}
|
package/src/auth/plugin.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { logger } from '@defra/lis-hubs-infra-core'
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
clearHubAuthSession,
|
|
3
5
|
getHubAuthSession,
|
|
@@ -48,7 +50,7 @@ function createLoginController({
|
|
|
48
50
|
} catch (error) {
|
|
49
51
|
const cause =
|
|
50
52
|
error?.cause?.message ?? error?.cause?.code ?? error?.cause
|
|
51
|
-
|
|
53
|
+
logger.error(
|
|
52
54
|
error,
|
|
53
55
|
`Failed to build OIDC authorization URL [cause=${cause}]`
|
|
54
56
|
)
|