@3sixty/api-auth-entity-storage-service 0.0.0-stage → 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.
- package/LICENSE +201 -0
- package/README.md +24 -2
- package/dist/es/entities/authenticationUser.js +61 -0
- package/dist/es/entities/authenticationUser.js.map +1 -0
- package/dist/es/entities/authenticationUserV0.js +69 -0
- package/dist/es/entities/authenticationUserV0.js.map +1 -0
- package/dist/es/index.js +21 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IAuthHeaderProcessorConfig.js +4 -0
- package/dist/es/models/IAuthHeaderProcessorConfig.js.map +1 -0
- package/dist/es/models/IAuthHeaderProcessorConstructorOptions.js +2 -0
- package/dist/es/models/IAuthHeaderProcessorConstructorOptions.js.map +1 -0
- package/dist/es/models/IAuthTokenContext.js +4 -0
- package/dist/es/models/IAuthTokenContext.js.map +1 -0
- package/dist/es/models/IEntityStorageAuthenticationAdminServiceConfig.js +4 -0
- package/dist/es/models/IEntityStorageAuthenticationAdminServiceConfig.js.map +1 -0
- package/dist/es/models/IEntityStorageAuthenticationAdminServiceConstructorOptions.js +2 -0
- package/dist/es/models/IEntityStorageAuthenticationAdminServiceConstructorOptions.js.map +1 -0
- package/dist/es/models/IEntityStorageAuthenticationServiceConfig.js +2 -0
- package/dist/es/models/IEntityStorageAuthenticationServiceConfig.js.map +1 -0
- package/dist/es/models/IEntityStorageAuthenticationServiceConstructorOptions.js +2 -0
- package/dist/es/models/IEntityStorageAuthenticationServiceConstructorOptions.js.map +1 -0
- package/dist/es/processors/authHeaderProcessor.js +272 -0
- package/dist/es/processors/authHeaderProcessor.js.map +1 -0
- package/dist/es/restEntryPoints.js +20 -0
- package/dist/es/restEntryPoints.js.map +1 -0
- package/dist/es/routes/entityStorageAuthenticationAdminRoutes.js +375 -0
- package/dist/es/routes/entityStorageAuthenticationAdminRoutes.js.map +1 -0
- package/dist/es/routes/entityStorageAuthenticationRoutes.js +291 -0
- package/dist/es/routes/entityStorageAuthenticationRoutes.js.map +1 -0
- package/dist/es/schema.js +13 -0
- package/dist/es/schema.js.map +1 -0
- package/dist/es/services/entityStorageAuthenticationAdminService.js +324 -0
- package/dist/es/services/entityStorageAuthenticationAdminService.js.map +1 -0
- package/dist/es/services/entityStorageAuthenticationService.js +338 -0
- package/dist/es/services/entityStorageAuthenticationService.js.map +1 -0
- package/dist/es/utils/passwordHelper.js +60 -0
- package/dist/es/utils/passwordHelper.js.map +1 -0
- package/dist/es/utils/tokenHelper.js +121 -0
- package/dist/es/utils/tokenHelper.js.map +1 -0
- package/dist/types/entities/authenticationUser.d.ts +29 -0
- package/dist/types/entities/authenticationUserV0.d.ts +33 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/models/IAuthHeaderProcessorConfig.d.ts +38 -0
- package/dist/types/models/IAuthHeaderProcessorConstructorOptions.d.ts +25 -0
- package/dist/types/models/IAuthTokenContext.d.ts +30 -0
- package/dist/types/models/IEntityStorageAuthenticationAdminServiceConfig.d.ts +25 -0
- package/dist/types/models/IEntityStorageAuthenticationAdminServiceConstructorOptions.d.ts +25 -0
- package/dist/types/models/IEntityStorageAuthenticationServiceConfig.d.ts +41 -0
- package/dist/types/models/IEntityStorageAuthenticationServiceConstructorOptions.d.ts +35 -0
- package/dist/types/processors/authHeaderProcessor.d.ts +57 -0
- package/dist/types/restEntryPoints.d.ts +5 -0
- package/dist/types/routes/entityStorageAuthenticationAdminRoutes.d.ts +62 -0
- package/dist/types/routes/entityStorageAuthenticationRoutes.d.ts +53 -0
- package/dist/types/schema.d.ts +4 -0
- package/dist/types/services/entityStorageAuthenticationAdminService.d.ts +69 -0
- package/dist/types/services/entityStorageAuthenticationService.d.ts +70 -0
- package/dist/types/utils/passwordHelper.d.ts +27 -0
- package/dist/types/utils/tokenHelper.d.ts +51 -0
- package/docs/changelog.md +19 -0
- package/docs/examples.md +94 -0
- package/docs/open-api/spec.json +1344 -0
- package/docs/reference/classes/AuthHeaderProcessor.md +197 -0
- package/docs/reference/classes/AuthenticationUser.md +61 -0
- package/docs/reference/classes/AuthenticationUserV0.md +69 -0
- package/docs/reference/classes/EntityStorageAuthenticationAdminService.md +237 -0
- package/docs/reference/classes/EntityStorageAuthenticationService.md +239 -0
- package/docs/reference/classes/PasswordHelper.md +74 -0
- package/docs/reference/classes/TokenHelper.md +163 -0
- package/docs/reference/functions/authenticationAdminCreateUser.md +37 -0
- package/docs/reference/functions/authenticationAdminGetUser.md +31 -0
- package/docs/reference/functions/authenticationAdminGetUserByIdentity.md +31 -0
- package/docs/reference/functions/authenticationAdminRemoveUser.md +31 -0
- package/docs/reference/functions/authenticationAdminUpdateUser.md +31 -0
- package/docs/reference/functions/authenticationAdminUpdateUserPassword.md +31 -0
- package/docs/reference/functions/authenticationLogin.md +31 -0
- package/docs/reference/functions/authenticationLogout.md +31 -0
- package/docs/reference/functions/authenticationPasswordPolicy.md +31 -0
- package/docs/reference/functions/authenticationRefreshToken.md +31 -0
- package/docs/reference/functions/authenticationUpdatePassword.md +31 -0
- package/docs/reference/functions/generateRestRoutesAuthentication.md +25 -0
- package/docs/reference/functions/generateRestRoutesAuthenticationAdmin.md +25 -0
- package/docs/reference/functions/initSchema.md +9 -0
- package/docs/reference/index.md +44 -0
- package/docs/reference/interfaces/IAuthHeaderProcessorConfig.md +85 -0
- package/docs/reference/interfaces/IAuthHeaderProcessorConstructorOptions.md +53 -0
- package/docs/reference/interfaces/IAuthTokenContext.md +52 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationAdminServiceConfig.md +59 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationAdminServiceConstructorOptions.md +53 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationServiceConfig.md +101 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationServiceConstructorOptions.md +81 -0
- package/docs/reference/variables/restEntryPoints.md +5 -0
- package/docs/reference/variables/tagsAuthentication.md +5 -0
- package/docs/reference/variables/tagsAuthenticationAdmin.md +5 -0
- package/locales/en.json +37 -0
- package/package.json +63 -5
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Class: EntityStorageAuthenticationService
|
|
2
|
+
|
|
3
|
+
Implementation of the authentication component using entity storage.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IAuthenticationComponent`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new EntityStorageAuthenticationService**(`options?`): `EntityStorageAuthenticationService`
|
|
14
|
+
|
|
15
|
+
Create a new instance of EntityStorageAuthentication.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`IEntityStorageAuthenticationServiceConstructorOptions`](../interfaces/IEntityStorageAuthenticationServiceConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The dependencies for the identity connector.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`EntityStorageAuthenticationService`
|
|
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
|
+
`IAuthenticationComponent.className`
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### start() {#start}
|
|
58
|
+
|
|
59
|
+
> **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
60
|
+
|
|
61
|
+
The service needs to be started when the application is initialized.
|
|
62
|
+
|
|
63
|
+
#### Parameters
|
|
64
|
+
|
|
65
|
+
##### nodeLoggingComponentType?
|
|
66
|
+
|
|
67
|
+
`string`
|
|
68
|
+
|
|
69
|
+
The node logging component type.
|
|
70
|
+
|
|
71
|
+
#### Returns
|
|
72
|
+
|
|
73
|
+
`Promise`\<`void`\>
|
|
74
|
+
|
|
75
|
+
A promise that resolves when rate-limit actions have been registered and the node identity cached.
|
|
76
|
+
|
|
77
|
+
#### Implementation of
|
|
78
|
+
|
|
79
|
+
`IAuthenticationComponent.start`
|
|
80
|
+
|
|
81
|
+
***
|
|
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
|
+
A promise that resolves when all rate-limit actions have been unregistered.
|
|
102
|
+
|
|
103
|
+
#### Implementation of
|
|
104
|
+
|
|
105
|
+
`IAuthenticationComponent.stop`
|
|
106
|
+
|
|
107
|
+
***
|
|
108
|
+
|
|
109
|
+
### login() {#login}
|
|
110
|
+
|
|
111
|
+
> **login**(`email`, `password`): `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
|
|
112
|
+
|
|
113
|
+
Perform a login for the user.
|
|
114
|
+
|
|
115
|
+
#### Parameters
|
|
116
|
+
|
|
117
|
+
##### email
|
|
118
|
+
|
|
119
|
+
`string`
|
|
120
|
+
|
|
121
|
+
The email address for the user.
|
|
122
|
+
|
|
123
|
+
##### password
|
|
124
|
+
|
|
125
|
+
`string`
|
|
126
|
+
|
|
127
|
+
The password for the user.
|
|
128
|
+
|
|
129
|
+
#### Returns
|
|
130
|
+
|
|
131
|
+
`Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
|
|
132
|
+
|
|
133
|
+
The authentication token for the user, if it uses a mechanism with public access.
|
|
134
|
+
|
|
135
|
+
#### Implementation of
|
|
136
|
+
|
|
137
|
+
`IAuthenticationComponent.login`
|
|
138
|
+
|
|
139
|
+
***
|
|
140
|
+
|
|
141
|
+
### logout() {#logout}
|
|
142
|
+
|
|
143
|
+
> **logout**(`token?`): `Promise`\<`void`\>
|
|
144
|
+
|
|
145
|
+
Logout the current user.
|
|
146
|
+
|
|
147
|
+
#### Parameters
|
|
148
|
+
|
|
149
|
+
##### token?
|
|
150
|
+
|
|
151
|
+
`string`
|
|
152
|
+
|
|
153
|
+
The token to logout, if it uses a mechanism with public access.
|
|
154
|
+
|
|
155
|
+
#### Returns
|
|
156
|
+
|
|
157
|
+
`Promise`\<`void`\>
|
|
158
|
+
|
|
159
|
+
A promise that resolves when the logout audit entry has been recorded.
|
|
160
|
+
|
|
161
|
+
#### Implementation of
|
|
162
|
+
|
|
163
|
+
`IAuthenticationComponent.logout`
|
|
164
|
+
|
|
165
|
+
***
|
|
166
|
+
|
|
167
|
+
### refresh() {#refresh}
|
|
168
|
+
|
|
169
|
+
> **refresh**(`token?`): `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
|
|
170
|
+
|
|
171
|
+
Refresh the token.
|
|
172
|
+
|
|
173
|
+
#### Parameters
|
|
174
|
+
|
|
175
|
+
##### token?
|
|
176
|
+
|
|
177
|
+
`string`
|
|
178
|
+
|
|
179
|
+
The token to refresh, if it uses a mechanism with public access.
|
|
180
|
+
|
|
181
|
+
#### Returns
|
|
182
|
+
|
|
183
|
+
`Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
|
|
184
|
+
|
|
185
|
+
The refreshed token, if it uses a mechanism with public access.
|
|
186
|
+
|
|
187
|
+
#### Implementation of
|
|
188
|
+
|
|
189
|
+
`IAuthenticationComponent.refresh`
|
|
190
|
+
|
|
191
|
+
***
|
|
192
|
+
|
|
193
|
+
### updatePassword() {#updatepassword}
|
|
194
|
+
|
|
195
|
+
> **updatePassword**(`currentPassword`, `newPassword`): `Promise`\<`void`\>
|
|
196
|
+
|
|
197
|
+
Update the user's password.
|
|
198
|
+
|
|
199
|
+
#### Parameters
|
|
200
|
+
|
|
201
|
+
##### currentPassword
|
|
202
|
+
|
|
203
|
+
`string`
|
|
204
|
+
|
|
205
|
+
The current password for the user.
|
|
206
|
+
|
|
207
|
+
##### newPassword
|
|
208
|
+
|
|
209
|
+
`string`
|
|
210
|
+
|
|
211
|
+
The new password for the user.
|
|
212
|
+
|
|
213
|
+
#### Returns
|
|
214
|
+
|
|
215
|
+
`Promise`\<`void`\>
|
|
216
|
+
|
|
217
|
+
A promise that resolves when the password has been updated and the rate limit cleared.
|
|
218
|
+
|
|
219
|
+
#### Implementation of
|
|
220
|
+
|
|
221
|
+
`IAuthenticationComponent.updatePassword`
|
|
222
|
+
|
|
223
|
+
***
|
|
224
|
+
|
|
225
|
+
### passwordPolicy() {#passwordpolicy}
|
|
226
|
+
|
|
227
|
+
> **passwordPolicy**(): `Promise`\<`IPasswordOptions`\>
|
|
228
|
+
|
|
229
|
+
Get the password policy used for password validation.
|
|
230
|
+
|
|
231
|
+
#### Returns
|
|
232
|
+
|
|
233
|
+
`Promise`\<`IPasswordOptions`\>
|
|
234
|
+
|
|
235
|
+
The password policy options.
|
|
236
|
+
|
|
237
|
+
#### Implementation of
|
|
238
|
+
|
|
239
|
+
`IAuthenticationComponent.passwordPolicy`
|
|
@@ -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?`, `options?`): `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
|
+
##### options?
|
|
65
|
+
|
|
66
|
+
`IPasswordOptions`
|
|
67
|
+
|
|
68
|
+
Optional password length validation options.
|
|
69
|
+
|
|
70
|
+
#### Returns
|
|
71
|
+
|
|
72
|
+
`Promise`\<`void`\>
|
|
73
|
+
|
|
74
|
+
A promise that resolves when the new password has been stored and the audit entry recorded.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Class: TokenHelper
|
|
2
|
+
|
|
3
|
+
Helper class for token operations.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new TokenHelper**(): `TokenHelper`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`TokenHelper`
|
|
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
|
+
### createToken() {#createtoken}
|
|
26
|
+
|
|
27
|
+
> `static` **createToken**(`vaultConnector`, `nodeId`, `signingKeyName`, `userIdentity`, `organizationIdentity`, `tenantId`, `ttlMinutes`, `passwordVersion?`): `Promise`\<\{ `token`: `string`; `expiry`: `number`; \}\>
|
|
28
|
+
|
|
29
|
+
Create a new token.
|
|
30
|
+
|
|
31
|
+
#### Parameters
|
|
32
|
+
|
|
33
|
+
##### vaultConnector
|
|
34
|
+
|
|
35
|
+
`IVaultConnector`
|
|
36
|
+
|
|
37
|
+
The vault connector.
|
|
38
|
+
|
|
39
|
+
##### nodeId
|
|
40
|
+
|
|
41
|
+
`string`
|
|
42
|
+
|
|
43
|
+
The node identifier, embedded as the JWT issuer claim.
|
|
44
|
+
|
|
45
|
+
##### signingKeyName
|
|
46
|
+
|
|
47
|
+
`string`
|
|
48
|
+
|
|
49
|
+
The signing key name, embedded as the JWT key identifier.
|
|
50
|
+
|
|
51
|
+
##### userIdentity
|
|
52
|
+
|
|
53
|
+
`string`
|
|
54
|
+
|
|
55
|
+
The subject for the token.
|
|
56
|
+
|
|
57
|
+
##### organizationIdentity
|
|
58
|
+
|
|
59
|
+
`string` \| `undefined`
|
|
60
|
+
|
|
61
|
+
The organization for the token.
|
|
62
|
+
|
|
63
|
+
##### tenantId
|
|
64
|
+
|
|
65
|
+
`string` \| `undefined`
|
|
66
|
+
|
|
67
|
+
The tenant id for the token.
|
|
68
|
+
|
|
69
|
+
##### ttlMinutes
|
|
70
|
+
|
|
71
|
+
`number`
|
|
72
|
+
|
|
73
|
+
The time to live for the token in minutes.
|
|
74
|
+
|
|
75
|
+
##### passwordVersion?
|
|
76
|
+
|
|
77
|
+
`number`
|
|
78
|
+
|
|
79
|
+
The user's current password version counter, embedded in the token so that a password change invalidates existing tokens.
|
|
80
|
+
|
|
81
|
+
#### Returns
|
|
82
|
+
|
|
83
|
+
`Promise`\<\{ `token`: `string`; `expiry`: `number`; \}\>
|
|
84
|
+
|
|
85
|
+
The new token and its expiry date.
|
|
86
|
+
|
|
87
|
+
***
|
|
88
|
+
|
|
89
|
+
### verify() {#verify}
|
|
90
|
+
|
|
91
|
+
> `static` **verify**(`vaultConnector`, `nodeId`, `signingKeyName`, `token`, `verifyUser?`): `Promise`\<\{ `header`: `JWTHeaderParameters`; `payload`: `JWTPayload`; \}\>
|
|
92
|
+
|
|
93
|
+
Verify the token.
|
|
94
|
+
|
|
95
|
+
#### Parameters
|
|
96
|
+
|
|
97
|
+
##### vaultConnector
|
|
98
|
+
|
|
99
|
+
`IVaultConnector`
|
|
100
|
+
|
|
101
|
+
The vault connector.
|
|
102
|
+
|
|
103
|
+
##### nodeId
|
|
104
|
+
|
|
105
|
+
`string`
|
|
106
|
+
|
|
107
|
+
The node identifier, expected to match the JWT issuer claim.
|
|
108
|
+
|
|
109
|
+
##### signingKeyName
|
|
110
|
+
|
|
111
|
+
`string`
|
|
112
|
+
|
|
113
|
+
The signing key name, expected to match the JWT key identifier.
|
|
114
|
+
|
|
115
|
+
##### token
|
|
116
|
+
|
|
117
|
+
`string` \| `undefined`
|
|
118
|
+
|
|
119
|
+
The token to verify.
|
|
120
|
+
|
|
121
|
+
##### verifyUser?
|
|
122
|
+
|
|
123
|
+
(`sub`, `org`, `tid`, `passwordVersion`) => `Promise`\<`string`[]\>
|
|
124
|
+
|
|
125
|
+
A function to verify the user identity and organization. The password version counter embedded in the token (pver claim) is passed so callers can detect if the password has changed since the token was issued.
|
|
126
|
+
|
|
127
|
+
#### Returns
|
|
128
|
+
|
|
129
|
+
`Promise`\<\{ `header`: `JWTHeaderParameters`; `payload`: `JWTPayload`; \}\>
|
|
130
|
+
|
|
131
|
+
The verified details.
|
|
132
|
+
|
|
133
|
+
#### Throws
|
|
134
|
+
|
|
135
|
+
UnauthorizedError if the token is missing, invalid or expired.
|
|
136
|
+
|
|
137
|
+
***
|
|
138
|
+
|
|
139
|
+
### extractTokenFromHeaders() {#extracttokenfromheaders}
|
|
140
|
+
|
|
141
|
+
> `static` **extractTokenFromHeaders**(`headers?`, `cookieName?`): \{ `token`: `string`; `location`: `"authorization"` \| `"cookie"`; \} \| `undefined`
|
|
142
|
+
|
|
143
|
+
Extract the auth token from the headers, either from the authorization header or the cookie header.
|
|
144
|
+
|
|
145
|
+
#### Parameters
|
|
146
|
+
|
|
147
|
+
##### headers?
|
|
148
|
+
|
|
149
|
+
`IHttpHeaders`
|
|
150
|
+
|
|
151
|
+
The headers to extract the token from.
|
|
152
|
+
|
|
153
|
+
##### cookieName?
|
|
154
|
+
|
|
155
|
+
`string`
|
|
156
|
+
|
|
157
|
+
The name of the cookie to extract the token from.
|
|
158
|
+
|
|
159
|
+
#### Returns
|
|
160
|
+
|
|
161
|
+
\{ `token`: `string`; `location`: `"authorization"` \| `"cookie"`; \} \| `undefined`
|
|
162
|
+
|
|
163
|
+
The token if found.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Function: authenticationAdminCreateUser()
|
|
2
|
+
|
|
3
|
+
> **authenticationAdminCreateUser**(`httpRequestContext`, `componentName`, `request`, `baseRouteName`): `Promise`\<`ICreatedResponse`\>
|
|
4
|
+
|
|
5
|
+
Create a new user.
|
|
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
|
+
`IAdminUserCreateRequest`
|
|
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: authenticationAdminGetUser()
|
|
2
|
+
|
|
3
|
+
> **authenticationAdminGetUser**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IAdminUserGetResponse`\>
|
|
4
|
+
|
|
5
|
+
Get an existing user.
|
|
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
|
+
`IAdminUserGetRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`IAdminUserGetResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: authenticationAdminGetUserByIdentity()
|
|
2
|
+
|
|
3
|
+
> **authenticationAdminGetUserByIdentity**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IAdminUserGetResponse`\>
|
|
4
|
+
|
|
5
|
+
Get an existing user by identity.
|
|
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
|
+
`IAdminUserGetByIdentityRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`IAdminUserGetResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: authenticationAdminRemoveUser()
|
|
2
|
+
|
|
3
|
+
> **authenticationAdminRemoveUser**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
Remove an existing user.
|
|
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
|
+
`IAdminUserRemoveRequest`
|
|
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: authenticationAdminUpdateUser()
|
|
2
|
+
|
|
3
|
+
> **authenticationAdminUpdateUser**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
Update an existing user.
|
|
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
|
+
`IAdminUserUpdateRequest`
|
|
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: authenticationAdminUpdateUserPassword()
|
|
2
|
+
|
|
3
|
+
> **authenticationAdminUpdateUserPassword**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
Update an existing user password.
|
|
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
|
+
`IAdminUserUpdatePasswordRequest`
|
|
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: authenticationLogin()
|
|
2
|
+
|
|
3
|
+
> **authenticationLogin**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ILoginResponse` & `IRestRouteResponseOptions`\>
|
|
4
|
+
|
|
5
|
+
Login to the server.
|
|
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
|
+
`ILoginRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`ILoginResponse` & `IRestRouteResponseOptions`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|