@twin.org/api-auth-entity-storage-service 0.0.3-next.22 → 0.0.3-next.24
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/dist/es/entities/authenticationAuditEntry.js +101 -0
- package/dist/es/entities/authenticationAuditEntry.js.map +1 -0
- package/dist/es/entities/authenticationRateEntry.js +37 -0
- package/dist/es/entities/authenticationRateEntry.js.map +1 -0
- package/dist/es/index.js +10 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IAuthHeaderProcessorConstructorOptions.js.map +1 -1
- package/dist/es/models/IEntityStorageAuthenticationAdminServiceConstructorOptions.js.map +1 -1
- package/dist/es/models/IEntityStorageAuthenticationAuditServiceConfig.js +4 -0
- package/dist/es/models/IEntityStorageAuthenticationAuditServiceConfig.js.map +1 -0
- package/dist/es/models/IEntityStorageAuthenticationAuditServiceConstructorOptions.js +2 -0
- package/dist/es/models/IEntityStorageAuthenticationAuditServiceConstructorOptions.js.map +1 -0
- package/dist/es/models/IEntityStorageAuthenticationRateServiceConfig.js +2 -0
- package/dist/es/models/IEntityStorageAuthenticationRateServiceConfig.js.map +1 -0
- package/dist/es/models/IEntityStorageAuthenticationRateServiceConstructorOptions.js +2 -0
- package/dist/es/models/IEntityStorageAuthenticationRateServiceConstructorOptions.js.map +1 -0
- package/dist/es/models/IEntityStorageAuthenticationServiceConfig.js +0 -2
- package/dist/es/models/IEntityStorageAuthenticationServiceConfig.js.map +1 -1
- package/dist/es/models/IEntityStorageAuthenticationServiceConstructorOptions.js.map +1 -1
- package/dist/es/processors/authHeaderProcessor.js +18 -4
- package/dist/es/processors/authHeaderProcessor.js.map +1 -1
- package/dist/es/restEntryPoints.js +7 -0
- package/dist/es/restEntryPoints.js.map +1 -1
- package/dist/es/routes/entityStorageAuthenticationAuditRoutes.js +174 -0
- package/dist/es/routes/entityStorageAuthenticationAuditRoutes.js.map +1 -0
- package/dist/es/schema.js +4 -0
- package/dist/es/schema.js.map +1 -1
- package/dist/es/services/entityStorageAuthenticationAdminService.js +53 -27
- package/dist/es/services/entityStorageAuthenticationAdminService.js.map +1 -1
- package/dist/es/services/entityStorageAuthenticationAuditService.js +178 -0
- package/dist/es/services/entityStorageAuthenticationAuditService.js.map +1 -0
- package/dist/es/services/entityStorageAuthenticationRateService.js +202 -0
- package/dist/es/services/entityStorageAuthenticationRateService.js.map +1 -0
- package/dist/es/services/entityStorageAuthenticationService.js +156 -11
- package/dist/es/services/entityStorageAuthenticationService.js.map +1 -1
- package/dist/es/utils/passwordHelper.js +57 -0
- package/dist/es/utils/passwordHelper.js.map +1 -0
- package/dist/es/utils/tokenHelper.js +11 -1
- package/dist/es/utils/tokenHelper.js.map +1 -1
- package/dist/types/entities/authenticationAuditEntry.d.ts +49 -0
- package/dist/types/entities/authenticationRateEntry.d.ts +17 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/models/IAuthHeaderProcessorConstructorOptions.d.ts +5 -0
- package/dist/types/models/IEntityStorageAuthenticationAdminServiceConstructorOptions.d.ts +5 -0
- package/dist/types/models/IEntityStorageAuthenticationAuditServiceConfig.d.ts +9 -0
- package/dist/types/models/IEntityStorageAuthenticationAuditServiceConstructorOptions.d.ts +15 -0
- package/dist/types/models/IEntityStorageAuthenticationRateServiceConfig.d.ts +10 -0
- package/dist/types/models/IEntityStorageAuthenticationRateServiceConstructorOptions.d.ts +20 -0
- package/dist/types/models/IEntityStorageAuthenticationServiceConfig.d.ts +22 -1
- package/dist/types/models/IEntityStorageAuthenticationServiceConstructorOptions.d.ts +8 -3
- package/dist/types/routes/entityStorageAuthenticationAuditRoutes.d.ts +29 -0
- package/dist/types/services/entityStorageAuthenticationAuditService.d.ts +59 -0
- package/dist/types/services/entityStorageAuthenticationRateService.d.ts +60 -0
- package/dist/types/services/entityStorageAuthenticationService.d.ts +6 -0
- package/dist/types/utils/passwordHelper.d.ts +24 -0
- package/dist/types/utils/tokenHelper.d.ts +2 -1
- package/docs/changelog.md +32 -0
- package/docs/reference/classes/AuthenticationAuditEntry.md +101 -0
- package/docs/reference/classes/AuthenticationRateEntry.md +37 -0
- package/docs/reference/classes/EntityStorageAuthenticationAdminService.md +4 -4
- package/docs/reference/classes/EntityStorageAuthenticationAuditService.md +157 -0
- package/docs/reference/classes/EntityStorageAuthenticationRateService.md +227 -0
- package/docs/reference/classes/EntityStorageAuthenticationService.md +26 -0
- package/docs/reference/classes/PasswordHelper.md +74 -0
- package/docs/reference/classes/TokenHelper.md +7 -1
- package/docs/reference/functions/authenticationAuditCreate.md +31 -0
- package/docs/reference/functions/authenticationAuditQuery.md +31 -0
- package/docs/reference/functions/generateRestRoutesAuthenticationAudit.md +25 -0
- package/docs/reference/index.md +13 -0
- package/docs/reference/interfaces/IAuthHeaderProcessorConstructorOptions.md +14 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationAdminServiceConstructorOptions.md +14 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationAuditServiceConfig.md +11 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationAuditServiceConstructorOptions.md +25 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationRateServiceConfig.md +17 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationRateServiceConstructorOptions.md +39 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationServiceConfig.md +57 -1
- package/docs/reference/interfaces/IEntityStorageAuthenticationServiceConstructorOptions.md +18 -4
- package/docs/reference/variables/tagsAuthenticationAudit.md +5 -0
- package/locales/en.json +13 -2
- package/package.json +5 -4
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Class: AuthenticationRateEntry
|
|
2
|
+
|
|
3
|
+
Class defining the storage for authentication rate entries.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new AuthenticationRateEntry**(): `AuthenticationRateEntry`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`AuthenticationRateEntry`
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### id {#id}
|
|
18
|
+
|
|
19
|
+
> **id**: `string`
|
|
20
|
+
|
|
21
|
+
The id for the rate entry.
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
25
|
+
### timestamps {#timestamps}
|
|
26
|
+
|
|
27
|
+
> **timestamps**: `string`[]
|
|
28
|
+
|
|
29
|
+
Array of ISO date strings representing timestamps of failed attempts.
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
### dateModified {#datemodified}
|
|
34
|
+
|
|
35
|
+
> **dateModified**: `string`
|
|
36
|
+
|
|
37
|
+
Last modification time in ISO date format.
|
|
@@ -108,7 +108,7 @@ Nothing.
|
|
|
108
108
|
|
|
109
109
|
### get() {#get}
|
|
110
110
|
|
|
111
|
-
> **get**(`email`): `Promise`\<`Omit`\<`IAuthenticationUser`, `"
|
|
111
|
+
> **get**(`email`): `Promise`\<`Omit`\<`IAuthenticationUser`, `"password"` \| `"salt"`\>\>
|
|
112
112
|
|
|
113
113
|
Get a user by email.
|
|
114
114
|
|
|
@@ -122,7 +122,7 @@ The email address of the user to get.
|
|
|
122
122
|
|
|
123
123
|
#### Returns
|
|
124
124
|
|
|
125
|
-
`Promise`\<`Omit`\<`IAuthenticationUser`, `"
|
|
125
|
+
`Promise`\<`Omit`\<`IAuthenticationUser`, `"password"` \| `"salt"`\>\>
|
|
126
126
|
|
|
127
127
|
The user details.
|
|
128
128
|
|
|
@@ -134,7 +134,7 @@ The user details.
|
|
|
134
134
|
|
|
135
135
|
### getByIdentity() {#getbyidentity}
|
|
136
136
|
|
|
137
|
-
> **getByIdentity**(`identity`): `Promise`\<`Omit`\<`IAuthenticationUser`, `"
|
|
137
|
+
> **getByIdentity**(`identity`): `Promise`\<`Omit`\<`IAuthenticationUser`, `"password"` \| `"salt"`\>\>
|
|
138
138
|
|
|
139
139
|
Get a user by identity.
|
|
140
140
|
|
|
@@ -148,7 +148,7 @@ The identity of the user to get.
|
|
|
148
148
|
|
|
149
149
|
#### Returns
|
|
150
150
|
|
|
151
|
-
`Promise`\<`Omit`\<`IAuthenticationUser`, `"
|
|
151
|
+
`Promise`\<`Omit`\<`IAuthenticationUser`, `"password"` \| `"salt"`\>\>
|
|
152
152
|
|
|
153
153
|
The user details.
|
|
154
154
|
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Class: EntityStorageAuthenticationAuditService
|
|
2
|
+
|
|
3
|
+
Implementation of the authentication audit component using entity storage.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IAuthenticationAuditComponent`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new EntityStorageAuthenticationAuditService**(`options?`): `EntityStorageAuthenticationAuditService`
|
|
14
|
+
|
|
15
|
+
Create a new instance of EntityStorageAuthenticationAuditService.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`IEntityStorageAuthenticationAuditServiceConstructorOptions`](../interfaces/IEntityStorageAuthenticationAuditServiceConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The dependencies for the identity connector.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`EntityStorageAuthenticationAuditService`
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### CLASS\_NAME {#class_name}
|
|
32
|
+
|
|
33
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
|
+
|
|
35
|
+
Runtime name for the class.
|
|
36
|
+
|
|
37
|
+
## Methods
|
|
38
|
+
|
|
39
|
+
### className() {#classname}
|
|
40
|
+
|
|
41
|
+
> **className**(): `string`
|
|
42
|
+
|
|
43
|
+
Returns the class name of the component.
|
|
44
|
+
|
|
45
|
+
#### Returns
|
|
46
|
+
|
|
47
|
+
`string`
|
|
48
|
+
|
|
49
|
+
The class name of the component.
|
|
50
|
+
|
|
51
|
+
#### Implementation of
|
|
52
|
+
|
|
53
|
+
`IAuthenticationAuditComponent.className`
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### create() {#create}
|
|
58
|
+
|
|
59
|
+
> **create**(`entry`): `Promise`\<`string`\>
|
|
60
|
+
|
|
61
|
+
Create a new audit entry.
|
|
62
|
+
|
|
63
|
+
#### Parameters
|
|
64
|
+
|
|
65
|
+
##### entry
|
|
66
|
+
|
|
67
|
+
`Omit`\<`IAuthenticationAuditEntry`, `"id"` \| `"dateCreated"`\>
|
|
68
|
+
|
|
69
|
+
The audit entry to be logged.
|
|
70
|
+
|
|
71
|
+
#### Returns
|
|
72
|
+
|
|
73
|
+
`Promise`\<`string`\>
|
|
74
|
+
|
|
75
|
+
The unique identifier of the created audit entry.
|
|
76
|
+
|
|
77
|
+
#### Implementation of
|
|
78
|
+
|
|
79
|
+
`IAuthenticationAuditComponent.create`
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### query() {#query}
|
|
84
|
+
|
|
85
|
+
> **query**(`options?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IAuthenticationAuditEntry`[]; `cursor?`: `string`; \}\>
|
|
86
|
+
|
|
87
|
+
Query the audit entries.
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
##### options?
|
|
92
|
+
|
|
93
|
+
The query options.
|
|
94
|
+
|
|
95
|
+
###### actorId?
|
|
96
|
+
|
|
97
|
+
`string`
|
|
98
|
+
|
|
99
|
+
The actor identifier to filter the audit entries, optional.
|
|
100
|
+
|
|
101
|
+
###### organizationId?
|
|
102
|
+
|
|
103
|
+
`string`
|
|
104
|
+
|
|
105
|
+
The organization identifier to filter the audit entries, optional.
|
|
106
|
+
|
|
107
|
+
###### tenantId?
|
|
108
|
+
|
|
109
|
+
`string`
|
|
110
|
+
|
|
111
|
+
The tenant identifier to filter the audit entries, optional.
|
|
112
|
+
|
|
113
|
+
###### nodeId?
|
|
114
|
+
|
|
115
|
+
`string`
|
|
116
|
+
|
|
117
|
+
The node identifier to filter the audit entries, optional.
|
|
118
|
+
|
|
119
|
+
###### event?
|
|
120
|
+
|
|
121
|
+
`string`
|
|
122
|
+
|
|
123
|
+
The audit event to filter the audit entries, optional.
|
|
124
|
+
|
|
125
|
+
###### startDate?
|
|
126
|
+
|
|
127
|
+
`string`
|
|
128
|
+
|
|
129
|
+
The start date to filter the audit entries, optional.
|
|
130
|
+
|
|
131
|
+
###### endDate?
|
|
132
|
+
|
|
133
|
+
`string`
|
|
134
|
+
|
|
135
|
+
The end date to filter the audit entries, optional.
|
|
136
|
+
|
|
137
|
+
##### cursor?
|
|
138
|
+
|
|
139
|
+
`string`
|
|
140
|
+
|
|
141
|
+
The cursor for pagination.
|
|
142
|
+
|
|
143
|
+
##### limit?
|
|
144
|
+
|
|
145
|
+
`number`
|
|
146
|
+
|
|
147
|
+
The maximum number of entries to return.
|
|
148
|
+
|
|
149
|
+
#### Returns
|
|
150
|
+
|
|
151
|
+
`Promise`\<\{ `entries`: `IAuthenticationAuditEntry`[]; `cursor?`: `string`; \}\>
|
|
152
|
+
|
|
153
|
+
The audit entries.
|
|
154
|
+
|
|
155
|
+
#### Implementation of
|
|
156
|
+
|
|
157
|
+
`IAuthenticationAuditComponent.query`
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# Class: EntityStorageAuthenticationRateService
|
|
2
|
+
|
|
3
|
+
Implementation of the authentication rate component using entity storage.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IAuthenticationRateComponent`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new EntityStorageAuthenticationRateService**(`options?`): `EntityStorageAuthenticationRateService`
|
|
14
|
+
|
|
15
|
+
Create a new instance of EntityStorageAuthenticationRateService.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`IEntityStorageAuthenticationRateServiceConstructorOptions`](../interfaces/IEntityStorageAuthenticationRateServiceConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The constructor options.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`EntityStorageAuthenticationRateService`
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### CLASS\_NAME {#class_name}
|
|
32
|
+
|
|
33
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
|
+
|
|
35
|
+
Runtime name for the class.
|
|
36
|
+
|
|
37
|
+
## Methods
|
|
38
|
+
|
|
39
|
+
### registerAction() {#registeraction}
|
|
40
|
+
|
|
41
|
+
> **registerAction**(`action`, `config`): `Promise`\<`void`\>
|
|
42
|
+
|
|
43
|
+
Register or update rate-limit configuration for an action.
|
|
44
|
+
|
|
45
|
+
#### Parameters
|
|
46
|
+
|
|
47
|
+
##### action
|
|
48
|
+
|
|
49
|
+
`string`
|
|
50
|
+
|
|
51
|
+
The action name.
|
|
52
|
+
|
|
53
|
+
##### config
|
|
54
|
+
|
|
55
|
+
`IAuthenticationRateActionConfig`
|
|
56
|
+
|
|
57
|
+
The action configuration.
|
|
58
|
+
|
|
59
|
+
#### Returns
|
|
60
|
+
|
|
61
|
+
`Promise`\<`void`\>
|
|
62
|
+
|
|
63
|
+
Nothing.
|
|
64
|
+
|
|
65
|
+
#### Implementation of
|
|
66
|
+
|
|
67
|
+
`IAuthenticationRateComponent.registerAction`
|
|
68
|
+
|
|
69
|
+
***
|
|
70
|
+
|
|
71
|
+
### unregisterAction() {#unregisteraction}
|
|
72
|
+
|
|
73
|
+
> **unregisterAction**(`action`): `Promise`\<`void`\>
|
|
74
|
+
|
|
75
|
+
Unregister rate-limit configuration for an action.
|
|
76
|
+
|
|
77
|
+
#### Parameters
|
|
78
|
+
|
|
79
|
+
##### action
|
|
80
|
+
|
|
81
|
+
`string`
|
|
82
|
+
|
|
83
|
+
The action name.
|
|
84
|
+
|
|
85
|
+
#### Returns
|
|
86
|
+
|
|
87
|
+
`Promise`\<`void`\>
|
|
88
|
+
|
|
89
|
+
Nothing.
|
|
90
|
+
|
|
91
|
+
#### Implementation of
|
|
92
|
+
|
|
93
|
+
`IAuthenticationRateComponent.unregisterAction`
|
|
94
|
+
|
|
95
|
+
***
|
|
96
|
+
|
|
97
|
+
### className() {#classname}
|
|
98
|
+
|
|
99
|
+
> **className**(): `string`
|
|
100
|
+
|
|
101
|
+
Returns the class name of the component.
|
|
102
|
+
|
|
103
|
+
#### Returns
|
|
104
|
+
|
|
105
|
+
`string`
|
|
106
|
+
|
|
107
|
+
The class name of the component.
|
|
108
|
+
|
|
109
|
+
#### Implementation of
|
|
110
|
+
|
|
111
|
+
`IAuthenticationRateComponent.className`
|
|
112
|
+
|
|
113
|
+
***
|
|
114
|
+
|
|
115
|
+
### start() {#start}
|
|
116
|
+
|
|
117
|
+
> **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
118
|
+
|
|
119
|
+
The service needs to be started when the application is initialized.
|
|
120
|
+
|
|
121
|
+
#### Parameters
|
|
122
|
+
|
|
123
|
+
##### nodeLoggingComponentType?
|
|
124
|
+
|
|
125
|
+
`string`
|
|
126
|
+
|
|
127
|
+
The node logging component type.
|
|
128
|
+
|
|
129
|
+
#### Returns
|
|
130
|
+
|
|
131
|
+
`Promise`\<`void`\>
|
|
132
|
+
|
|
133
|
+
Nothing.
|
|
134
|
+
|
|
135
|
+
#### Implementation of
|
|
136
|
+
|
|
137
|
+
`IAuthenticationRateComponent.start`
|
|
138
|
+
|
|
139
|
+
***
|
|
140
|
+
|
|
141
|
+
### stop() {#stop}
|
|
142
|
+
|
|
143
|
+
> **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
144
|
+
|
|
145
|
+
The component needs to be stopped when the node is closed.
|
|
146
|
+
|
|
147
|
+
#### Parameters
|
|
148
|
+
|
|
149
|
+
##### nodeLoggingComponentType?
|
|
150
|
+
|
|
151
|
+
`string`
|
|
152
|
+
|
|
153
|
+
The node logging component type.
|
|
154
|
+
|
|
155
|
+
#### Returns
|
|
156
|
+
|
|
157
|
+
`Promise`\<`void`\>
|
|
158
|
+
|
|
159
|
+
Nothing.
|
|
160
|
+
|
|
161
|
+
#### Implementation of
|
|
162
|
+
|
|
163
|
+
`IAuthenticationRateComponent.stop`
|
|
164
|
+
|
|
165
|
+
***
|
|
166
|
+
|
|
167
|
+
### check() {#check}
|
|
168
|
+
|
|
169
|
+
> **check**(`action`, `identifier`): `Promise`\<`string`\>
|
|
170
|
+
|
|
171
|
+
Check the authentication rate for a given action and identifier.
|
|
172
|
+
|
|
173
|
+
#### Parameters
|
|
174
|
+
|
|
175
|
+
##### action
|
|
176
|
+
|
|
177
|
+
`string`
|
|
178
|
+
|
|
179
|
+
The action to be checked.
|
|
180
|
+
|
|
181
|
+
##### identifier
|
|
182
|
+
|
|
183
|
+
`string`
|
|
184
|
+
|
|
185
|
+
The identifier to be checked.
|
|
186
|
+
|
|
187
|
+
#### Returns
|
|
188
|
+
|
|
189
|
+
`Promise`\<`string`\>
|
|
190
|
+
|
|
191
|
+
The rate entry id.
|
|
192
|
+
|
|
193
|
+
#### Implementation of
|
|
194
|
+
|
|
195
|
+
`IAuthenticationRateComponent.check`
|
|
196
|
+
|
|
197
|
+
***
|
|
198
|
+
|
|
199
|
+
### clear() {#clear}
|
|
200
|
+
|
|
201
|
+
> **clear**(`action`, `identifier`): `Promise`\<`void`\>
|
|
202
|
+
|
|
203
|
+
Clear the authentication rate entry for the given action and identifier.
|
|
204
|
+
|
|
205
|
+
#### Parameters
|
|
206
|
+
|
|
207
|
+
##### action
|
|
208
|
+
|
|
209
|
+
`string`
|
|
210
|
+
|
|
211
|
+
The action to clear.
|
|
212
|
+
|
|
213
|
+
##### identifier
|
|
214
|
+
|
|
215
|
+
`string`
|
|
216
|
+
|
|
217
|
+
The identifier to clear.
|
|
218
|
+
|
|
219
|
+
#### Returns
|
|
220
|
+
|
|
221
|
+
`Promise`\<`void`\>
|
|
222
|
+
|
|
223
|
+
Nothing.
|
|
224
|
+
|
|
225
|
+
#### Implementation of
|
|
226
|
+
|
|
227
|
+
`IAuthenticationRateComponent.clear`
|
|
@@ -80,6 +80,32 @@ Nothing.
|
|
|
80
80
|
|
|
81
81
|
***
|
|
82
82
|
|
|
83
|
+
### stop() {#stop}
|
|
84
|
+
|
|
85
|
+
> **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
86
|
+
|
|
87
|
+
The component needs to be stopped when the node is closed.
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
##### nodeLoggingComponentType?
|
|
92
|
+
|
|
93
|
+
`string`
|
|
94
|
+
|
|
95
|
+
The node logging component type.
|
|
96
|
+
|
|
97
|
+
#### Returns
|
|
98
|
+
|
|
99
|
+
`Promise`\<`void`\>
|
|
100
|
+
|
|
101
|
+
Nothing.
|
|
102
|
+
|
|
103
|
+
#### Implementation of
|
|
104
|
+
|
|
105
|
+
`IAuthenticationComponent.stop`
|
|
106
|
+
|
|
107
|
+
***
|
|
108
|
+
|
|
83
109
|
### login() {#login}
|
|
84
110
|
|
|
85
111
|
> **login**(`email`, `password`): `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Class: PasswordHelper
|
|
2
|
+
|
|
3
|
+
Helper class for password operations.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new PasswordHelper**(): `PasswordHelper`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`PasswordHelper`
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
|
+
|
|
19
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
|
+
|
|
21
|
+
Runtime name for the class.
|
|
22
|
+
|
|
23
|
+
## Methods
|
|
24
|
+
|
|
25
|
+
### updatePassword() {#updatepassword}
|
|
26
|
+
|
|
27
|
+
> `static` **updatePassword**(`userEntityStorage`, `authenticationAuditService`, `user`, `newPassword`, `currentPassword?`, `minPasswordLength?`): `Promise`\<`void`\>
|
|
28
|
+
|
|
29
|
+
Update the password for a user.
|
|
30
|
+
Validates password strength, verifies the current password if provided, then hashes and stores the new password and raises an audit event.
|
|
31
|
+
|
|
32
|
+
#### Parameters
|
|
33
|
+
|
|
34
|
+
##### userEntityStorage
|
|
35
|
+
|
|
36
|
+
`IEntityStorageConnector`\<[`AuthenticationUser`](AuthenticationUser.md)\>
|
|
37
|
+
|
|
38
|
+
The entity storage for users.
|
|
39
|
+
|
|
40
|
+
##### authenticationAuditService
|
|
41
|
+
|
|
42
|
+
`IAuthenticationAuditComponent` \| `undefined`
|
|
43
|
+
|
|
44
|
+
The optional audit service.
|
|
45
|
+
|
|
46
|
+
##### user
|
|
47
|
+
|
|
48
|
+
[`AuthenticationUser`](AuthenticationUser.md)
|
|
49
|
+
|
|
50
|
+
The user whose password is being updated.
|
|
51
|
+
|
|
52
|
+
##### newPassword
|
|
53
|
+
|
|
54
|
+
`string`
|
|
55
|
+
|
|
56
|
+
The new password to set.
|
|
57
|
+
|
|
58
|
+
##### currentPassword?
|
|
59
|
+
|
|
60
|
+
`string`
|
|
61
|
+
|
|
62
|
+
The current password to verify against, if supplied.
|
|
63
|
+
|
|
64
|
+
##### minPasswordLength?
|
|
65
|
+
|
|
66
|
+
`number`
|
|
67
|
+
|
|
68
|
+
Optional minimum password length for validation.
|
|
69
|
+
|
|
70
|
+
#### Returns
|
|
71
|
+
|
|
72
|
+
`Promise`\<`void`\>
|
|
73
|
+
|
|
74
|
+
Nothing.
|
|
@@ -82,7 +82,7 @@ The new token and its expiry date.
|
|
|
82
82
|
|
|
83
83
|
### verify() {#verify}
|
|
84
84
|
|
|
85
|
-
> `static` **verify**(`vaultConnector`, `signingKeyName`, `token`, `requiredScopes?`): `Promise`\<\{ `header`: `JWTHeaderParameters`; `payload`: `JWTPayload`; \}\>
|
|
85
|
+
> `static` **verify**(`vaultConnector`, `signingKeyName`, `token`, `requiredScopes?`, `verifyUser?`): `Promise`\<\{ `header`: `JWTHeaderParameters`; `payload`: `JWTPayload`; \}\>
|
|
86
86
|
|
|
87
87
|
Verify the token.
|
|
88
88
|
|
|
@@ -112,6 +112,12 @@ The token to verify.
|
|
|
112
112
|
|
|
113
113
|
The required scopes.
|
|
114
114
|
|
|
115
|
+
##### verifyUser?
|
|
116
|
+
|
|
117
|
+
(`userIdentity`, `organizationIdentity`) => `Promise`\<`string`[]\>
|
|
118
|
+
|
|
119
|
+
A function to verify the user identity and organization, which can be used to check if the user is still active or not.
|
|
120
|
+
|
|
115
121
|
#### Returns
|
|
116
122
|
|
|
117
123
|
`Promise`\<\{ `header`: `JWTHeaderParameters`; `payload`: `JWTPayload`; \}\>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: authenticationAuditCreate()
|
|
2
|
+
|
|
3
|
+
> **authenticationAuditCreate**(`httpRequestContext`, `componentName`, `request`): `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
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`ICreatedResponse`\>
|
|
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,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.
|
package/docs/reference/index.md
CHANGED
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Classes
|
|
4
4
|
|
|
5
|
+
- [AuthenticationAuditEntry](classes/AuthenticationAuditEntry.md)
|
|
6
|
+
- [AuthenticationRateEntry](classes/AuthenticationRateEntry.md)
|
|
5
7
|
- [AuthenticationUser](classes/AuthenticationUser.md)
|
|
6
8
|
- [AuthHeaderProcessor](classes/AuthHeaderProcessor.md)
|
|
7
9
|
- [EntityStorageAuthenticationAdminService](classes/EntityStorageAuthenticationAdminService.md)
|
|
10
|
+
- [EntityStorageAuthenticationAuditService](classes/EntityStorageAuthenticationAuditService.md)
|
|
11
|
+
- [EntityStorageAuthenticationRateService](classes/EntityStorageAuthenticationRateService.md)
|
|
8
12
|
- [EntityStorageAuthenticationService](classes/EntityStorageAuthenticationService.md)
|
|
13
|
+
- [PasswordHelper](classes/PasswordHelper.md)
|
|
9
14
|
- [TokenHelper](classes/TokenHelper.md)
|
|
10
15
|
|
|
11
16
|
## Interfaces
|
|
@@ -14,6 +19,10 @@
|
|
|
14
19
|
- [IAuthHeaderProcessorConstructorOptions](interfaces/IAuthHeaderProcessorConstructorOptions.md)
|
|
15
20
|
- [IEntityStorageAuthenticationAdminServiceConfig](interfaces/IEntityStorageAuthenticationAdminServiceConfig.md)
|
|
16
21
|
- [IEntityStorageAuthenticationAdminServiceConstructorOptions](interfaces/IEntityStorageAuthenticationAdminServiceConstructorOptions.md)
|
|
22
|
+
- [IEntityStorageAuthenticationAuditServiceConfig](interfaces/IEntityStorageAuthenticationAuditServiceConfig.md)
|
|
23
|
+
- [IEntityStorageAuthenticationAuditServiceConstructorOptions](interfaces/IEntityStorageAuthenticationAuditServiceConstructorOptions.md)
|
|
24
|
+
- [IEntityStorageAuthenticationRateServiceConfig](interfaces/IEntityStorageAuthenticationRateServiceConfig.md)
|
|
25
|
+
- [IEntityStorageAuthenticationRateServiceConstructorOptions](interfaces/IEntityStorageAuthenticationRateServiceConstructorOptions.md)
|
|
17
26
|
- [IEntityStorageAuthenticationServiceConfig](interfaces/IEntityStorageAuthenticationServiceConfig.md)
|
|
18
27
|
- [IEntityStorageAuthenticationServiceConstructorOptions](interfaces/IEntityStorageAuthenticationServiceConstructorOptions.md)
|
|
19
28
|
|
|
@@ -21,6 +30,7 @@
|
|
|
21
30
|
|
|
22
31
|
- [restEntryPoints](variables/restEntryPoints.md)
|
|
23
32
|
- [tagsAuthenticationAdmin](variables/tagsAuthenticationAdmin.md)
|
|
33
|
+
- [tagsAuthenticationAudit](variables/tagsAuthenticationAudit.md)
|
|
24
34
|
- [tagsAuthentication](variables/tagsAuthentication.md)
|
|
25
35
|
|
|
26
36
|
## Functions
|
|
@@ -32,6 +42,9 @@
|
|
|
32
42
|
- [authenticationAdminGetUser](functions/authenticationAdminGetUser.md)
|
|
33
43
|
- [authenticationAdminGetUserByIdentity](functions/authenticationAdminGetUserByIdentity.md)
|
|
34
44
|
- [authenticationAdminRemoveUser](functions/authenticationAdminRemoveUser.md)
|
|
45
|
+
- [generateRestRoutesAuthenticationAudit](functions/generateRestRoutesAuthenticationAudit.md)
|
|
46
|
+
- [authenticationAuditCreate](functions/authenticationAuditCreate.md)
|
|
47
|
+
- [authenticationAuditQuery](functions/authenticationAuditQuery.md)
|
|
35
48
|
- [generateRestRoutesAuthentication](functions/generateRestRoutesAuthentication.md)
|
|
36
49
|
- [authenticationLogin](functions/authenticationLogin.md)
|
|
37
50
|
- [authenticationLogout](functions/authenticationLogout.md)
|