@3sixty/api-auth-service 0.20.0-next.0 → 0.20.0-next.1

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.
Files changed (73) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +24 -2
  3. package/dist/es/entities/authenticationAuditEntry.js +121 -0
  4. package/dist/es/entities/authenticationAuditEntry.js.map +1 -0
  5. package/dist/es/entities/authenticationRateEntry.js +37 -0
  6. package/dist/es/entities/authenticationRateEntry.js.map +1 -0
  7. package/dist/es/index.js +17 -0
  8. package/dist/es/index.js.map +1 -0
  9. package/dist/es/models/IEntityStorageAuthenticationAuditServiceConfig.js +4 -0
  10. package/dist/es/models/IEntityStorageAuthenticationAuditServiceConfig.js.map +1 -0
  11. package/dist/es/models/IEntityStorageAuthenticationAuditServiceConstructorOptions.js +2 -0
  12. package/dist/es/models/IEntityStorageAuthenticationAuditServiceConstructorOptions.js.map +1 -0
  13. package/dist/es/models/IEntityStorageAuthenticationRateServiceConfig.js +2 -0
  14. package/dist/es/models/IEntityStorageAuthenticationRateServiceConfig.js.map +1 -0
  15. package/dist/es/models/IEntityStorageAuthenticationRateServiceConstructorOptions.js +2 -0
  16. package/dist/es/models/IEntityStorageAuthenticationRateServiceConstructorOptions.js.map +1 -0
  17. package/dist/es/models/ITenantOverrideProcessorConfig.js +4 -0
  18. package/dist/es/models/ITenantOverrideProcessorConfig.js.map +1 -0
  19. package/dist/es/models/ITenantOverrideProcessorConstructorOptions.js +2 -0
  20. package/dist/es/models/ITenantOverrideProcessorConstructorOptions.js.map +1 -0
  21. package/dist/es/processors/tenantOverrideProcessor.js +144 -0
  22. package/dist/es/processors/tenantOverrideProcessor.js.map +1 -0
  23. package/dist/es/restEntryPoints.js +13 -0
  24. package/dist/es/restEntryPoints.js.map +1 -0
  25. package/dist/es/routes/entityStorageAuthenticationAuditRoutes.js +355 -0
  26. package/dist/es/routes/entityStorageAuthenticationAuditRoutes.js.map +1 -0
  27. package/dist/es/schema.js +13 -0
  28. package/dist/es/schema.js.map +1 -0
  29. package/dist/es/services/entityStorageAuthenticationAuditService.js +240 -0
  30. package/dist/es/services/entityStorageAuthenticationAuditService.js.map +1 -0
  31. package/dist/es/services/entityStorageAuthenticationRateService.js +213 -0
  32. package/dist/es/services/entityStorageAuthenticationRateService.js.map +1 -0
  33. package/dist/types/entities/authenticationAuditEntry.d.ts +49 -0
  34. package/dist/types/entities/authenticationRateEntry.d.ts +17 -0
  35. package/dist/types/index.d.ts +14 -0
  36. package/dist/types/models/IEntityStorageAuthenticationAuditServiceConfig.d.ts +9 -0
  37. package/dist/types/models/IEntityStorageAuthenticationAuditServiceConstructorOptions.d.ts +15 -0
  38. package/dist/types/models/IEntityStorageAuthenticationRateServiceConfig.d.ts +10 -0
  39. package/dist/types/models/IEntityStorageAuthenticationRateServiceConstructorOptions.d.ts +25 -0
  40. package/dist/types/models/ITenantOverrideProcessorConfig.d.ts +19 -0
  41. package/dist/types/models/ITenantOverrideProcessorConstructorOptions.d.ts +20 -0
  42. package/dist/types/processors/tenantOverrideProcessor.d.ts +48 -0
  43. package/dist/types/restEntryPoints.d.ts +5 -0
  44. package/dist/types/routes/entityStorageAuthenticationAuditRoutes.d.ts +54 -0
  45. package/dist/types/schema.d.ts +4 -0
  46. package/dist/types/services/entityStorageAuthenticationAuditService.d.ts +72 -0
  47. package/dist/types/services/entityStorageAuthenticationRateService.d.ts +60 -0
  48. package/docs/changelog.md +1633 -0
  49. package/docs/examples.md +137 -0
  50. package/docs/open-api/spec.json +911 -0
  51. package/docs/reference/classes/AuthenticationAuditEntry.md +101 -0
  52. package/docs/reference/classes/AuthenticationRateEntry.md +37 -0
  53. package/docs/reference/classes/EntityStorageAuthenticationAuditService.md +241 -0
  54. package/docs/reference/classes/EntityStorageAuthenticationRateService.md +227 -0
  55. package/docs/reference/classes/TenantOverrideProcessor.md +129 -0
  56. package/docs/reference/functions/authenticationAuditCreate.md +37 -0
  57. package/docs/reference/functions/authenticationAuditGet.md +31 -0
  58. package/docs/reference/functions/authenticationAuditQuery.md +31 -0
  59. package/docs/reference/functions/authenticationAuditRemove.md +31 -0
  60. package/docs/reference/functions/authenticationAuditUpdate.md +31 -0
  61. package/docs/reference/functions/generateRestRoutesAuthenticationAudit.md +25 -0
  62. package/docs/reference/functions/initSchema.md +9 -0
  63. package/docs/reference/index.md +33 -0
  64. package/docs/reference/interfaces/IEntityStorageAuthenticationAuditServiceConfig.md +11 -0
  65. package/docs/reference/interfaces/IEntityStorageAuthenticationAuditServiceConstructorOptions.md +25 -0
  66. package/docs/reference/interfaces/IEntityStorageAuthenticationRateServiceConfig.md +17 -0
  67. package/docs/reference/interfaces/IEntityStorageAuthenticationRateServiceConstructorOptions.md +53 -0
  68. package/docs/reference/interfaces/ITenantOverrideProcessorConfig.md +39 -0
  69. package/docs/reference/interfaces/ITenantOverrideProcessorConstructorOptions.md +39 -0
  70. package/docs/reference/variables/restEntryPoints.md +5 -0
  71. package/docs/reference/variables/tagsAuthenticationAudit.md +5 -0
  72. package/locales/en.json +22 -0
  73. package/package.json +63 -6
