@3sixty/api-auth-entity-storage-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 (108) hide show
  1. package/README.md +1 -1
  2. package/dist/es/entities/authenticationUser.js +1 -9
  3. package/dist/es/entities/authenticationUser.js.map +1 -1
  4. package/dist/es/entities/authenticationUserV0.js +69 -0
  5. package/dist/es/entities/authenticationUserV0.js.map +1 -0
  6. package/dist/es/index.js +1 -9
  7. package/dist/es/index.js.map +1 -1
  8. package/dist/es/models/IAuthHeaderProcessorConfig.js.map +1 -1
  9. package/dist/es/models/IAuthHeaderProcessorConstructorOptions.js.map +1 -1
  10. package/dist/es/models/IAuthTokenContext.js.map +1 -1
  11. package/dist/es/models/IEntityStorageAuthenticationAdminServiceConfig.js.map +1 -1
  12. package/dist/es/models/IEntityStorageAuthenticationAdminServiceConstructorOptions.js.map +1 -1
  13. package/dist/es/models/IEntityStorageAuthenticationServiceConfig.js.map +1 -1
  14. package/dist/es/models/IEntityStorageAuthenticationServiceConstructorOptions.js.map +1 -1
  15. package/dist/es/processors/authHeaderProcessor.js +9 -14
  16. package/dist/es/processors/authHeaderProcessor.js.map +1 -1
  17. package/dist/es/restEntryPoints.js +1 -8
  18. package/dist/es/restEntryPoints.js.map +1 -1
  19. package/dist/es/routes/entityStorageAuthenticationAdminRoutes.js +22 -14
  20. package/dist/es/routes/entityStorageAuthenticationAdminRoutes.js.map +1 -1
  21. package/dist/es/routes/entityStorageAuthenticationRoutes.js +45 -1
  22. package/dist/es/routes/entityStorageAuthenticationRoutes.js.map +1 -1
  23. package/dist/es/schema.js +2 -4
  24. package/dist/es/schema.js.map +1 -1
  25. package/dist/es/services/entityStorageAuthenticationAdminService.js +69 -68
  26. package/dist/es/services/entityStorageAuthenticationAdminService.js.map +1 -1
  27. package/dist/es/services/entityStorageAuthenticationService.js +29 -17
  28. package/dist/es/services/entityStorageAuthenticationService.js.map +1 -1
  29. package/dist/es/utils/passwordHelper.js +7 -5
  30. package/dist/es/utils/passwordHelper.js.map +1 -1
  31. package/dist/es/utils/tokenHelper.js +2 -23
  32. package/dist/es/utils/tokenHelper.js.map +1 -1
  33. package/dist/types/entities/authenticationUser.d.ts +0 -4
  34. package/dist/types/entities/authenticationUserV0.d.ts +33 -0
  35. package/dist/types/index.d.ts +1 -9
  36. package/dist/types/models/IAuthHeaderProcessorConfig.d.ts +1 -2
  37. package/dist/types/models/IAuthTokenContext.d.ts +0 -4
  38. package/dist/types/models/IEntityStorageAuthenticationAdminServiceConfig.d.ts +14 -3
  39. package/dist/types/models/IEntityStorageAuthenticationAdminServiceConstructorOptions.d.ts +6 -1
  40. package/dist/types/models/IEntityStorageAuthenticationServiceConfig.d.ts +7 -2
  41. package/dist/types/restEntryPoints.d.ts +1 -1
  42. package/dist/types/routes/entityStorageAuthenticationRoutes.d.ts +10 -2
  43. package/dist/types/services/entityStorageAuthenticationAdminService.d.ts +6 -2
  44. package/dist/types/services/entityStorageAuthenticationService.d.ts +6 -1
  45. package/dist/types/utils/passwordHelper.d.ts +6 -3
  46. package/dist/types/utils/tokenHelper.d.ts +2 -11
  47. package/docs/changelog.md +19 -0
  48. package/docs/examples.md +9 -93
  49. package/docs/open-api/spec.json +178 -956
  50. package/docs/reference/classes/AuthHeaderProcessor.md +4 -0
  51. package/docs/reference/classes/AuthenticationUser.md +0 -8
  52. package/docs/reference/classes/AuthenticationUserV0.md +69 -0
  53. package/docs/reference/classes/EntityStorageAuthenticationAdminService.md +11 -3
  54. package/docs/reference/classes/EntityStorageAuthenticationService.md +18 -0
  55. package/docs/reference/classes/PasswordHelper.md +4 -4
  56. package/docs/reference/classes/TokenHelper.md +2 -44
  57. package/docs/reference/functions/authenticationPasswordPolicy.md +31 -0
  58. package/docs/reference/index.md +2 -15
  59. package/docs/reference/interfaces/IAuthHeaderProcessorConfig.md +1 -2
  60. package/docs/reference/interfaces/IAuthTokenContext.md +0 -8
  61. package/docs/reference/interfaces/IEntityStorageAuthenticationAdminServiceConfig.md +38 -4
  62. package/docs/reference/interfaces/IEntityStorageAuthenticationAdminServiceConstructorOptions.md +15 -1
  63. package/docs/reference/interfaces/IEntityStorageAuthenticationServiceConfig.md +15 -1
  64. package/docs/reference/variables/restEntryPoints.md +1 -1
  65. package/locales/en.json +1 -16
  66. package/package.json +7 -8
  67. package/dist/es/entities/authenticationAuditEntry.js +0 -121
  68. package/dist/es/entities/authenticationAuditEntry.js.map +0 -1
  69. package/dist/es/entities/authenticationRateEntry.js +0 -37
  70. package/dist/es/entities/authenticationRateEntry.js.map +0 -1
  71. package/dist/es/models/IEntityStorageAuthenticationAuditServiceConfig.js +0 -4
  72. package/dist/es/models/IEntityStorageAuthenticationAuditServiceConfig.js.map +0 -1
  73. package/dist/es/models/IEntityStorageAuthenticationAuditServiceConstructorOptions.js +0 -2
  74. package/dist/es/models/IEntityStorageAuthenticationAuditServiceConstructorOptions.js.map +0 -1
  75. package/dist/es/models/IEntityStorageAuthenticationRateServiceConfig.js +0 -2
  76. package/dist/es/models/IEntityStorageAuthenticationRateServiceConfig.js.map +0 -1
  77. package/dist/es/models/IEntityStorageAuthenticationRateServiceConstructorOptions.js +0 -2
  78. package/dist/es/models/IEntityStorageAuthenticationRateServiceConstructorOptions.js.map +0 -1
  79. package/dist/es/routes/entityStorageAuthenticationAuditRoutes.js +0 -343
  80. package/dist/es/routes/entityStorageAuthenticationAuditRoutes.js.map +0 -1
  81. package/dist/es/services/entityStorageAuthenticationAuditService.js +0 -240
  82. package/dist/es/services/entityStorageAuthenticationAuditService.js.map +0 -1
  83. package/dist/es/services/entityStorageAuthenticationRateService.js +0 -213
  84. package/dist/es/services/entityStorageAuthenticationRateService.js.map +0 -1
  85. package/dist/types/entities/authenticationAuditEntry.d.ts +0 -49
  86. package/dist/types/entities/authenticationRateEntry.d.ts +0 -17
  87. package/dist/types/models/IEntityStorageAuthenticationAuditServiceConfig.d.ts +0 -9
  88. package/dist/types/models/IEntityStorageAuthenticationAuditServiceConstructorOptions.d.ts +0 -15
  89. package/dist/types/models/IEntityStorageAuthenticationRateServiceConfig.d.ts +0 -10
  90. package/dist/types/models/IEntityStorageAuthenticationRateServiceConstructorOptions.d.ts +0 -25
  91. package/dist/types/routes/entityStorageAuthenticationAuditRoutes.d.ts +0 -54
  92. package/dist/types/services/entityStorageAuthenticationAuditService.d.ts +0 -72
  93. package/dist/types/services/entityStorageAuthenticationRateService.d.ts +0 -60
  94. package/docs/reference/classes/AuthenticationAuditEntry.md +0 -101
  95. package/docs/reference/classes/AuthenticationRateEntry.md +0 -37
  96. package/docs/reference/classes/EntityStorageAuthenticationAuditService.md +0 -241
  97. package/docs/reference/classes/EntityStorageAuthenticationRateService.md +0 -227
  98. package/docs/reference/functions/authenticationAuditCreate.md +0 -37
  99. package/docs/reference/functions/authenticationAuditGet.md +0 -31
  100. package/docs/reference/functions/authenticationAuditQuery.md +0 -31
  101. package/docs/reference/functions/authenticationAuditRemove.md +0 -31
  102. package/docs/reference/functions/authenticationAuditUpdate.md +0 -31
  103. package/docs/reference/functions/generateRestRoutesAuthenticationAudit.md +0 -25
  104. package/docs/reference/interfaces/IEntityStorageAuthenticationAuditServiceConfig.md +0 -11
  105. package/docs/reference/interfaces/IEntityStorageAuthenticationAuditServiceConstructorOptions.md +0 -25
  106. package/docs/reference/interfaces/IEntityStorageAuthenticationRateServiceConfig.md +0 -17
  107. package/docs/reference/interfaces/IEntityStorageAuthenticationRateServiceConstructorOptions.md +0 -53
  108. package/docs/reference/variables/tagsAuthenticationAudit.md +0 -5
