@twin.org/api-auth-entity-storage-service 0.0.1-next.8 → 0.0.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/dist/cjs/index.cjs +16 -18
- package/dist/esm/index.mjs +18 -20
- package/dist/types/index.d.ts +2 -0
- package/dist/types/models/IAuthHeaderProcessorConstructorOptions.d.ts +15 -0
- package/dist/types/models/IEntityStorageAuthenticationServiceConstructorOptions.d.ts +20 -0
- package/dist/types/processors/authHeaderProcessor.d.ts +10 -11
- package/dist/types/services/entityStorageAuthenticationService.d.ts +6 -9
- package/dist/types/utils/tokenHelper.d.ts +1 -1
- package/docs/changelog.md +97 -1
- package/docs/reference/classes/AuthHeaderProcessor.md +50 -28
- package/docs/reference/classes/AuthenticationUser.md +3 -3
- package/docs/reference/classes/EntityStorageAuthenticationService.md +36 -42
- package/docs/reference/classes/PasswordHelper.md +9 -5
- package/docs/reference/classes/TokenHelper.md +36 -34
- package/docs/reference/functions/authenticationLogin.md +9 -3
- package/docs/reference/functions/authenticationLogout.md +9 -3
- package/docs/reference/functions/authenticationRefreshToken.md +9 -3
- package/docs/reference/functions/generateRestRoutesAuthentication.md +8 -4
- package/docs/reference/index.md +2 -0
- package/docs/reference/interfaces/IAuthHeaderProcessorConstructorOptions.md +25 -0
- package/docs/reference/interfaces/IEntityStorageAuthenticationServiceConstructorOptions.md +39 -0
- package/locales/en.json +1 -1
- package/package.json +14 -14
package/dist/cjs/index.cjs
CHANGED
@@ -71,13 +71,12 @@ class TokenHelper {
|
|
71
71
|
* @returns The new token and its expiry date.
|
72
72
|
*/
|
73
73
|
static async createToken(vaultConnector, signingKeyName, subject, ttlMinutes) {
|
74
|
-
// Verify was a success so we can now generate a new token.
|
75
74
|
const nowSeconds = Math.trunc(Date.now() / 1000);
|
76
75
|
const ttlSeconds = ttlMinutes * 60;
|
77
|
-
const jwt = await web.Jwt.encodeWithSigner({ alg:
|
76
|
+
const jwt = await web.Jwt.encodeWithSigner({ alg: "EdDSA" }, {
|
78
77
|
sub: subject,
|
79
78
|
exp: nowSeconds + ttlSeconds
|
80
|
-
}, async (
|
79
|
+
}, async (header, payload) => vaultModels.VaultConnectorHelper.jwtSigner(vaultConnector, signingKeyName, header, payload));
|
81
80
|
return {
|
82
81
|
token: jwt,
|
83
82
|
expiry: (nowSeconds + ttlSeconds) * 1000
|
@@ -95,14 +94,10 @@ class TokenHelper {
|
|
95
94
|
if (!core.Is.stringValue(token)) {
|
96
95
|
throw new core.UnauthorizedError(this._CLASS_NAME, "missing");
|
97
96
|
}
|
98
|
-
const decoded = await web.Jwt.verifyWithVerifier(token, async (
|
99
|
-
// If
|
100
|
-
|
101
|
-
|
102
|
-
!core.Is.object(decoded.header) ||
|
103
|
-
!core.Is.object(decoded.payload) ||
|
104
|
-
!core.Is.stringValue(decoded.payload.sub)) {
|
105
|
-
throw new core.UnauthorizedError(this._CLASS_NAME, "invalidToken");
|
97
|
+
const decoded = await web.Jwt.verifyWithVerifier(token, async (t) => vaultModels.VaultConnectorHelper.jwtVerifier(vaultConnector, signingKeyName, t));
|
98
|
+
// If some of the header/payload data is not properly populated then it is unauthorized.
|
99
|
+
if (!core.Is.stringValue(decoded.payload.sub)) {
|
100
|
+
throw new core.UnauthorizedError(this._CLASS_NAME, "payloadMissingSubject");
|
106
101
|
}
|
107
102
|
else if (!core.Is.empty(decoded.payload?.exp) &&
|
108
103
|
decoded.payload.exp < Math.trunc(Date.now() / 1000)) {
|
@@ -154,6 +149,10 @@ class TokenHelper {
|
|
154
149
|
* Handle a JWT token in the authorization header or cookies and validate it to populate request context identity.
|
155
150
|
*/
|
156
151
|
class AuthHeaderProcessor {
|
152
|
+
/**
|
153
|
+
* The namespace supported by the processor.
|
154
|
+
*/
|
155
|
+
static NAMESPACE = "auth-header";
|
157
156
|
/**
|
158
157
|
* The default name for the access token as a cookie.
|
159
158
|
* @internal
|
@@ -186,8 +185,6 @@ class AuthHeaderProcessor {
|
|
186
185
|
/**
|
187
186
|
* Create a new instance of AuthCookiePreProcessor.
|
188
187
|
* @param options Options for the processor.
|
189
|
-
* @param options.vaultConnectorType The vault for the private keys, defaults to "vault".
|
190
|
-
* @param options.config The configuration for the processor.
|
191
188
|
*/
|
192
189
|
constructor(options) {
|
193
190
|
this._vaultConnector = vaultModels.VaultConnectorFactory.get(options?.vaultConnectorType ?? "vault");
|
@@ -244,13 +241,13 @@ class AuthHeaderProcessor {
|
|
244
241
|
if ((responseAuthOperation === "login" || responseAuthOperation === "refresh") &&
|
245
242
|
core.Is.stringValue(response.body?.token)) {
|
246
243
|
response.headers ??= {};
|
247
|
-
response.headers[
|
244
|
+
response.headers[web.HeaderTypes.SetCookie] =
|
248
245
|
`${this._cookieName}=${response.body.token}; Secure; HttpOnly; SameSite=None; Path=/`;
|
249
246
|
delete response.body.token;
|
250
247
|
}
|
251
248
|
else if (responseAuthOperation === "logout") {
|
252
249
|
response.headers ??= {};
|
253
|
-
response.headers[
|
250
|
+
response.headers[web.HeaderTypes.SetCookie] =
|
254
251
|
`${this._cookieName}=; Max-Age=0; Secure; HttpOnly; SameSite=None; Path=/`;
|
255
252
|
}
|
256
253
|
}
|
@@ -502,6 +499,10 @@ class PasswordHelper {
|
|
502
499
|
* Implementation of the authentication component using entity storage.
|
503
500
|
*/
|
504
501
|
class EntityStorageAuthenticationService {
|
502
|
+
/**
|
503
|
+
* The namespace supported by the authentication service.
|
504
|
+
*/
|
505
|
+
static NAMESPACE = "authentication-entity-storage";
|
505
506
|
/**
|
506
507
|
* Default TTL in minutes.
|
507
508
|
* @internal
|
@@ -539,9 +540,6 @@ class EntityStorageAuthenticationService {
|
|
539
540
|
/**
|
540
541
|
* Create a new instance of EntityStorageAuthentication.
|
541
542
|
* @param options The dependencies for the identity connector.
|
542
|
-
* @param options.userEntityStorageType The entity storage for the users, defaults to "authentication-user".
|
543
|
-
* @param options.vaultConnectorType The vault for the private keys, defaults to "vault".
|
544
|
-
* @param options.config The configuration for the authentication.
|
545
543
|
*/
|
546
544
|
constructor(options) {
|
547
545
|
this._userEntityStorage = entityStorageModels.EntityStorageConnectorFactory.get(options?.userEntityStorageType ?? "authentication-user");
|
package/dist/esm/index.mjs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { property, entity, EntitySchemaFactory, EntitySchemaHelper } from '@twin.org/entity';
|
2
2
|
import { HttpErrorHelper } from '@twin.org/api-models';
|
3
3
|
import { Is, UnauthorizedError, Guards, BaseError, ComponentFactory, Converter, GeneralError } from '@twin.org/core';
|
4
|
-
import { VaultConnectorFactory } from '@twin.org/vault-models';
|
5
|
-
import { Jwt,
|
4
|
+
import { VaultConnectorHelper, VaultConnectorFactory } from '@twin.org/vault-models';
|
5
|
+
import { Jwt, HeaderTypes, HttpStatusCode } from '@twin.org/web';
|
6
6
|
import { EntityStorageConnectorFactory } from '@twin.org/entity-storage-models';
|
7
7
|
import { Blake2b } from '@twin.org/crypto';
|
8
8
|
|
@@ -69,13 +69,12 @@ class TokenHelper {
|
|
69
69
|
* @returns The new token and its expiry date.
|
70
70
|
*/
|
71
71
|
static async createToken(vaultConnector, signingKeyName, subject, ttlMinutes) {
|
72
|
-
// Verify was a success so we can now generate a new token.
|
73
72
|
const nowSeconds = Math.trunc(Date.now() / 1000);
|
74
73
|
const ttlSeconds = ttlMinutes * 60;
|
75
|
-
const jwt = await Jwt.encodeWithSigner({ alg:
|
74
|
+
const jwt = await Jwt.encodeWithSigner({ alg: "EdDSA" }, {
|
76
75
|
sub: subject,
|
77
76
|
exp: nowSeconds + ttlSeconds
|
78
|
-
}, async (
|
77
|
+
}, async (header, payload) => VaultConnectorHelper.jwtSigner(vaultConnector, signingKeyName, header, payload));
|
79
78
|
return {
|
80
79
|
token: jwt,
|
81
80
|
expiry: (nowSeconds + ttlSeconds) * 1000
|
@@ -93,14 +92,10 @@ class TokenHelper {
|
|
93
92
|
if (!Is.stringValue(token)) {
|
94
93
|
throw new UnauthorizedError(this._CLASS_NAME, "missing");
|
95
94
|
}
|
96
|
-
const decoded = await Jwt.verifyWithVerifier(token, async (
|
97
|
-
// If
|
98
|
-
|
99
|
-
|
100
|
-
!Is.object(decoded.header) ||
|
101
|
-
!Is.object(decoded.payload) ||
|
102
|
-
!Is.stringValue(decoded.payload.sub)) {
|
103
|
-
throw new UnauthorizedError(this._CLASS_NAME, "invalidToken");
|
95
|
+
const decoded = await Jwt.verifyWithVerifier(token, async (t) => VaultConnectorHelper.jwtVerifier(vaultConnector, signingKeyName, t));
|
96
|
+
// If some of the header/payload data is not properly populated then it is unauthorized.
|
97
|
+
if (!Is.stringValue(decoded.payload.sub)) {
|
98
|
+
throw new UnauthorizedError(this._CLASS_NAME, "payloadMissingSubject");
|
104
99
|
}
|
105
100
|
else if (!Is.empty(decoded.payload?.exp) &&
|
106
101
|
decoded.payload.exp < Math.trunc(Date.now() / 1000)) {
|
@@ -152,6 +147,10 @@ class TokenHelper {
|
|
152
147
|
* Handle a JWT token in the authorization header or cookies and validate it to populate request context identity.
|
153
148
|
*/
|
154
149
|
class AuthHeaderProcessor {
|
150
|
+
/**
|
151
|
+
* The namespace supported by the processor.
|
152
|
+
*/
|
153
|
+
static NAMESPACE = "auth-header";
|
155
154
|
/**
|
156
155
|
* The default name for the access token as a cookie.
|
157
156
|
* @internal
|
@@ -184,8 +183,6 @@ class AuthHeaderProcessor {
|
|
184
183
|
/**
|
185
184
|
* Create a new instance of AuthCookiePreProcessor.
|
186
185
|
* @param options Options for the processor.
|
187
|
-
* @param options.vaultConnectorType The vault for the private keys, defaults to "vault".
|
188
|
-
* @param options.config The configuration for the processor.
|
189
186
|
*/
|
190
187
|
constructor(options) {
|
191
188
|
this._vaultConnector = VaultConnectorFactory.get(options?.vaultConnectorType ?? "vault");
|
@@ -242,13 +239,13 @@ class AuthHeaderProcessor {
|
|
242
239
|
if ((responseAuthOperation === "login" || responseAuthOperation === "refresh") &&
|
243
240
|
Is.stringValue(response.body?.token)) {
|
244
241
|
response.headers ??= {};
|
245
|
-
response.headers[
|
242
|
+
response.headers[HeaderTypes.SetCookie] =
|
246
243
|
`${this._cookieName}=${response.body.token}; Secure; HttpOnly; SameSite=None; Path=/`;
|
247
244
|
delete response.body.token;
|
248
245
|
}
|
249
246
|
else if (responseAuthOperation === "logout") {
|
250
247
|
response.headers ??= {};
|
251
|
-
response.headers[
|
248
|
+
response.headers[HeaderTypes.SetCookie] =
|
252
249
|
`${this._cookieName}=; Max-Age=0; Secure; HttpOnly; SameSite=None; Path=/`;
|
253
250
|
}
|
254
251
|
}
|
@@ -500,6 +497,10 @@ class PasswordHelper {
|
|
500
497
|
* Implementation of the authentication component using entity storage.
|
501
498
|
*/
|
502
499
|
class EntityStorageAuthenticationService {
|
500
|
+
/**
|
501
|
+
* The namespace supported by the authentication service.
|
502
|
+
*/
|
503
|
+
static NAMESPACE = "authentication-entity-storage";
|
503
504
|
/**
|
504
505
|
* Default TTL in minutes.
|
505
506
|
* @internal
|
@@ -537,9 +538,6 @@ class EntityStorageAuthenticationService {
|
|
537
538
|
/**
|
538
539
|
* Create a new instance of EntityStorageAuthentication.
|
539
540
|
* @param options The dependencies for the identity connector.
|
540
|
-
* @param options.userEntityStorageType The entity storage for the users, defaults to "authentication-user".
|
541
|
-
* @param options.vaultConnectorType The vault for the private keys, defaults to "vault".
|
542
|
-
* @param options.config The configuration for the authentication.
|
543
541
|
*/
|
544
542
|
constructor(options) {
|
545
543
|
this._userEntityStorage = EntityStorageConnectorFactory.get(options?.userEntityStorageType ?? "authentication-user");
|
package/dist/types/index.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
export * from "./entities/authenticationUser";
|
2
2
|
export * from "./models/IAuthHeaderProcessorConfig";
|
3
|
+
export * from "./models/IAuthHeaderProcessorConstructorOptions";
|
3
4
|
export * from "./models/IEntityStorageAuthenticationServiceConfig";
|
5
|
+
export * from "./models/IEntityStorageAuthenticationServiceConstructorOptions";
|
4
6
|
export * from "./processors/authHeaderProcessor";
|
5
7
|
export * from "./restEntryPoints";
|
6
8
|
export * from "./routes/entityStorageAuthenticationRoutes";
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { IAuthHeaderProcessorConfig } from "./IAuthHeaderProcessorConfig";
|
2
|
+
/**
|
3
|
+
* Options for the AuthHeaderProcessor constructor.
|
4
|
+
*/
|
5
|
+
export interface IAuthHeaderProcessorConstructorOptions {
|
6
|
+
/**
|
7
|
+
* The vault for the private keys.
|
8
|
+
* @default vault
|
9
|
+
*/
|
10
|
+
vaultConnectorType?: string;
|
11
|
+
/**
|
12
|
+
* The configuration for the processor.
|
13
|
+
*/
|
14
|
+
config?: IAuthHeaderProcessorConfig;
|
15
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import type { IEntityStorageAuthenticationServiceConfig } from "./IEntityStorageAuthenticationServiceConfig";
|
2
|
+
/**
|
3
|
+
* Options for the EntityStorageAuthenticationService constructor.
|
4
|
+
*/
|
5
|
+
export interface IEntityStorageAuthenticationServiceConstructorOptions {
|
6
|
+
/**
|
7
|
+
* The entity storage for the users.
|
8
|
+
* @default authentication-user
|
9
|
+
*/
|
10
|
+
userEntityStorageType?: string;
|
11
|
+
/**
|
12
|
+
* The vault for the private keys.
|
13
|
+
* @default vault
|
14
|
+
*/
|
15
|
+
vaultConnectorType?: string;
|
16
|
+
/**
|
17
|
+
* The configuration for the authentication.
|
18
|
+
*/
|
19
|
+
config?: IEntityStorageAuthenticationServiceConfig;
|
20
|
+
}
|
@@ -1,9 +1,13 @@
|
|
1
|
-
import { type
|
2
|
-
import type {
|
1
|
+
import { type IBaseRoute, type IBaseRouteProcessor, type IHttpRequestIdentity, type IHttpResponse, type IHttpServerRequest } from "@twin.org/api-models";
|
2
|
+
import type { IAuthHeaderProcessorConstructorOptions } from "../models/IAuthHeaderProcessorConstructorOptions";
|
3
3
|
/**
|
4
4
|
* Handle a JWT token in the authorization header or cookies and validate it to populate request context identity.
|
5
5
|
*/
|
6
|
-
export declare class AuthHeaderProcessor implements
|
6
|
+
export declare class AuthHeaderProcessor implements IBaseRouteProcessor {
|
7
|
+
/**
|
8
|
+
* The namespace supported by the processor.
|
9
|
+
*/
|
10
|
+
static readonly NAMESPACE: string;
|
7
11
|
/**
|
8
12
|
* Runtime name for the class.
|
9
13
|
*/
|
@@ -11,13 +15,8 @@ export declare class AuthHeaderProcessor implements IHttpRestRouteProcessor {
|
|
11
15
|
/**
|
12
16
|
* Create a new instance of AuthCookiePreProcessor.
|
13
17
|
* @param options Options for the processor.
|
14
|
-
* @param options.vaultConnectorType The vault for the private keys, defaults to "vault".
|
15
|
-
* @param options.config The configuration for the processor.
|
16
18
|
*/
|
17
|
-
constructor(options?:
|
18
|
-
vaultConnectorType?: string;
|
19
|
-
config?: IAuthHeaderProcessorConfig;
|
20
|
-
});
|
19
|
+
constructor(options?: IAuthHeaderProcessorConstructorOptions);
|
21
20
|
/**
|
22
21
|
* The service needs to be started when the application is initialized.
|
23
22
|
* @param nodeIdentity The identity of the node.
|
@@ -33,7 +32,7 @@ export declare class AuthHeaderProcessor implements IHttpRestRouteProcessor {
|
|
33
32
|
* @param requestIdentity The identity context for the request.
|
34
33
|
* @param processorState The state handed through the processors.
|
35
34
|
*/
|
36
|
-
pre(request: IHttpServerRequest, response: IHttpResponse, route:
|
35
|
+
pre(request: IHttpServerRequest, response: IHttpResponse, route: IBaseRoute | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
|
37
36
|
[id: string]: unknown;
|
38
37
|
}): Promise<void>;
|
39
38
|
/**
|
@@ -44,7 +43,7 @@ export declare class AuthHeaderProcessor implements IHttpRestRouteProcessor {
|
|
44
43
|
* @param requestIdentity The identity context for the request.
|
45
44
|
* @param processorState The state handed through the processors.
|
46
45
|
*/
|
47
|
-
post(request: IHttpServerRequest, response: IHttpResponse, route:
|
46
|
+
post(request: IHttpServerRequest, response: IHttpResponse, route: IBaseRoute | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
|
48
47
|
[id: string]: unknown;
|
49
48
|
}): Promise<void>;
|
50
49
|
}
|
@@ -1,9 +1,13 @@
|
|
1
1
|
import type { IAuthenticationComponent } from "@twin.org/api-auth-entity-storage-models";
|
2
|
-
import type {
|
2
|
+
import type { IEntityStorageAuthenticationServiceConstructorOptions } from "../models/IEntityStorageAuthenticationServiceConstructorOptions";
|
3
3
|
/**
|
4
4
|
* Implementation of the authentication component using entity storage.
|
5
5
|
*/
|
6
6
|
export declare class EntityStorageAuthenticationService implements IAuthenticationComponent {
|
7
|
+
/**
|
8
|
+
* The namespace supported by the authentication service.
|
9
|
+
*/
|
10
|
+
static readonly NAMESPACE: string;
|
7
11
|
/**
|
8
12
|
* Runtime name for the class.
|
9
13
|
*/
|
@@ -11,15 +15,8 @@ export declare class EntityStorageAuthenticationService implements IAuthenticati
|
|
11
15
|
/**
|
12
16
|
* Create a new instance of EntityStorageAuthentication.
|
13
17
|
* @param options The dependencies for the identity connector.
|
14
|
-
* @param options.userEntityStorageType The entity storage for the users, defaults to "authentication-user".
|
15
|
-
* @param options.vaultConnectorType The vault for the private keys, defaults to "vault".
|
16
|
-
* @param options.config The configuration for the authentication.
|
17
18
|
*/
|
18
|
-
constructor(options?:
|
19
|
-
userEntityStorageType?: string;
|
20
|
-
vaultConnectorType?: string;
|
21
|
-
config?: IEntityStorageAuthenticationServiceConfig;
|
22
|
-
});
|
19
|
+
constructor(options?: IEntityStorageAuthenticationServiceConstructorOptions);
|
23
20
|
/**
|
24
21
|
* The service needs to be started when the application is initialized.
|
25
22
|
* @param nodeIdentity The identity of the node.
|
package/docs/changelog.md
CHANGED
@@ -1,5 +1,101 @@
|
|
1
1
|
# @twin.org/api-auth-entity-storage-service - Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## 0.0.1 (2025-07-03)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* release to production ([70ee2d5](https://github.com/twinfoundation/api/commit/70ee2d56a1dc9537d7c9c154d4cb78a235678a3a))
|
9
|
+
|
10
|
+
|
11
|
+
### Dependencies
|
12
|
+
|
13
|
+
* The following workspace dependencies were updated
|
14
|
+
* dependencies
|
15
|
+
* @twin.org/api-auth-entity-storage-models bumped from ^0.0.0 to ^0.0.1
|
16
|
+
* @twin.org/api-core bumped from ^0.0.0 to ^0.0.1
|
17
|
+
* @twin.org/api-models bumped from ^0.0.0 to ^0.0.1
|
18
|
+
|
19
|
+
## [0.0.1-next.36](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.1-next.35...api-auth-entity-storage-service-v0.0.1-next.36) (2025-06-17)
|
20
|
+
|
21
|
+
|
22
|
+
### Miscellaneous Chores
|
23
|
+
|
24
|
+
* **api-auth-entity-storage-service:** Synchronize repo versions
|
25
|
+
|
26
|
+
|
27
|
+
### Dependencies
|
28
|
+
|
29
|
+
* The following workspace dependencies were updated
|
30
|
+
* dependencies
|
31
|
+
* @twin.org/api-auth-entity-storage-models bumped from 0.0.1-next.35 to 0.0.1-next.36
|
32
|
+
* @twin.org/api-core bumped from 0.0.1-next.35 to 0.0.1-next.36
|
33
|
+
* @twin.org/api-models bumped from 0.0.1-next.35 to 0.0.1-next.36
|
34
|
+
|
35
|
+
## [0.0.1-next.35](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.1-next.34...api-auth-entity-storage-service-v0.0.1-next.35) (2025-06-11)
|
36
|
+
|
37
|
+
|
38
|
+
### Features
|
39
|
+
|
40
|
+
* update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
|
41
|
+
|
42
|
+
|
43
|
+
### Dependencies
|
44
|
+
|
45
|
+
* The following workspace dependencies were updated
|
46
|
+
* dependencies
|
47
|
+
* @twin.org/api-auth-entity-storage-models bumped from 0.0.1-next.34 to 0.0.1-next.35
|
48
|
+
* @twin.org/api-core bumped from 0.0.1-next.34 to 0.0.1-next.35
|
49
|
+
* @twin.org/api-models bumped from 0.0.1-next.34 to 0.0.1-next.35
|
50
|
+
|
51
|
+
## [0.0.1-next.34](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.1-next.33...api-auth-entity-storage-service-v0.0.1-next.34) (2025-05-27)
|
52
|
+
|
53
|
+
|
54
|
+
### Miscellaneous Chores
|
55
|
+
|
56
|
+
* **api-auth-entity-storage-service:** Synchronize repo versions
|
57
|
+
|
58
|
+
|
59
|
+
### Dependencies
|
60
|
+
|
61
|
+
* The following workspace dependencies were updated
|
62
|
+
* dependencies
|
63
|
+
* @twin.org/api-auth-entity-storage-models bumped from 0.0.1-next.33 to 0.0.1-next.34
|
64
|
+
* @twin.org/api-core bumped from 0.0.1-next.33 to 0.0.1-next.34
|
65
|
+
* @twin.org/api-models bumped from 0.0.1-next.33 to 0.0.1-next.34
|
66
|
+
|
67
|
+
## [0.0.1-next.33](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.1-next.32...api-auth-entity-storage-service-v0.0.1-next.33) (2025-04-17)
|
68
|
+
|
69
|
+
|
70
|
+
### Features
|
71
|
+
|
72
|
+
* use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
|
73
|
+
|
74
|
+
|
75
|
+
### Dependencies
|
76
|
+
|
77
|
+
* The following workspace dependencies were updated
|
78
|
+
* dependencies
|
79
|
+
* @twin.org/api-auth-entity-storage-models bumped from 0.0.1-next.32 to 0.0.1-next.33
|
80
|
+
* @twin.org/api-core bumped from 0.0.1-next.32 to 0.0.1-next.33
|
81
|
+
* @twin.org/api-models bumped from 0.0.1-next.32 to 0.0.1-next.33
|
82
|
+
|
83
|
+
## [0.0.1-next.32](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.1-next.31...api-auth-entity-storage-service-v0.0.1-next.32) (2025-03-28)
|
84
|
+
|
85
|
+
|
86
|
+
### Miscellaneous Chores
|
87
|
+
|
88
|
+
* **api-auth-entity-storage-service:** Synchronize repo versions
|
89
|
+
|
90
|
+
|
91
|
+
### Dependencies
|
92
|
+
|
93
|
+
* The following workspace dependencies were updated
|
94
|
+
* dependencies
|
95
|
+
* @twin.org/api-auth-entity-storage-models bumped from 0.0.1-next.31 to 0.0.1-next.32
|
96
|
+
* @twin.org/api-core bumped from 0.0.1-next.31 to 0.0.1-next.32
|
97
|
+
* @twin.org/api-models bumped from 0.0.1-next.31 to 0.0.1-next.32
|
98
|
+
|
99
|
+
## v0.0.1-next.31
|
4
100
|
|
5
101
|
- Initial Release
|
@@ -4,35 +4,37 @@ Handle a JWT token in the authorization header or cookies and validate it to pop
|
|
4
4
|
|
5
5
|
## Implements
|
6
6
|
|
7
|
-
- `
|
7
|
+
- `IBaseRouteProcessor`
|
8
8
|
|
9
9
|
## Constructors
|
10
10
|
|
11
|
-
###
|
11
|
+
### Constructor
|
12
12
|
|
13
|
-
> **new AuthHeaderProcessor**(`options
|
13
|
+
> **new AuthHeaderProcessor**(`options?`): `AuthHeaderProcessor`
|
14
14
|
|
15
15
|
Create a new instance of AuthCookiePreProcessor.
|
16
16
|
|
17
17
|
#### Parameters
|
18
18
|
|
19
|
-
|
19
|
+
##### options?
|
20
|
+
|
21
|
+
[`IAuthHeaderProcessorConstructorOptions`](../interfaces/IAuthHeaderProcessorConstructorOptions.md)
|
20
22
|
|
21
23
|
Options for the processor.
|
22
24
|
|
23
|
-
|
25
|
+
#### Returns
|
24
26
|
|
25
|
-
|
27
|
+
`AuthHeaderProcessor`
|
26
28
|
|
27
|
-
|
29
|
+
## Properties
|
28
30
|
|
29
|
-
|
31
|
+
### NAMESPACE
|
30
32
|
|
31
|
-
|
33
|
+
> `readonly` `static` **NAMESPACE**: `string` = `"auth-header"`
|
32
34
|
|
33
|
-
|
35
|
+
The namespace supported by the processor.
|
34
36
|
|
35
|
-
|
37
|
+
***
|
36
38
|
|
37
39
|
### CLASS\_NAME
|
38
40
|
|
@@ -42,23 +44,27 @@ Runtime name for the class.
|
|
42
44
|
|
43
45
|
#### Implementation of
|
44
46
|
|
45
|
-
`
|
47
|
+
`IBaseRouteProcessor.CLASS_NAME`
|
46
48
|
|
47
49
|
## Methods
|
48
50
|
|
49
51
|
### start()
|
50
52
|
|
51
|
-
> **start**(`nodeIdentity`, `nodeLoggingConnectorType
|
53
|
+
> **start**(`nodeIdentity`, `nodeLoggingConnectorType?`): `Promise`\<`void`\>
|
52
54
|
|
53
55
|
The service needs to be started when the application is initialized.
|
54
56
|
|
55
57
|
#### Parameters
|
56
58
|
|
57
|
-
|
59
|
+
##### nodeIdentity
|
60
|
+
|
61
|
+
`string`
|
58
62
|
|
59
63
|
The identity of the node.
|
60
64
|
|
61
|
-
|
65
|
+
##### nodeLoggingConnectorType?
|
66
|
+
|
67
|
+
`string`
|
62
68
|
|
63
69
|
The node logging connector type, defaults to "node-logging".
|
64
70
|
|
@@ -70,7 +76,7 @@ Nothing.
|
|
70
76
|
|
71
77
|
#### Implementation of
|
72
78
|
|
73
|
-
`
|
79
|
+
`IBaseRouteProcessor.start`
|
74
80
|
|
75
81
|
***
|
76
82
|
|
@@ -82,23 +88,31 @@ Pre process the REST request for the specified route.
|
|
82
88
|
|
83
89
|
#### Parameters
|
84
90
|
|
85
|
-
|
91
|
+
##### request
|
92
|
+
|
93
|
+
`IHttpServerRequest`
|
86
94
|
|
87
95
|
The incoming request.
|
88
96
|
|
89
|
-
|
97
|
+
##### response
|
98
|
+
|
99
|
+
`IHttpResponse`
|
90
100
|
|
91
101
|
The outgoing response.
|
92
102
|
|
93
|
-
|
103
|
+
##### route
|
94
104
|
|
95
105
|
The route to process.
|
96
106
|
|
97
|
-
|
107
|
+
`undefined` | `IBaseRoute`
|
108
|
+
|
109
|
+
##### requestIdentity
|
110
|
+
|
111
|
+
`IHttpRequestIdentity`
|
98
112
|
|
99
113
|
The identity context for the request.
|
100
114
|
|
101
|
-
|
115
|
+
##### processorState
|
102
116
|
|
103
117
|
The state handed through the processors.
|
104
118
|
|
@@ -108,7 +122,7 @@ The state handed through the processors.
|
|
108
122
|
|
109
123
|
#### Implementation of
|
110
124
|
|
111
|
-
`
|
125
|
+
`IBaseRouteProcessor.pre`
|
112
126
|
|
113
127
|
***
|
114
128
|
|
@@ -120,23 +134,31 @@ Post process the REST request for the specified route.
|
|
120
134
|
|
121
135
|
#### Parameters
|
122
136
|
|
123
|
-
|
137
|
+
##### request
|
138
|
+
|
139
|
+
`IHttpServerRequest`
|
124
140
|
|
125
141
|
The incoming request.
|
126
142
|
|
127
|
-
|
143
|
+
##### response
|
144
|
+
|
145
|
+
`IHttpResponse`
|
128
146
|
|
129
147
|
The outgoing response.
|
130
148
|
|
131
|
-
|
149
|
+
##### route
|
132
150
|
|
133
151
|
The route to process.
|
134
152
|
|
135
|
-
|
153
|
+
`undefined` | `IBaseRoute`
|
154
|
+
|
155
|
+
##### requestIdentity
|
156
|
+
|
157
|
+
`IHttpRequestIdentity`
|
136
158
|
|
137
159
|
The identity context for the request.
|
138
160
|
|
139
|
-
|
161
|
+
##### processorState
|
140
162
|
|
141
163
|
The state handed through the processors.
|
142
164
|
|
@@ -146,4 +168,4 @@ The state handed through the processors.
|
|
146
168
|
|
147
169
|
#### Implementation of
|
148
170
|
|
149
|
-
`
|
171
|
+
`IBaseRouteProcessor.post`
|
@@ -4,13 +4,13 @@ Class defining the storage for user login credentials.
|
|
4
4
|
|
5
5
|
## Constructors
|
6
6
|
|
7
|
-
###
|
7
|
+
### Constructor
|
8
8
|
|
9
|
-
> **new AuthenticationUser**():
|
9
|
+
> **new AuthenticationUser**(): `AuthenticationUser`
|
10
10
|
|
11
11
|
#### Returns
|
12
12
|
|
13
|
-
|
13
|
+
`AuthenticationUser`
|
14
14
|
|
15
15
|
## Properties
|
16
16
|
|
@@ -8,35 +8,33 @@ Implementation of the authentication component using entity storage.
|
|
8
8
|
|
9
9
|
## Constructors
|
10
10
|
|
11
|
-
###
|
11
|
+
### Constructor
|
12
12
|
|
13
|
-
> **new EntityStorageAuthenticationService**(`options
|
13
|
+
> **new EntityStorageAuthenticationService**(`options?`): `EntityStorageAuthenticationService`
|
14
14
|
|
15
15
|
Create a new instance of EntityStorageAuthentication.
|
16
16
|
|
17
17
|
#### Parameters
|
18
18
|
|
19
|
-
|
19
|
+
##### options?
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
• **options.userEntityStorageType?**: `string`
|
21
|
+
[`IEntityStorageAuthenticationServiceConstructorOptions`](../interfaces/IEntityStorageAuthenticationServiceConstructorOptions.md)
|
24
22
|
|
25
|
-
The
|
23
|
+
The dependencies for the identity connector.
|
26
24
|
|
27
|
-
|
25
|
+
#### Returns
|
28
26
|
|
29
|
-
|
27
|
+
`EntityStorageAuthenticationService`
|
30
28
|
|
31
|
-
|
29
|
+
## Properties
|
32
30
|
|
33
|
-
|
31
|
+
### NAMESPACE
|
34
32
|
|
35
|
-
|
33
|
+
> `readonly` `static` **NAMESPACE**: `string` = `"authentication-entity-storage"`
|
36
34
|
|
37
|
-
|
35
|
+
The namespace supported by the authentication service.
|
38
36
|
|
39
|
-
|
37
|
+
***
|
40
38
|
|
41
39
|
### CLASS\_NAME
|
42
40
|
|
@@ -52,17 +50,21 @@ Runtime name for the class.
|
|
52
50
|
|
53
51
|
### start()
|
54
52
|
|
55
|
-
> **start**(`nodeIdentity`, `nodeLoggingConnectorType
|
53
|
+
> **start**(`nodeIdentity`, `nodeLoggingConnectorType?`): `Promise`\<`void`\>
|
56
54
|
|
57
55
|
The service needs to be started when the application is initialized.
|
58
56
|
|
59
57
|
#### Parameters
|
60
58
|
|
61
|
-
|
59
|
+
##### nodeIdentity
|
60
|
+
|
61
|
+
`string`
|
62
62
|
|
63
63
|
The identity of the node.
|
64
64
|
|
65
|
-
|
65
|
+
##### nodeLoggingConnectorType?
|
66
|
+
|
67
|
+
`string`
|
66
68
|
|
67
69
|
The node logging connector type, defaults to "node-logging".
|
68
70
|
|
@@ -80,34 +82,30 @@ Nothing.
|
|
80
82
|
|
81
83
|
### login()
|
82
84
|
|
83
|
-
> **login**(`email`, `password`): `Promise
|
85
|
+
> **login**(`email`, `password`): `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
|
84
86
|
|
85
87
|
Perform a login for the user.
|
86
88
|
|
87
89
|
#### Parameters
|
88
90
|
|
89
|
-
|
91
|
+
##### email
|
92
|
+
|
93
|
+
`string`
|
90
94
|
|
91
95
|
The email address for the user.
|
92
96
|
|
93
|
-
|
97
|
+
##### password
|
98
|
+
|
99
|
+
`string`
|
94
100
|
|
95
101
|
The password for the user.
|
96
102
|
|
97
103
|
#### Returns
|
98
104
|
|
99
|
-
`Promise
|
105
|
+
`Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
|
100
106
|
|
101
107
|
The authentication token for the user, if it uses a mechanism with public access.
|
102
108
|
|
103
|
-
##### token?
|
104
|
-
|
105
|
-
> `optional` **token**: `string`
|
106
|
-
|
107
|
-
##### expiry
|
108
|
-
|
109
|
-
> **expiry**: `number`
|
110
|
-
|
111
109
|
#### Implementation of
|
112
110
|
|
113
111
|
`IAuthenticationComponent.login`
|
@@ -116,13 +114,15 @@ The authentication token for the user, if it uses a mechanism with public access
|
|
116
114
|
|
117
115
|
### logout()
|
118
116
|
|
119
|
-
> **logout**(`token
|
117
|
+
> **logout**(`token?`): `Promise`\<`void`\>
|
120
118
|
|
121
119
|
Logout the current user.
|
122
120
|
|
123
121
|
#### Parameters
|
124
122
|
|
125
|
-
|
123
|
+
##### token?
|
124
|
+
|
125
|
+
`string`
|
126
126
|
|
127
127
|
The token to logout, if it uses a mechanism with public access.
|
128
128
|
|
@@ -140,30 +140,24 @@ Nothing.
|
|
140
140
|
|
141
141
|
### refresh()
|
142
142
|
|
143
|
-
> **refresh**(`token
|
143
|
+
> **refresh**(`token?`): `Promise`\<\{ `token`: `string`; `expiry`: `number`; \}\>
|
144
144
|
|
145
145
|
Refresh the token.
|
146
146
|
|
147
147
|
#### Parameters
|
148
148
|
|
149
|
-
|
149
|
+
##### token?
|
150
|
+
|
151
|
+
`string`
|
150
152
|
|
151
153
|
The token to refresh, if it uses a mechanism with public access.
|
152
154
|
|
153
155
|
#### Returns
|
154
156
|
|
155
|
-
`Promise
|
157
|
+
`Promise`\<\{ `token`: `string`; `expiry`: `number`; \}\>
|
156
158
|
|
157
159
|
The refreshed token, if it uses a mechanism with public access.
|
158
160
|
|
159
|
-
##### token
|
160
|
-
|
161
|
-
> **token**: `string`
|
162
|
-
|
163
|
-
##### expiry
|
164
|
-
|
165
|
-
> **expiry**: `number`
|
166
|
-
|
167
161
|
#### Implementation of
|
168
162
|
|
169
163
|
`IAuthenticationComponent.refresh`
|
@@ -4,13 +4,13 @@ Helper class for password operations.
|
|
4
4
|
|
5
5
|
## Constructors
|
6
6
|
|
7
|
-
###
|
7
|
+
### Constructor
|
8
8
|
|
9
|
-
> **new PasswordHelper**():
|
9
|
+
> **new PasswordHelper**(): `PasswordHelper`
|
10
10
|
|
11
11
|
#### Returns
|
12
12
|
|
13
|
-
|
13
|
+
`PasswordHelper`
|
14
14
|
|
15
15
|
## Methods
|
16
16
|
|
@@ -22,11 +22,15 @@ Hash the password for the user.
|
|
22
22
|
|
23
23
|
#### Parameters
|
24
24
|
|
25
|
-
|
25
|
+
##### passwordBytes
|
26
|
+
|
27
|
+
`Uint8Array`
|
26
28
|
|
27
29
|
The password bytes.
|
28
30
|
|
29
|
-
|
31
|
+
##### saltBytes
|
32
|
+
|
33
|
+
`Uint8Array`
|
30
34
|
|
31
35
|
The salt bytes.
|
32
36
|
|
@@ -4,90 +4,88 @@ Helper class for token operations.
|
|
4
4
|
|
5
5
|
## Constructors
|
6
6
|
|
7
|
-
###
|
7
|
+
### Constructor
|
8
8
|
|
9
|
-
> **new TokenHelper**():
|
9
|
+
> **new TokenHelper**(): `TokenHelper`
|
10
10
|
|
11
11
|
#### Returns
|
12
12
|
|
13
|
-
|
13
|
+
`TokenHelper`
|
14
14
|
|
15
15
|
## Methods
|
16
16
|
|
17
17
|
### createToken()
|
18
18
|
|
19
|
-
> `static` **createToken**(`vaultConnector`, `signingKeyName`, `subject`, `ttlMinutes`): `Promise
|
19
|
+
> `static` **createToken**(`vaultConnector`, `signingKeyName`, `subject`, `ttlMinutes`): `Promise`\<\{ `token`: `string`; `expiry`: `number`; \}\>
|
20
20
|
|
21
21
|
Create a new token.
|
22
22
|
|
23
23
|
#### Parameters
|
24
24
|
|
25
|
-
|
25
|
+
##### vaultConnector
|
26
|
+
|
27
|
+
`IVaultConnector`
|
26
28
|
|
27
29
|
The vault connector.
|
28
30
|
|
29
|
-
|
31
|
+
##### signingKeyName
|
32
|
+
|
33
|
+
`string`
|
30
34
|
|
31
35
|
The signing key name.
|
32
36
|
|
33
|
-
|
37
|
+
##### subject
|
38
|
+
|
39
|
+
`string`
|
34
40
|
|
35
41
|
The subject for the token.
|
36
42
|
|
37
|
-
|
43
|
+
##### ttlMinutes
|
44
|
+
|
45
|
+
`number`
|
38
46
|
|
39
47
|
The time to live for the token in minutes.
|
40
48
|
|
41
49
|
#### Returns
|
42
50
|
|
43
|
-
`Promise
|
51
|
+
`Promise`\<\{ `token`: `string`; `expiry`: `number`; \}\>
|
44
52
|
|
45
53
|
The new token and its expiry date.
|
46
54
|
|
47
|
-
##### token
|
48
|
-
|
49
|
-
> **token**: `string`
|
50
|
-
|
51
|
-
##### expiry
|
52
|
-
|
53
|
-
> **expiry**: `number`
|
54
|
-
|
55
55
|
***
|
56
56
|
|
57
57
|
### verify()
|
58
58
|
|
59
|
-
> `static` **verify**(`vaultConnector`, `signingKeyName`, `token`): `Promise
|
59
|
+
> `static` **verify**(`vaultConnector`, `signingKeyName`, `token`): `Promise`\<\{ `header`: `IJwtHeader`; `payload`: `IJwtPayload`; \}\>
|
60
60
|
|
61
61
|
Verify the token.
|
62
62
|
|
63
63
|
#### Parameters
|
64
64
|
|
65
|
-
|
65
|
+
##### vaultConnector
|
66
|
+
|
67
|
+
`IVaultConnector`
|
66
68
|
|
67
69
|
The vault connector.
|
68
70
|
|
69
|
-
|
71
|
+
##### signingKeyName
|
72
|
+
|
73
|
+
`string`
|
70
74
|
|
71
75
|
The signing key name.
|
72
76
|
|
73
|
-
|
77
|
+
##### token
|
74
78
|
|
75
79
|
The token to verify.
|
76
80
|
|
81
|
+
`undefined` | `string`
|
82
|
+
|
77
83
|
#### Returns
|
78
84
|
|
79
|
-
`Promise
|
85
|
+
`Promise`\<\{ `header`: `IJwtHeader`; `payload`: `IJwtPayload`; \}\>
|
80
86
|
|
81
87
|
The verified details.
|
82
88
|
|
83
|
-
##### header
|
84
|
-
|
85
|
-
> **header**: `IJwtHeader`
|
86
|
-
|
87
|
-
##### payload
|
88
|
-
|
89
|
-
> **payload**: `IJwtPayload`
|
90
|
-
|
91
89
|
#### Throws
|
92
90
|
|
93
91
|
UnauthorizedError if the token is missing, invalid or expired.
|
@@ -96,22 +94,26 @@ UnauthorizedError if the token is missing, invalid or expired.
|
|
96
94
|
|
97
95
|
### extractTokenFromHeaders()
|
98
96
|
|
99
|
-
> `static` **extractTokenFromHeaders**(`headers
|
97
|
+
> `static` **extractTokenFromHeaders**(`headers?`, `cookieName?`): `undefined` \| \{ `token`: `string`; `location`: `"authorization"` \| `"cookie"`; \}
|
100
98
|
|
101
99
|
Extract the auth token from the headers, either from the authorization header or the cookie header.
|
102
100
|
|
103
101
|
#### Parameters
|
104
102
|
|
105
|
-
|
103
|
+
##### headers?
|
104
|
+
|
105
|
+
`IHttpHeaders`
|
106
106
|
|
107
107
|
The headers to extract the token from.
|
108
108
|
|
109
|
-
|
109
|
+
##### cookieName?
|
110
|
+
|
111
|
+
`string`
|
110
112
|
|
111
113
|
The name of the cookie to extract the token from.
|
112
114
|
|
113
115
|
#### Returns
|
114
116
|
|
115
|
-
`undefined` \| `
|
117
|
+
`undefined` \| \{ `token`: `string`; `location`: `"authorization"` \| `"cookie"`; \}
|
116
118
|
|
117
119
|
The token if found.
|
@@ -6,15 +6,21 @@ Login to the server.
|
|
6
6
|
|
7
7
|
## Parameters
|
8
8
|
|
9
|
-
|
9
|
+
### httpRequestContext
|
10
|
+
|
11
|
+
`IHttpRequestContext`
|
10
12
|
|
11
13
|
The request context for the API.
|
12
14
|
|
13
|
-
|
15
|
+
### componentName
|
16
|
+
|
17
|
+
`string`
|
14
18
|
|
15
19
|
The name of the component to use in the routes.
|
16
20
|
|
17
|
-
|
21
|
+
### request
|
22
|
+
|
23
|
+
`ILoginRequest`
|
18
24
|
|
19
25
|
The request.
|
20
26
|
|
@@ -6,15 +6,21 @@ Logout from the server.
|
|
6
6
|
|
7
7
|
## Parameters
|
8
8
|
|
9
|
-
|
9
|
+
### httpRequestContext
|
10
|
+
|
11
|
+
`IHttpRequestContext`
|
10
12
|
|
11
13
|
The request context for the API.
|
12
14
|
|
13
|
-
|
15
|
+
### componentName
|
16
|
+
|
17
|
+
`string`
|
14
18
|
|
15
19
|
The name of the component to use in the routes.
|
16
20
|
|
17
|
-
|
21
|
+
### request
|
22
|
+
|
23
|
+
`ILogoutRequest`
|
18
24
|
|
19
25
|
The request.
|
20
26
|
|
@@ -6,15 +6,21 @@ Refresh the login token.
|
|
6
6
|
|
7
7
|
## Parameters
|
8
8
|
|
9
|
-
|
9
|
+
### httpRequestContext
|
10
|
+
|
11
|
+
`IHttpRequestContext`
|
10
12
|
|
11
13
|
The request context for the API.
|
12
14
|
|
13
|
-
|
15
|
+
### componentName
|
16
|
+
|
17
|
+
`string`
|
14
18
|
|
15
19
|
The name of the component to use in the routes.
|
16
20
|
|
17
|
-
|
21
|
+
### request
|
22
|
+
|
23
|
+
`IRefreshTokenRequest`
|
18
24
|
|
19
25
|
The request.
|
20
26
|
|
@@ -1,21 +1,25 @@
|
|
1
1
|
# Function: generateRestRoutesAuthentication()
|
2
2
|
|
3
|
-
> **generateRestRoutesAuthentication**(`baseRouteName`, `componentName`): `IRestRoute`[]
|
3
|
+
> **generateRestRoutesAuthentication**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
|
4
4
|
|
5
5
|
The REST routes for authentication.
|
6
6
|
|
7
7
|
## Parameters
|
8
8
|
|
9
|
-
|
9
|
+
### baseRouteName
|
10
|
+
|
11
|
+
`string`
|
10
12
|
|
11
13
|
Prefix to prepend to the paths.
|
12
14
|
|
13
|
-
|
15
|
+
### componentName
|
16
|
+
|
17
|
+
`string`
|
14
18
|
|
15
19
|
The name of the component to use in the routes stored in the ComponentFactory.
|
16
20
|
|
17
21
|
## Returns
|
18
22
|
|
19
|
-
`IRestRoute`[]
|
23
|
+
`IRestRoute`\<`any`, `any`\>[]
|
20
24
|
|
21
25
|
The generated routes.
|
package/docs/reference/index.md
CHANGED
@@ -11,7 +11,9 @@
|
|
11
11
|
## Interfaces
|
12
12
|
|
13
13
|
- [IAuthHeaderProcessorConfig](interfaces/IAuthHeaderProcessorConfig.md)
|
14
|
+
- [IAuthHeaderProcessorConstructorOptions](interfaces/IAuthHeaderProcessorConstructorOptions.md)
|
14
15
|
- [IEntityStorageAuthenticationServiceConfig](interfaces/IEntityStorageAuthenticationServiceConfig.md)
|
16
|
+
- [IEntityStorageAuthenticationServiceConstructorOptions](interfaces/IEntityStorageAuthenticationServiceConstructorOptions.md)
|
15
17
|
|
16
18
|
## Variables
|
17
19
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Interface: IAuthHeaderProcessorConstructorOptions
|
2
|
+
|
3
|
+
Options for the AuthHeaderProcessor constructor.
|
4
|
+
|
5
|
+
## Properties
|
6
|
+
|
7
|
+
### vaultConnectorType?
|
8
|
+
|
9
|
+
> `optional` **vaultConnectorType**: `string`
|
10
|
+
|
11
|
+
The vault for the private keys.
|
12
|
+
|
13
|
+
#### Default
|
14
|
+
|
15
|
+
```ts
|
16
|
+
vault
|
17
|
+
```
|
18
|
+
|
19
|
+
***
|
20
|
+
|
21
|
+
### config?
|
22
|
+
|
23
|
+
> `optional` **config**: [`IAuthHeaderProcessorConfig`](IAuthHeaderProcessorConfig.md)
|
24
|
+
|
25
|
+
The configuration for the processor.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Interface: IEntityStorageAuthenticationServiceConstructorOptions
|
2
|
+
|
3
|
+
Options for the EntityStorageAuthenticationService constructor.
|
4
|
+
|
5
|
+
## Properties
|
6
|
+
|
7
|
+
### userEntityStorageType?
|
8
|
+
|
9
|
+
> `optional` **userEntityStorageType**: `string`
|
10
|
+
|
11
|
+
The entity storage for the users.
|
12
|
+
|
13
|
+
#### Default
|
14
|
+
|
15
|
+
```ts
|
16
|
+
authentication-user
|
17
|
+
```
|
18
|
+
|
19
|
+
***
|
20
|
+
|
21
|
+
### vaultConnectorType?
|
22
|
+
|
23
|
+
> `optional` **vaultConnectorType**: `string`
|
24
|
+
|
25
|
+
The vault for the private keys.
|
26
|
+
|
27
|
+
#### Default
|
28
|
+
|
29
|
+
```ts
|
30
|
+
vault
|
31
|
+
```
|
32
|
+
|
33
|
+
***
|
34
|
+
|
35
|
+
### config?
|
36
|
+
|
37
|
+
> `optional` **config**: [`IEntityStorageAuthenticationServiceConfig`](IEntityStorageAuthenticationServiceConfig.md)
|
38
|
+
|
39
|
+
The configuration for the authentication.
|
package/locales/en.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
},
|
12
12
|
"tokenHelper": {
|
13
13
|
"missing": "The JSON Web token could not be found in the authorization header",
|
14
|
-
"
|
14
|
+
"payloadMissingSubject": "The JSON Web token payload does not contain a subject",
|
15
15
|
"expired": "The JSON Web token has expired"
|
16
16
|
}
|
17
17
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@twin.org/api-auth-entity-storage-service",
|
3
|
-
"version": "0.0.1
|
3
|
+
"version": "0.0.1",
|
4
4
|
"description": "Auth Entity Storage contract implementation and REST endpoint definitions",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -14,26 +14,26 @@
|
|
14
14
|
"node": ">=20.0.0"
|
15
15
|
},
|
16
16
|
"dependencies": {
|
17
|
-
"@twin.org/api-auth-entity-storage-models": "0.0.1
|
18
|
-
"@twin.org/api-core": "0.0.1
|
19
|
-
"@twin.org/api-models": "0.0.1
|
20
|
-
"@twin.org/core": "
|
21
|
-
"@twin.org/crypto": "
|
22
|
-
"@twin.org/entity": "
|
23
|
-
"@twin.org/entity-storage-models": "next",
|
24
|
-
"@twin.org/logging-models": "next",
|
25
|
-
"@twin.org/nameof": "
|
26
|
-
"@twin.org/vault-models": "next",
|
27
|
-
"@twin.org/web": "
|
17
|
+
"@twin.org/api-auth-entity-storage-models": "^0.0.1",
|
18
|
+
"@twin.org/api-core": "^0.0.1",
|
19
|
+
"@twin.org/api-models": "^0.0.1",
|
20
|
+
"@twin.org/core": "^0.0.1",
|
21
|
+
"@twin.org/crypto": "^0.0.1",
|
22
|
+
"@twin.org/entity": "^0.0.1",
|
23
|
+
"@twin.org/entity-storage-models": "^0.0.1-next.2",
|
24
|
+
"@twin.org/logging-models": "^0.0.1-next.2",
|
25
|
+
"@twin.org/nameof": "^0.0.1",
|
26
|
+
"@twin.org/vault-models": "^0.0.1-next.2",
|
27
|
+
"@twin.org/web": "^0.0.1"
|
28
28
|
},
|
29
29
|
"main": "./dist/cjs/index.cjs",
|
30
30
|
"module": "./dist/esm/index.mjs",
|
31
31
|
"types": "./dist/types/index.d.ts",
|
32
32
|
"exports": {
|
33
33
|
".": {
|
34
|
+
"types": "./dist/types/index.d.ts",
|
34
35
|
"require": "./dist/cjs/index.cjs",
|
35
|
-
"import": "./dist/esm/index.mjs"
|
36
|
-
"types": "./dist/types/index.d.ts"
|
36
|
+
"import": "./dist/esm/index.mjs"
|
37
37
|
}
|
38
38
|
},
|
39
39
|
"files": [
|