@@ -0,0 +1,37 @@
1
+ # Function: authenticationAuditCreate()
2
+
3
+ > **authenticationAuditCreate**(`httpRequestContext`, `componentName`, `request`, `baseRouteName`): `Promise`\<`ICreatedResponse`\>
4
+
5
+ Create an authentication audit entry.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditCreateRequest`
24
+
25
+ The request.
26
+
27
+ ### baseRouteName
28
+
29
+ `string`
30
+
31
+ The base route name to use for the location header.
32
+
33
+ ## Returns
34
+
35
+ `Promise`\<`ICreatedResponse`\>
36
+
37
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: authenticationAuditGet()
2
+
3
+ > **authenticationAuditGet**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IAuditGetResponse`\>
4
+
5
+ Get an authentication audit entry.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditGetRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IAuditGetResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: authenticationAuditQuery()
2
+
3
+ > **authenticationAuditQuery**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IAuditQueryResponse`\>
4
+
5
+ Query authentication audit entries.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditQueryRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IAuditQueryResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: authenticationAuditRemove()
2
+
3
+ > **authenticationAuditRemove**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Remove an authentication audit entry.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditRemoveRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: authenticationAuditUpdate()
2
+
3
+ > **authenticationAuditUpdate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Update an authentication audit entry.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditUpdateRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: generateRestRoutesAuthenticationAudit()
2
+
3
+ > **generateRestRoutesAuthenticationAudit**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
4
+
5
+ The REST routes for authentication audit.
6
+
7
+ ## Parameters
8
+
9
+ ### baseRouteName
10
+
11
+ `string`
12
+
13
+ Prefix to prepend to the paths.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes stored in the ComponentFactory.
20
+
21
+ ## Returns
22
+
23
+ `IRestRoute`\<`any`, `any`\>[]
24
+
25
+ The generated routes.
@@ -0,0 +1,9 @@
1
+ # Function: initSchema()
2
+
3
+ > **initSchema**(): `void`
4
+
5
+ Initialize the schema for the authentication audit and rate services.
6
+
7
+ ## Returns
8
+
9
+ `void`
@@ -0,0 +1,33 @@
1
+ # @3sixty/api-auth-service
2
+
3
+ ## Classes
4
+
5
+ - [AuthenticationAuditEntry](classes/AuthenticationAuditEntry.md)
6
+ - [AuthenticationRateEntry](classes/AuthenticationRateEntry.md)
7
+ - [TenantOverrideProcessor](classes/TenantOverrideProcessor.md)
8
+ - [EntityStorageAuthenticationAuditService](classes/EntityStorageAuthenticationAuditService.md)
9
+ - [EntityStorageAuthenticationRateService](classes/EntityStorageAuthenticationRateService.md)
10
+
11
+ ## Interfaces
12
+
13
+ - [IEntityStorageAuthenticationAuditServiceConfig](interfaces/IEntityStorageAuthenticationAuditServiceConfig.md)
14
+ - [IEntityStorageAuthenticationAuditServiceConstructorOptions](interfaces/IEntityStorageAuthenticationAuditServiceConstructorOptions.md)
15
+ - [IEntityStorageAuthenticationRateServiceConfig](interfaces/IEntityStorageAuthenticationRateServiceConfig.md)
16
+ - [IEntityStorageAuthenticationRateServiceConstructorOptions](interfaces/IEntityStorageAuthenticationRateServiceConstructorOptions.md)
17
+ - [ITenantOverrideProcessorConfig](interfaces/ITenantOverrideProcessorConfig.md)
18
+ - [ITenantOverrideProcessorConstructorOptions](interfaces/ITenantOverrideProcessorConstructorOptions.md)
19
+
20
+ ## Variables
21
+
22
+ - [restEntryPoints](variables/restEntryPoints.md)
23
+ - [tagsAuthenticationAudit](variables/tagsAuthenticationAudit.md)
24
+
25
+ ## Functions
26
+
27
+ - [generateRestRoutesAuthenticationAudit](functions/generateRestRoutesAuthenticationAudit.md)
28
+ - [authenticationAuditCreate](functions/authenticationAuditCreate.md)
29
+ - [authenticationAuditGet](functions/authenticationAuditGet.md)
30
+ - [authenticationAuditUpdate](functions/authenticationAuditUpdate.md)
31
+ - [authenticationAuditRemove](functions/authenticationAuditRemove.md)
32
+ - [authenticationAuditQuery](functions/authenticationAuditQuery.md)
33
+ - [initSchema](functions/initSchema.md)
@@ -0,0 +1,11 @@
1
+ # Interface: IEntityStorageAuthenticationAuditServiceConfig
2
+
3
+ Config for the EntityStorageAuthenticationAuditService constructor.
4
+
5
+ ## Properties
6
+
7
+ ### ipHashSalt? {#iphashsalt}
8
+
9
+ > `optional` **ipHashSalt?**: `string`
10
+
11
+ The server-side salt for hashing IP addresses in audit logs, if configured.
@@ -0,0 +1,25 @@
1
+ # Interface: IEntityStorageAuthenticationAuditServiceConstructorOptions
2
+
3
+ Options for the EntityStorageAuthenticationAuditService constructor.
4
+
5
+ ## Properties
6
+
7
+ ### authenticationAuditEntryStorageType? {#authenticationauditentrystoragetype}
8
+
9
+ > `optional` **authenticationAuditEntryStorageType?**: `string`
10
+
11
+ The entity storage for the audit entries.
12
+
13
+ #### Default
14
+
15
+ ```ts
16
+ authentication-audit-entry
17
+ ```
18
+
19
+ ***
20
+
21
+ ### config? {#config}
22
+
23
+ > `optional` **config?**: [`IEntityStorageAuthenticationAuditServiceConfig`](IEntityStorageAuthenticationAuditServiceConfig.md)
24
+
25
+ The configuration for the authentication audit service.
@@ -0,0 +1,17 @@
1
+ # Interface: IEntityStorageAuthenticationRateServiceConfig
2
+
3
+ Configuration for the entity storage authentication rate service.
4
+
5
+ ## Properties
6
+
7
+ ### cleanupIntervalMinutes? {#cleanupintervalminutes}
8
+
9
+ > `optional` **cleanupIntervalMinutes?**: `number`
10
+
11
+ Interval between cleanup runs in minutes.
12
+
13
+ #### Default
14
+
15
+ ```ts
16
+ 5
17
+ ```
@@ -0,0 +1,53 @@
1
+ # Interface: IEntityStorageAuthenticationRateServiceConstructorOptions
2
+
3
+ Options for the EntityStorageAuthenticationRateService constructor.
4
+
5
+ ## Properties
6
+
7
+ ### authenticationRateEntryStorageType? {#authenticationrateentrystoragetype}
8
+
9
+ > `optional` **authenticationRateEntryStorageType?**: `string`
10
+
11
+ The entity storage for authentication rate entries.
12
+
13
+ #### Default
14
+
15
+ ```ts
16
+ authentication-rate-entry
17
+ ```
18
+
19
+ ***
20
+
21
+ ### taskSchedulerComponentType? {#taskschedulercomponenttype}
22
+
23
+ > `optional` **taskSchedulerComponentType?**: `string`
24
+
25
+ The task scheduler component type.
26
+
27
+ #### Default
28
+
29
+ ```ts
30
+ task-scheduler
31
+ ```
32
+
33
+ ***
34
+
35
+ ### platformComponentType? {#platformcomponenttype}
36
+
37
+ > `optional` **platformComponentType?**: `string`
38
+
39
+ The platform component type, used to run the periodic cleanup per tenant.
40
+
41
+ #### Default
42
+
43
+ ```ts
44
+ platform
45
+ ```
46
+
47
+ ***
48
+
49
+ ### config? {#config}
50
+
51
+ > `optional` **config?**: [`IEntityStorageAuthenticationRateServiceConfig`](IEntityStorageAuthenticationRateServiceConfig.md)
52
+
53
+ The configuration for the authentication rate service.
@@ -0,0 +1,39 @@
1
+ # Interface: ITenantOverrideProcessorConfig
2
+
3
+ Configuration for the TenantOverrideProcessor.
4
+
5
+ ## Properties
6
+
7
+ ### includeErrorStack? {#includeerrorstack}
8
+
9
+ > `optional` **includeErrorStack?**: `boolean`
10
+
11
+ Include the stack with errors.
12
+
13
+ ***
14
+
15
+ ### escalatedPrivilegeRole? {#escalatedprivilegerole}
16
+
17
+ > `optional` **escalatedPrivilegeRole?**: `string`
18
+
19
+ The role value that grants escalated privilege for cross-tenant access.
20
+
21
+ #### Default
22
+
23
+ ```ts
24
+ global-admin
25
+ ```
26
+
27
+ ***
28
+
29
+ ### authorizationModelId? {#authorizationmodelid}
30
+
31
+ > `optional` **authorizationModelId?**: `string`
32
+
33
+ The authorization model ID to use for REST requests.
34
+
35
+ #### Default
36
+
37
+ ```ts
38
+ system
39
+ ```
@@ -0,0 +1,39 @@
1
+ # Interface: ITenantOverrideProcessorConstructorOptions
2
+
3
+ Options for the TenantOverrideProcessor constructor.
4
+
5
+ ## Properties
6
+
7
+ ### tenantAdminComponentType? {#tenantadmincomponenttype}
8
+
9
+ > `optional` **tenantAdminComponentType?**: `string`
10
+
11
+ The tenant admin component type.
12
+
13
+ #### Default
14
+
15
+ ```ts
16
+ tenant-admin
17
+ ```
18
+
19
+ ***
20
+
21
+ ### authorizationComponentType? {#authorizationcomponenttype}
22
+
23
+ > `optional` **authorizationComponentType?**: `string`
24
+
25
+ The authorization component type.
26
+
27
+ #### Default
28
+
29
+ ```ts
30
+ authorization
31
+ ```
32
+
33
+ ***
34
+
35
+ ### config? {#config}
36
+
37
+ > `optional` **config?**: [`ITenantOverrideProcessorConfig`](ITenantOverrideProcessorConfig.md)
38
+
39
+ Configuration for the processor.
@@ -0,0 +1,5 @@
1
+ # Variable: restEntryPoints
2
+
3
+ > `const` **restEntryPoints**: `IRestRouteEntryPoint`[]
4
+
5
+ REST entry points for the authentication audit service.
@@ -0,0 +1,5 @@
1
+ # Variable: tagsAuthenticationAudit
2
+
3
+ > `const` **tagsAuthenticationAudit**: `ITag`[]
4
+
5
+ The tag to associate with the routes.
@@ -0,0 +1,22 @@
1
+ {
2
+ "error": {
3
+ "entityStorageAuthenticationAuditService": {
4
+ "auditEntryNotFound": "The audit entry with the specified identifier could not be found \"{notFoundId}\"",
5
+ "getAuditEntryFailed": "Getting the audit entry failed",
6
+ "updateAuditEntryFailed": "Updating the audit entry failed",
7
+ "removeAuditEntryFailed": "Removing the audit entry failed"
8
+ },
9
+ "entityStorageAuthenticationRateService": {
10
+ "actionConfigMissing": "No rate-limit configuration exists for action \"{action}\".",
11
+ "rateLimitExceeded": "The rate limit for action \"{action}\" has been exceeded. Retry after {retryAfterSeconds} seconds."
12
+ },
13
+ "validation": {
14
+ "saltEntropyTooLow": "Salt must have at least 8 unique characters for sufficient entropy."
15
+ },
16
+ "tenantOverrideProcessor": {
17
+ "insufficientRoleForTenantOverride": "Caller does not hold the required role for tenant override.",
18
+ "missingUserIdForTenantOverride": "Missing user id for tenant override.",
19
+ "tenantNotFound": "Tenant \"{notFoundId}\" not found."
20
+ }
21
+ }
22
+ }
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
- {
2
- "name": "@3sixty/api-auth-service",
3
- "version": "0.20.0-next.0",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@3sixty/api-auth-service",
3
+ "version": "0.20.0-next.1",
4
+ "description": "Authentication audit and rate limiting services, tenant override processing and audit REST routes backed by entity storage.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/3sixtyglobal/api-auth.git",
8
+ "directory": "packages/api-auth-service"
9
+ },
10
+ "author": "martyn.janes@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=24.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@3sixty/api-auth-models": "0.20.0-next.1",
18
+ "@3sixty/api-models": "next",
19
+ "@3sixty/authorization-models": "next",
20
+ "@3sixty/background-task-models": "next",
21
+ "@3sixty/context": "next",
22
+ "@3sixty/core": "next",
23
+ "@3sixty/crypto": "next",
24
+ "@3sixty/entity": "next",
25
+ "@3sixty/entity-storage-models": "next",
26
+ "@3sixty/nameof": "next",
27
+ "@3sixty/web": "next"
28
+ },
29
+ "main": "./dist/es/index.js",
30
+ "types": "./dist/types/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/types/index.d.ts",
34
+ "import": "./dist/es/index.js",
35
+ "default": "./dist/es/index.js"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist/es",
40
+ "dist/types",
41
+ "locales",
42
+ "docs"
43
+ ],
44
+ "keywords": [
45
+ "twin",
46
+ "trade",
47
+ "iota",
48
+ "framework",
49
+ "blockchain",
50
+ "api",
51
+ "entity",
52
+ "storage",
53
+ "persistence",
54
+ "database",
55
+ "service",
56
+ "microservice",
57
+ "business-logic"
58
+ ],
59
+ "bugs": {
60
+ "url": "git+https://github.com/3sixtyglobal/api-auth/issues"
61
+ },
62
+ "homepage": "https://3sixty.global"
63
+ }