@@ -1 +0,0 @@
1
- {"version":3,"file":"authenticationAuditEntry.js","sourceRoot":"","sources":["../../../src/entities/authenticationAuditEntry.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEjE;;GAEG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB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CAAC;;wDACzD;AAMhB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gEACjD;AAWxB;IANN,QAAQ,CAAC;QACT,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,IAAI;QACjB,QAAQ,EAAE,IAAI;KACd,CAAC;;0DACuB;AAMlB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iEACV;AAM3B;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2DACpC;AAMnB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+DAC/B;AAMvB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACvB;AArFV,wBAAwB;IADpC,MAAM,EAAE;GACI,wBAAwB,CAsFpC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { SortDirection, entity, property } from \"@3sixty/entity\";\n\n/**\n * Class defining the storage for authentication audit entries.\n */\n@entity()\nexport class AuthenticationAuditEntry {\n\t/**\n\t * The unique identifier for the audit entry.\n\t */\n\t@property({ type: \"string\", isPrimary: true, maxLength: 255 })\n\tpublic id!: string;\n\n\t/**\n\t * The timestamp of the audit entry in ISO 8601 format.\n\t */\n\t@property({\n\t\ttype: \"string\",\n\t\tformat: \"date-time\",\n\t\tisSecondary: true,\n\t\tindexGroup: [{ name: \"actorDate\", direction: SortDirection.Descending, index: 1 }]\n\t})\n\tpublic dateCreated!: string;\n\n\t/**\n\t * The audit event that occurred.\n\t */\n\t@property({\n\t\ttype: \"string\",\n\t\tmaxLength: 128,\n\t\tisSecondary: true\n\t})\n\tpublic event!: string;\n\n\t/**\n\t * The actor identifier, could be e-mail, username, or other unique identifier.\n\t */\n\t@property({\n\t\ttype: \"string\",\n\t\tmaxLength: 255,\n\t\tisSecondary: true,\n\t\toptional: true,\n\t\tindexGroup: [{ name: \"actorDate\", direction: SortDirection.Ascending, index: 0 }]\n\t})\n\tpublic actorId?: string;\n\n\t/**\n\t * The node identifier associated with the audit entry, if applicable.\n\t */\n\t@property({ type: \"string\", maxLength: 255, isSecondary: true, optional: true })\n\tpublic nodeId?: string;\n\n\t/**\n\t * The organization identifier associated with the audit entry, if applicable.\n\t */\n\t@property({ type: \"string\", maxLength: 255, isSecondary: true, optional: true })\n\tpublic organizationId?: string;\n\n\t/**\n\t * The tenant identifier associated with the audit entry, if applicable.\n\t */\n\t@property({\n\t\ttype: \"string\",\n\t\tmaxLength: 255,\n\t\tisSecondary: true,\n\t\toptional: true\n\t})\n\tpublic tenantId?: string;\n\n\t/**\n\t * The hashed IP addresses of the client.\n\t */\n\t@property({ type: \"array\", optional: true })\n\tpublic ipAddressHashes?: string[];\n\n\t/**\n\t * The user agent string of the client.\n\t */\n\t@property({ type: \"string\", maxLength: 1024, optional: true })\n\tpublic userAgent?: string;\n\n\t/**\n\t * The correlation ID for request tracing.\n\t */\n\t@property({ type: \"string\", maxLength: 255, optional: true })\n\tpublic correlationId?: string;\n\n\t/**\n\t * Additional data related to the audit entry, such as IP address, user agent, etc.\n\t */\n\t@property({ type: \"object\", optional: true })\n\tpublic data?: unknown;\n}\n"]}
@@ -1,37 +0,0 @@
1
- // Copyright 2026 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
- import { entity, property } from "@3sixty/entity";
4
- /**
5
- * Class defining the storage for authentication rate entries.
6
- */
7
- let AuthenticationRateEntry = class AuthenticationRateEntry {
8
- /**
9
- * The id for the rate entry.
10
- */
11
- id;
12
- /**
13
- * Array of ISO date strings representing timestamps of failed attempts.
14
- */
15
- timestamps;
16
- /**
17
- * Last modification time in ISO date format.
18
- */
19
- dateModified;
20
- };
21
- __decorate([
22
- property({ type: "string", isPrimary: true, maxLength: 255 }),
23
- __metadata("design:type", String)
24
- ], AuthenticationRateEntry.prototype, "id", void 0);
25
- __decorate([
26
- property({ type: "array", itemType: "string" }),
27
- __metadata("design:type", Array)
28
- ], AuthenticationRateEntry.prototype, "timestamps", void 0);
29
- __decorate([
30
- property({ type: "string", format: "date-time" }),
31
- __metadata("design:type", String)
32
- ], AuthenticationRateEntry.prototype, "dateModified", void 0);
33
- AuthenticationRateEntry = __decorate([
34
- entity()
35
- ], AuthenticationRateEntry);
36
- export { AuthenticationRateEntry };
37
- //# sourceMappingURL=authenticationRateEntry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authenticationRateEntry.js","sourceRoot":"","sources":["../../../src/entities/authenticationRateEntry.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IACnC;;OAEG;IAEI,EAAE,CAAU;IAEnB;;OAEG;IAEI,UAAU,CAAY;IAE7B;;OAEG;IAEI,YAAY,CAAU;CAC7B,CAAA;AAbO;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;;mDAC3C;AAMZ;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;;2DACnB;AAMtB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;;6DACrB;AAjBjB,uBAAuB;IADnC,MAAM,EAAE;GACI,uBAAuB,CAkBnC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { entity, property } from \"@3sixty/entity\";\n\n/**\n * Class defining the storage for authentication rate entries.\n */\n@entity()\nexport class AuthenticationRateEntry {\n\t/**\n\t * The id for the rate entry.\n\t */\n\t@property({ type: \"string\", isPrimary: true, maxLength: 255 })\n\tpublic id!: string;\n\n\t/**\n\t * Array of ISO date strings representing timestamps of failed attempts.\n\t */\n\t@property({ type: \"array\", itemType: \"string\" })\n\tpublic timestamps!: string[];\n\n\t/**\n\t * Last modification time in ISO date format.\n\t */\n\t@property({ type: \"string\", format: \"date-time\" })\n\tpublic dateModified!: string;\n}\n"]}
@@ -1,4 +0,0 @@
1
- // Copyright 2026 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
- export {};
4
- //# sourceMappingURL=IEntityStorageAuthenticationAuditServiceConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IEntityStorageAuthenticationAuditServiceConfig.js","sourceRoot":"","sources":["../../../src/models/IEntityStorageAuthenticationAuditServiceConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Config for the EntityStorageAuthenticationAuditService constructor.\n */\nexport interface IEntityStorageAuthenticationAuditServiceConfig {\n\t/**\n\t * The server-side salt for hashing IP addresses in audit logs, if configured.\n\t */\n\tipHashSalt?: string;\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=IEntityStorageAuthenticationAuditServiceConstructorOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IEntityStorageAuthenticationAuditServiceConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IEntityStorageAuthenticationAuditServiceConstructorOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEntityStorageAuthenticationAuditServiceConfig } from \"./IEntityStorageAuthenticationAuditServiceConfig.js\";\n\n/**\n * Options for the EntityStorageAuthenticationAuditService constructor.\n */\nexport interface IEntityStorageAuthenticationAuditServiceConstructorOptions {\n\t/**\n\t * The entity storage for the audit entries.\n\t * @default authentication-audit-entry\n\t */\n\tauthenticationAuditEntryStorageType?: string;\n\n\t/**\n\t * The configuration for the authentication audit service.\n\t */\n\tconfig?: IEntityStorageAuthenticationAuditServiceConfig;\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=IEntityStorageAuthenticationRateServiceConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IEntityStorageAuthenticationRateServiceConfig.js","sourceRoot":"","sources":["../../../src/models/IEntityStorageAuthenticationRateServiceConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n/**\n * Configuration for the entity storage authentication rate service.\n */\nexport interface IEntityStorageAuthenticationRateServiceConfig {\n\t/**\n\t * Interval between cleanup runs in minutes.\n\t * @default 5\n\t */\n\tcleanupIntervalMinutes?: number;\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=IEntityStorageAuthenticationRateServiceConstructorOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IEntityStorageAuthenticationRateServiceConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/IEntityStorageAuthenticationRateServiceConstructorOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEntityStorageAuthenticationRateServiceConfig } from \"./IEntityStorageAuthenticationRateServiceConfig.js\";\n\n/**\n * Options for the EntityStorageAuthenticationRateService constructor.\n */\nexport interface IEntityStorageAuthenticationRateServiceConstructorOptions {\n\t/**\n\t * The entity storage for authentication rate entries.\n\t * @default authentication-rate-entry\n\t */\n\tauthenticationRateEntryStorageType?: string;\n\n\t/**\n\t * The task scheduler component type.\n\t * @default task-scheduler\n\t */\n\ttaskSchedulerComponentType?: string;\n\n\t/**\n\t * The platform component type, used to run the periodic cleanup per tenant.\n\t * @default platform\n\t */\n\tplatformComponentType?: string;\n\n\t/**\n\t * The configuration for the authentication rate service.\n\t */\n\tconfig?: IEntityStorageAuthenticationRateServiceConfig;\n}\n"]}
@@ -1,343 +0,0 @@
1
- import { HttpContextIdKeys, HttpHeaderHelper, HttpUrlHelper } from "@3sixty/api-models";
2
- import { ContextIdStore } from "@3sixty/context";
3
- import { Coerce, ComponentFactory, Guards } from "@3sixty/core";
4
- import { HeaderTypes, HttpStatusCode } from "@3sixty/web";
5
- /**
6
- * The source used when communicating about these routes.
7
- */
8
- const ROUTES_SOURCE = "authenticationAuditRoutes";
9
- /**
10
- * The tag to associate with the routes.
11
- */
12
- export const tagsAuthenticationAudit = [
13
- {
14
- name: "Authentication Audit",
15
- description: "Authentication audit endpoints for the REST server."
16
- }
17
- ];
18
- /**
19
- * The REST routes for authentication audit.
20
- * @param baseRouteName Prefix to prepend to the paths.
21
- * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
22
- * @returns The generated routes.
23
- */
24
- export function generateRestRoutesAuthenticationAudit(baseRouteName, componentName) {
25
- const createRoute = {
26
- operationId: "authenticationAuditCreate",
27
- summary: "Create an authentication audit entry",
28
- tag: tagsAuthenticationAudit[0].name,
29
- method: "POST",
30
- path: `${baseRouteName}`,
31
- handler: async (httpRequestContext, request) => authenticationAuditCreate(httpRequestContext, componentName, request, baseRouteName),
32
- requestType: {
33
- type: "IAuditCreateRequest",
34
- examples: [
35
- {
36
- id: "authenticationAuditCreateRequestExample",
37
- description: "The request to create an authentication audit entry.",
38
- request: {
39
- body: {
40
- actorId: "user@example.com",
41
- event: "login-success",
42
- data: {
43
- organizationIdentity: "did:example:org1"
44
- }
45
- }
46
- }
47
- }
48
- ]
49
- },
50
- responseType: [
51
- {
52
- type: "ICreatedResponse",
53
- examples: [
54
- {
55
- id: "authenticationAuditCreateResponseExample",
56
- description: "The response for creating an authentication audit entry.",
57
- response: {
58
- statusCode: 201,
59
- headers: {
60
- [HeaderTypes.Location]: "018f0b53d5d5704fa3a06d6ed2478575"
61
- }
62
- }
63
- }
64
- ]
65
- },
66
- {
67
- type: "IUnauthorizedResponse"
68
- }
69
- ],
70
- requiredScope: ["user-admin"]
71
- };
72
- const getRoute = {
73
- operationId: "authenticationAuditGet",
74
- summary: "Get an authentication audit entry",
75
- tag: tagsAuthenticationAudit[0].name,
76
- method: "GET",
77
- path: `${baseRouteName}/:id`,
78
- handler: async (httpRequestContext, request) => authenticationAuditGet(httpRequestContext, componentName, request),
79
- requestType: {
80
- type: "IAuditGetRequest",
81
- examples: [
82
- {
83
- id: "authenticationAuditGetRequestExample",
84
- description: "The request to get an authentication audit entry.",
85
- request: {
86
- pathParams: {
87
- id: "018f0b53d5d5704fa3a06d6ed2478575"
88
- }
89
- }
90
- }
91
- ]
92
- },
93
- responseType: [
94
- {
95
- type: "IAuditGetResponse",
96
- examples: [
97
- {
98
- id: "authenticationAuditGetResponseExample",
99
- description: "The response for getting an authentication audit entry.",
100
- response: {
101
- body: {
102
- id: "018f0b53d5d5704fa3a06d6ed2478575",
103
- actorId: "user@example.com",
104
- dateCreated: "2026-01-12T09:05:23.123Z",
105
- event: "login-success",
106
- data: {
107
- organizationIdentity: "did:example:org1"
108
- }
109
- }
110
- }
111
- }
112
- ]
113
- },
114
- {
115
- type: "IUnauthorizedResponse"
116
- }
117
- ],
118
- requiredScope: ["user-admin"]
119
- };
120
- const updateRoute = {
121
- operationId: "authenticationAuditUpdate",
122
- summary: "Update an authentication audit entry",
123
- tag: tagsAuthenticationAudit[0].name,
124
- method: "PUT",
125
- path: `${baseRouteName}/:id`,
126
- handler: async (httpRequestContext, request) => authenticationAuditUpdate(httpRequestContext, componentName, request),
127
- requestType: {
128
- type: "IAuditUpdateRequest",
129
- examples: [
130
- {
131
- id: "authenticationAuditUpdateRequestExample",
132
- description: "The request to update an authentication audit entry.",
133
- request: {
134
- pathParams: {
135
- id: "018f0b53d5d5704fa3a06d6ed2478575"
136
- },
137
- body: {
138
- data: {
139
- organizationIdentity: "did:example:org1"
140
- }
141
- }
142
- }
143
- }
144
- ]
145
- },
146
- responseType: [
147
- {
148
- type: "INoContentResponse"
149
- },
150
- {
151
- type: "IUnauthorizedResponse"
152
- }
153
- ],
154
- requiredScope: ["user-admin"]
155
- };
156
- const removeRoute = {
157
- operationId: "authenticationAuditRemove",
158
- summary: "Remove an authentication audit entry",
159
- tag: tagsAuthenticationAudit[0].name,
160
- method: "DELETE",
161
- path: `${baseRouteName}/:id`,
162
- handler: async (httpRequestContext, request) => authenticationAuditRemove(httpRequestContext, componentName, request),
163
- requestType: {
164
- type: "IAuditRemoveRequest",
165
- examples: [
166
- {
167
- id: "authenticationAuditRemoveRequestExample",
168
- description: "The request to remove an authentication audit entry.",
169
- request: {
170
- pathParams: {
171
- id: "018f0b53d5d5704fa3a06d6ed2478575"
172
- }
173
- }
174
- }
175
- ]
176
- },
177
- responseType: [
178
- {
179
- type: "INoContentResponse"
180
- },
181
- {
182
- type: "IUnauthorizedResponse"
183
- }
184
- ],
185
- requiredScope: ["user-admin"]
186
- };
187
- const queryRoute = {
188
- operationId: "authenticationAuditQuery",
189
- summary: "Query authentication audit entries",
190
- tag: tagsAuthenticationAudit[0].name,
191
- method: "GET",
192
- path: `${baseRouteName}`,
193
- handler: async (httpRequestContext, request) => authenticationAuditQuery(httpRequestContext, componentName, request),
194
- requestType: {
195
- type: "IAuditQueryRequest",
196
- examples: [
197
- {
198
- id: "authenticationAuditQueryRequestExample",
199
- description: "The request to query authentication audit entries.",
200
- request: {
201
- query: {
202
- actorId: "user@example.com",
203
- event: "login-success",
204
- startDate: "2026-01-01T00:00:00.000Z",
205
- endDate: "2026-01-31T23:59:59.999Z",
206
- limit: "50"
207
- }
208
- }
209
- }
210
- ]
211
- },
212
- responseType: [
213
- {
214
- type: "IAuditQueryResponse",
215
- examples: [
216
- {
217
- id: "authenticationAuditQueryResponseExample",
218
- description: "The response for querying authentication audit entries.",
219
- response: {
220
- body: {
221
- entries: [
222
- {
223
- id: "018f0b53d5d5704fa3a06d6ed2478575",
224
- actorId: "user@example.com",
225
- dateCreated: "2026-01-12T09:05:23.123Z",
226
- event: "login-success",
227
- data: {
228
- organizationIdentity: "did:example:org1"
229
- }
230
- }
231
- ],
232
- cursor: "next-cursor"
233
- }
234
- }
235
- }
236
- ]
237
- },
238
- {
239
- type: "IUnauthorizedResponse"
240
- }
241
- ],
242
- requiredScope: ["user-admin"]
243
- };
244
- return [createRoute, getRoute, updateRoute, removeRoute, queryRoute];
245
- }
246
- /**
247
- * Create an authentication audit entry.
248
- * @param httpRequestContext The request context for the API.
249
- * @param componentName The name of the component to use in the routes.
250
- * @param request The request.
251
- * @param baseRouteName The base route name to use for the location header.
252
- * @returns The response object with additional http response properties.
253
- */
254
- export async function authenticationAuditCreate(httpRequestContext, componentName, request, baseRouteName) {
255
- Guards.object(ROUTES_SOURCE, "request", request);
256
- Guards.object(ROUTES_SOURCE, "request.body", request.body);
257
- const component = ComponentFactory.get(componentName);
258
- const id = await component.create(request.body);
259
- const contextIds = await ContextIdStore.getContextIds();
260
- const publicOrigin = contextIds?.[HttpContextIdKeys.PublicOrigin];
261
- const headers = {};
262
- HttpHeaderHelper.buildId(headers, id, HttpUrlHelper.combineOriginPath(publicOrigin, `${baseRouteName}/:id`));
263
- return {
264
- statusCode: HttpStatusCode.created,
265
- headers
266
- };
267
- }
268
- /**
269
- * Get an authentication audit entry.
270
- * @param httpRequestContext The request context for the API.
271
- * @param componentName The name of the component to use in the routes.
272
- * @param request The request.
273
- * @returns The response object with additional http response properties.
274
- */
275
- export async function authenticationAuditGet(httpRequestContext, componentName, request) {
276
- Guards.object(ROUTES_SOURCE, "request", request);
277
- Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
278
- const component = ComponentFactory.get(componentName);
279
- const entry = await component.get(request.pathParams.id);
280
- return {
281
- body: entry
282
- };
283
- }
284
- /**
285
- * Update an authentication audit entry.
286
- * @param httpRequestContext The request context for the API.
287
- * @param componentName The name of the component to use in the routes.
288
- * @param request The request.
289
- * @returns The response object with additional http response properties.
290
- */
291
- export async function authenticationAuditUpdate(httpRequestContext, componentName, request) {
292
- Guards.object(ROUTES_SOURCE, "request", request);
293
- Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
294
- Guards.object(ROUTES_SOURCE, "request.body", request.body);
295
- const component = ComponentFactory.get(componentName);
296
- await component.update(request.pathParams.id, request.body);
297
- return {
298
- statusCode: HttpStatusCode.noContent
299
- };
300
- }
301
- /**
302
- * Remove an authentication audit entry.
303
- * @param httpRequestContext The request context for the API.
304
- * @param componentName The name of the component to use in the routes.
305
- * @param request The request.
306
- * @returns The response object with additional http response properties.
307
- */
308
- export async function authenticationAuditRemove(httpRequestContext, componentName, request) {
309
- Guards.object(ROUTES_SOURCE, "request", request);
310
- Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
311
- const component = ComponentFactory.get(componentName);
312
- await component.remove(request.pathParams.id);
313
- return {
314
- statusCode: HttpStatusCode.noContent
315
- };
316
- }
317
- /**
318
- * Query authentication audit entries.
319
- * @param httpRequestContext The request context for the API.
320
- * @param componentName The name of the component to use in the routes.
321
- * @param request The request.
322
- * @returns The response object with additional http response properties.
323
- */
324
- export async function authenticationAuditQuery(httpRequestContext, componentName, request) {
325
- Guards.object(ROUTES_SOURCE, "request", request);
326
- const component = ComponentFactory.get(componentName);
327
- const result = await component.query({
328
- actorId: request.query?.actorId,
329
- organizationId: request.query?.organizationId,
330
- tenantId: request.query?.tenantId,
331
- nodeId: request.query?.nodeId,
332
- event: request.query?.event,
333
- startDate: request.query?.startDate,
334
- endDate: request.query?.endDate
335
- }, request.query?.cursor, Coerce.integer(request.query?.limit));
336
- return {
337
- body: {
338
- entries: result.entries,
339
- cursor: result.cursor
340
- }
341
- };
342
- }
343
- //# sourceMappingURL=entityStorageAuthenticationAuditRoutes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entityStorageAuthenticationAuditRoutes.js","sourceRoot":"","sources":["../../../src/routes/entityStorageAuthenticationAuditRoutes.ts"],"names":[],"mappings":"AAYA,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EAOb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAqB,MAAM,aAAa,CAAC;AAE7E;;GAEG;AACH,MAAM,aAAa,GAAG,2BAA2B,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAW;IAC9C;QACC,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EAAE,qDAAqD;KAClE;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,qCAAqC,CACpD,aAAqB,EACrB,aAAqB;IAErB,MAAM,WAAW,GAAsD;QACtE,WAAW,EAAE,2BAA2B;QACxC,OAAO,EAAE,sCAAsC;QAC/C,GAAG,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,IAAI;QACpC,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,GAAG,aAAa,EAAE;QACxB,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,EAAE,CAC9C,yBAAyB,CAAC,kBAAkB,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,CAAC;QACrF,WAAW,EAAE;YACZ,IAAI,uBAA+B;YACnC,QAAQ,EAAE;gBACT;oBACC,EAAE,EAAE,yCAAyC;oBAC7C,WAAW,EAAE,sDAAsD;oBACnE,OAAO,EAAE;wBACR,IAAI,EAAE;4BACL,OAAO,EAAE,kBAAkB;4BAC3B,KAAK,EAAE,eAAe;4BACtB,IAAI,EAAE;gCACL,oBAA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AO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAE9C,OAAO;QACN,UAAU,EAAE,cAAc,CAAC,SAAS;KACpC,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC7C,kBAAuC,EACvC,aAAqB,EACrB,OAA2B;IAE3B,MAAM,CAAC,MAAM,CAAqB,aAAa,aAAmB,OAAO,CAAC,CAAC;IAE3E,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAgC,aAAa,CAAC,CAAC;IACrF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,KAAK,CACnC;QACC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO;QAC/B,cAAc,EAAE,OAAO,CAAC,KAAK,EAAE,cAAc;QAC7C,QAAQ,EAAE,OAAO,CAAC,KAAK,EAAE,QAAQ;QACjC,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM;QAC7B,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK;QAC3B,SAAS,EAAE,OAAO,CAAC,KAAK,EAAE,SAAS;QACnC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO;KAC/B,EACD,OAAO,CAAC,KAAK,EAAE,MAAM,EACrB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACpC,CAAC;IAEF,OAAO;QACN,IAAI,EAAE;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM,EAAE,MAAM,CAAC,MAAM;SACrB;KACD,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAuditCreateRequest,\n\tIAuditGetRequest,\n\tIAuditGetResponse,\n\tIAuditQueryRequest,\n\tIAuditQueryResponse,\n\tIAuditRemoveRequest,\n\tIAuditUpdateRequest,\n\tIAuthenticationAuditComponent\n} from \"@3sixty/api-auth-entity-storage-models\";\nimport {\n\tHttpContextIdKeys,\n\tHttpHeaderHelper,\n\tHttpUrlHelper,\n\ttype ICreatedResponse,\n\ttype IHttpRequestContext,\n\ttype INoContentResponse,\n\ttype IRestRoute,\n\ttype ITag,\n\ttype IUnauthorizedResponse\n} from \"@3sixty/api-models\";\nimport { ContextIdStore } from \"@3sixty/context\";\nimport { Coerce, ComponentFactory, Guards } from \"@3sixty/core\";\nimport { nameof } from \"@3sixty/nameof\";\nimport { HeaderTypes, HttpStatusCode, type IHttpHeaders } from \"@3sixty/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"authenticationAuditRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsAuthenticationAudit: ITag[] = [\n\t{\n\t\tname: \"Authentication Audit\",\n\t\tdescription: \"Authentication audit endpoints for the REST server.\"\n\t}\n];\n\n/**\n * The REST routes for authentication audit.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesAuthenticationAudit(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\tconst createRoute: IRestRoute<IAuditCreateRequest, ICreatedResponse> = {\n\t\toperationId: \"authenticationAuditCreate\",\n\t\tsummary: \"Create an authentication audit entry\",\n\t\ttag: tagsAuthenticationAudit[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tauthenticationAuditCreate(httpRequestContext, componentName, request, baseRouteName),\n\t\trequestType: {\n\t\t\ttype: nameof<IAuditCreateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"authenticationAuditCreateRequestExample\",\n\t\t\t\t\tdescription: \"The request to create an authentication audit entry.\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tactorId: \"user@example.com\",\n\t\t\t\t\t\t\tevent: \"login-success\",\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\torganizationIdentity: \"did:example:org1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"authenticationAuditCreateResponseExample\",\n\t\t\t\t\t\tdescription: \"The response for creating an authentication audit entry.\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: 201,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.Location]: \"018f0b53d5d5704fa3a06d6ed2478575\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IUnauthorizedResponse>()\n\t\t\t}\n\t\t],\n\t\trequiredScope: [\"user-admin\"]\n\t};\n\n\tconst getRoute: IRestRoute<IAuditGetRequest, IAuditGetResponse> = {\n\t\toperationId: \"authenticationAuditGet\",\n\t\tsummary: \"Get an authentication audit entry\",\n\t\ttag: tagsAuthenticationAudit[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tauthenticationAuditGet(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IAuditGetRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"authenticationAuditGetRequestExample\",\n\t\t\t\t\tdescription: \"The request to get an authentication audit entry.\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"018f0b53d5d5704fa3a06d6ed2478575\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IAuditGetResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"authenticationAuditGetResponseExample\",\n\t\t\t\t\t\tdescription: \"The response for getting an authentication audit entry.\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tid: \"018f0b53d5d5704fa3a06d6ed2478575\",\n\t\t\t\t\t\t\t\tactorId: \"user@example.com\",\n\t\t\t\t\t\t\t\tdateCreated: \"2026-01-12T09:05:23.123Z\",\n\t\t\t\t\t\t\t\tevent: \"login-success\",\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\torganizationIdentity: \"did:example:org1\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IUnauthorizedResponse>()\n\t\t\t}\n\t\t],\n\t\trequiredScope: [\"user-admin\"]\n\t};\n\n\tconst updateRoute: IRestRoute<IAuditUpdateRequest, INoContentResponse> = {\n\t\toperationId: \"authenticationAuditUpdate\",\n\t\tsummary: \"Update an authentication audit entry\",\n\t\ttag: tagsAuthenticationAudit[0].name,\n\t\tmethod: \"PUT\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tauthenticationAuditUpdate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IAuditUpdateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"authenticationAuditUpdateRequestExample\",\n\t\t\t\t\tdescription: \"The request to update an authentication audit entry.\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"018f0b53d5d5704fa3a06d6ed2478575\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\torganizationIdentity: \"did:example:org1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IUnauthorizedResponse>()\n\t\t\t}\n\t\t],\n\t\trequiredScope: [\"user-admin\"]\n\t};\n\n\tconst removeRoute: IRestRoute<IAuditRemoveRequest, INoContentResponse> = {\n\t\toperationId: \"authenticationAuditRemove\",\n\t\tsummary: \"Remove an authentication audit entry\",\n\t\ttag: tagsAuthenticationAudit[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tauthenticationAuditRemove(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IAuditRemoveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"authenticationAuditRemoveRequestExample\",\n\t\t\t\t\tdescription: \"The request to remove an authentication audit entry.\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"018f0b53d5d5704fa3a06d6ed2478575\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IUnauthorizedResponse>()\n\t\t\t}\n\t\t],\n\t\trequiredScope: [\"user-admin\"]\n\t};\n\n\tconst queryRoute: IRestRoute<IAuditQueryRequest, IAuditQueryResponse> = {\n\t\toperationId: \"authenticationAuditQuery\",\n\t\tsummary: \"Query authentication audit entries\",\n\t\ttag: tagsAuthenticationAudit[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tauthenticationAuditQuery(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<IAuditQueryRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"authenticationAuditQueryRequestExample\",\n\t\t\t\t\tdescription: \"The request to query authentication audit entries.\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tactorId: \"user@example.com\",\n\t\t\t\t\t\t\tevent: \"login-success\",\n\t\t\t\t\t\t\tstartDate: \"2026-01-01T00:00:00.000Z\",\n\t\t\t\t\t\t\tendDate: \"2026-01-31T23:59:59.999Z\",\n\t\t\t\t\t\t\tlimit: \"50\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<IAuditQueryResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"authenticationAuditQueryResponseExample\",\n\t\t\t\t\t\tdescription: \"The response for querying authentication audit entries.\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tentries: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tid: \"018f0b53d5d5704fa3a06d6ed2478575\",\n\t\t\t\t\t\t\t\t\t\tactorId: \"user@example.com\",\n\t\t\t\t\t\t\t\t\t\tdateCreated: \"2026-01-12T09:05:23.123Z\",\n\t\t\t\t\t\t\t\t\t\tevent: \"login-success\",\n\t\t\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t\t\torganizationIdentity: \"did:example:org1\"\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tcursor: \"next-cursor\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: nameof<IUnauthorizedResponse>()\n\t\t\t}\n\t\t],\n\t\trequiredScope: [\"user-admin\"]\n\t};\n\n\treturn [createRoute, getRoute, updateRoute, removeRoute, queryRoute];\n}\n\n/**\n * Create an authentication audit entry.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @param baseRouteName The base route name to use for the location header.\n * @returns The response object with additional http response properties.\n */\nexport async function authenticationAuditCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IAuditCreateRequest,\n\tbaseRouteName: string\n): Promise<ICreatedResponse> {\n\tGuards.object<IAuditCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IAuditCreateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IAuthenticationAuditComponent>(componentName);\n\tconst id = await component.create(request.body);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tconst publicOrigin = contextIds?.[HttpContextIdKeys.PublicOrigin];\n\n\tconst headers: IHttpHeaders = {};\n\tHttpHeaderHelper.buildId(\n\t\theaders,\n\t\tid,\n\t\tHttpUrlHelper.combineOriginPath(publicOrigin, `${baseRouteName}/:id`)\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders\n\t};\n}\n\n/**\n * Get an authentication audit entry.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function authenticationAuditGet(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IAuditGetRequest\n): Promise<IAuditGetResponse> {\n\tGuards.object<IAuditGetRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IAuditGetRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\n\tconst component = ComponentFactory.get<IAuthenticationAuditComponent>(componentName);\n\tconst entry = await component.get(request.pathParams.id);\n\n\treturn {\n\t\tbody: entry\n\t};\n}\n\n/**\n * Update an authentication audit entry.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function authenticationAuditUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IAuditUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IAuditUpdateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IAuditUpdateRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.object<IAuditUpdateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\n\tconst component = ComponentFactory.get<IAuthenticationAuditComponent>(componentName);\n\tawait component.update(request.pathParams.id, request.body);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Remove an authentication audit entry.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function authenticationAuditRemove(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IAuditRemoveRequest\n): Promise<INoContentResponse> {\n\tGuards.object<IAuditRemoveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<IAuditRemoveRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\n\tconst component = ComponentFactory.get<IAuthenticationAuditComponent>(componentName);\n\tawait component.remove(request.pathParams.id);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Query authentication audit entries.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function authenticationAuditQuery(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: IAuditQueryRequest\n): Promise<IAuditQueryResponse> {\n\tGuards.object<IAuditQueryRequest>(ROUTES_SOURCE, nameof(request), request);\n\n\tconst component = ComponentFactory.get<IAuthenticationAuditComponent>(componentName);\n\tconst result = await component.query(\n\t\t{\n\t\t\tactorId: request.query?.actorId,\n\t\t\torganizationId: request.query?.organizationId,\n\t\t\ttenantId: request.query?.tenantId,\n\t\t\tnodeId: request.query?.nodeId,\n\t\t\tevent: request.query?.event,\n\t\t\tstartDate: request.query?.startDate,\n\t\t\tendDate: request.query?.endDate\n\t\t},\n\t\trequest.query?.cursor,\n\t\tCoerce.integer(request.query?.limit)\n\t);\n\n\treturn {\n\t\tbody: {\n\t\t\tentries: result.entries,\n\t\t\tcursor: result.cursor\n\t\t}\n\t};\n}\n"]}