@twin.org/api-auth-entity-storage-service 0.0.3-next.2 → 0.0.3-next.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +2 -2
  2. package/dist/es/entities/authenticationUser.js +9 -1
  3. package/dist/es/entities/authenticationUser.js.map +1 -1
  4. package/dist/es/index.js +1 -1
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/es/processors/authHeaderProcessor.js +23 -9
  7. package/dist/es/processors/authHeaderProcessor.js.map +1 -1
  8. package/dist/es/restEntryPoints.js +7 -0
  9. package/dist/es/restEntryPoints.js.map +1 -1
  10. package/dist/es/routes/entityStorageAuthenticationAdminRoutes.js +362 -0
  11. package/dist/es/routes/entityStorageAuthenticationAdminRoutes.js.map +1 -0
  12. package/dist/es/routes/entityStorageAuthenticationRoutes.js +12 -12
  13. package/dist/es/routes/entityStorageAuthenticationRoutes.js.map +1 -1
  14. package/dist/es/services/entityStorageAuthenticationAdminService.js +110 -41
  15. package/dist/es/services/entityStorageAuthenticationAdminService.js.map +1 -1
  16. package/dist/es/services/entityStorageAuthenticationService.js +21 -10
  17. package/dist/es/services/entityStorageAuthenticationService.js.map +1 -1
  18. package/dist/es/utils/tokenHelper.js +25 -18
  19. package/dist/es/utils/tokenHelper.js.map +1 -1
  20. package/dist/types/entities/authenticationUser.d.ts +4 -0
  21. package/dist/types/index.d.ts +1 -1
  22. package/dist/types/routes/entityStorageAuthenticationAdminRoutes.d.ts +61 -0
  23. package/dist/types/services/entityStorageAuthenticationAdminService.d.ts +21 -6
  24. package/dist/types/services/entityStorageAuthenticationService.d.ts +2 -3
  25. package/dist/types/utils/tokenHelper.d.ts +5 -2
  26. package/docs/changelog.md +338 -1
  27. package/docs/examples.md +88 -1
  28. package/docs/reference/classes/AuthenticationUser.md +8 -0
  29. package/docs/reference/classes/EntityStorageAuthenticationAdminService.md +73 -13
  30. package/docs/reference/classes/EntityStorageAuthenticationService.md +3 -9
  31. package/docs/reference/classes/TokenHelper.md +20 -2
  32. package/docs/reference/functions/authenticationAdminCreateUser.md +31 -0
  33. package/docs/reference/functions/authenticationAdminGetUser.md +31 -0
  34. package/docs/reference/functions/authenticationAdminGetUserByIdentity.md +31 -0
  35. package/docs/reference/functions/authenticationAdminRemoveUser.md +31 -0
  36. package/docs/reference/functions/authenticationAdminUpdateUser.md +31 -0
  37. package/docs/reference/functions/authenticationAdminUpdateUserPassword.md +31 -0
  38. package/docs/reference/functions/generateRestRoutesAuthenticationAdmin.md +25 -0
  39. package/docs/reference/index.md +8 -1
  40. package/docs/reference/interfaces/IAuthHeaderProcessorConfig.md +0 -12
  41. package/docs/reference/interfaces/IAuthHeaderProcessorConstructorOptions.md +0 -6
  42. package/docs/reference/interfaces/IEntityStorageAuthenticationAdminServiceConfig.md +0 -6
  43. package/docs/reference/interfaces/IEntityStorageAuthenticationAdminServiceConstructorOptions.md +0 -6
  44. package/docs/reference/interfaces/IEntityStorageAuthenticationServiceConfig.md +0 -12
  45. package/docs/reference/interfaces/IEntityStorageAuthenticationServiceConstructorOptions.md +0 -18
  46. package/docs/reference/variables/tagsAuthenticationAdmin.md +5 -0
  47. package/locales/en.json +7 -2
  48. package/package.json +5 -5
  49. package/dist/es/utils/passwordHelper.js +0 -29
  50. package/dist/es/utils/passwordHelper.js.map +0 -1
  51. package/dist/types/utils/passwordHelper.d.ts +0 -16
  52. package/docs/reference/classes/PasswordHelper.md +0 -49
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  import { Is, UnauthorizedError } from "@twin.org/core";
4
4
  import { VaultConnectorHelper } from "@twin.org/vault-models";
5
- import { HeaderHelper, HeaderTypes, Jwt } from "@twin.org/web";
5
+ import { CookieHelper, HeaderHelper, HeaderTypes, Jwt } from "@twin.org/web";
6
6
  /**
7
7
  * Helper class for token operations.
8
8
  */
@@ -17,16 +17,20 @@ export class TokenHelper {
17
17
  * @param signingKeyName The signing key name.
18
18
  * @param userIdentity The subject for the token.
19
19
  * @param organizationIdentity The organization for the token.
20
+ * @param tenantId The tenant id for the token.
20
21
  * @param ttlMinutes The time to live for the token in minutes.
22
+ * @param scope The scopes for the token.
21
23
  * @returns The new token and its expiry date.
22
24
  */
23
- static async createToken(vaultConnector, signingKeyName, userIdentity, organizationIdentity, ttlMinutes) {
25
+ static async createToken(vaultConnector, signingKeyName, userIdentity, organizationIdentity, tenantId, ttlMinutes, scope) {
24
26
  const nowSeconds = Math.trunc(Date.now() / 1000);
25
27
  const ttlSeconds = ttlMinutes * 60;
26
28
  const jwt = await Jwt.encodeWithSigner({ alg: "EdDSA" }, {
27
29
  sub: userIdentity,
28
30
  org: organizationIdentity,
29
- exp: nowSeconds + ttlSeconds
31
+ tid: tenantId,
32
+ exp: nowSeconds + ttlSeconds,
33
+ scope
30
34
  }, async (header, payload) => VaultConnectorHelper.jwtSigner(vaultConnector, signingKeyName, header, payload));
31
35
  return {
32
36
  token: jwt,
@@ -38,10 +42,11 @@ export class TokenHelper {
38
42
  * @param vaultConnector The vault connector.
39
43
  * @param signingKeyName The signing key name.
40
44
  * @param token The token to verify.
45
+ * @param requiredScopes The required scopes.
41
46
  * @returns The verified details.
42
47
  * @throws UnauthorizedError if the token is missing, invalid or expired.
43
48
  */
44
- static async verify(vaultConnector, signingKeyName, token) {
49
+ static async verify(vaultConnector, signingKeyName, token, requiredScopes) {
45
50
  if (!Is.stringValue(token)) {
46
51
  throw new UnauthorizedError(TokenHelper.CLASS_NAME, "missing");
47
52
  }
@@ -57,6 +62,16 @@ export class TokenHelper {
57
62
  decoded.payload.exp < Math.trunc(Date.now() / 1000)) {
58
63
  throw new UnauthorizedError(TokenHelper.CLASS_NAME, "expired");
59
64
  }
65
+ if (Is.arrayValue(requiredScopes)) {
66
+ const tokenScopes = Is.stringValue(decoded.payload.scope)
67
+ ? decoded.payload.scope.split(",")
68
+ : [];
69
+ for (const requiredScope of requiredScopes) {
70
+ if (!tokenScopes.includes(requiredScope)) {
71
+ throw new UnauthorizedError(TokenHelper.CLASS_NAME, "insufficientScopes");
72
+ }
73
+ }
74
+ }
60
75
  return {
61
76
  header: decoded.header,
62
77
  payload: decoded.payload
@@ -79,20 +94,12 @@ export class TokenHelper {
79
94
  };
80
95
  }
81
96
  else if (Is.notEmpty(cookiesHeader) && Is.stringValue(cookieName)) {
82
- const cookies = Is.arrayValue(cookiesHeader) ? cookiesHeader : [cookiesHeader];
83
- for (const cookie of cookies) {
84
- if (Is.stringValue(cookie)) {
85
- const accessTokenCookie = cookie
86
- .split(";")
87
- .map(c => c.trim())
88
- .find(c => c.startsWith(cookieName));
89
- if (Is.stringValue(accessTokenCookie)) {
90
- return {
91
- token: accessTokenCookie.slice(cookieName.length + 1).trim(),
92
- location: "cookie"
93
- };
94
- }
95
- }
97
+ const value = CookieHelper.getCookieFromHeaders(cookiesHeader, cookieName);
98
+ if (Is.stringValue(value)) {
99
+ return {
100
+ token: value,
101
+ location: "cookie"
102
+ };
96
103
  }
97
104
  }
98
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tokenHelper.js","sourceRoot":"","sources":["../../../src/utils/tokenHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAwB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EACN,YAAY,EACZ,WAAW,EAIX,GAAG,EACH,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,OAAO,WAAW;IACvB;;OAEG;IACI,MAAM,CAAU,UAAU,iBAAiC;IAElE;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAK,CAAC,WAAW,CAC9B,cAA+B,EAC/B,cAAsB,EACtB,YAAoB,EACpB,oBAAwC,EACxC,UAAkB;QAKlB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IA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AC;oBAC5B,MAAM,iBAAiB,GAAG,MAAM;yBAC9B,KAAK,CAAC,GAAG,CAAC;yBACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;yBAClB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;oBACtC,IAAI,EAAE,CAAC,WAAW,CAAC,iBAAiB,CAAC,EAAE,CAAC;wBACvC,OAAO;4BACN,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE;4BAC5D,QAAQ,EAAE,QAAQ;yBAClB,CAAC;oBACH,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Is, UnauthorizedError } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { type IVaultConnector, VaultConnectorHelper } from \"@twin.org/vault-models\";\nimport {\n\tHeaderHelper,\n\tHeaderTypes,\n\ttype IHttpHeaders,\n\ttype IJwtHeader,\n\ttype IJwtPayload,\n\tJwt\n} from \"@twin.org/web\";\n\n/**\n * Helper class for token operations.\n */\nexport class TokenHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<TokenHelper>();\n\n\t/**\n\t * Create a new token.\n\t * @param vaultConnector The vault connector.\n\t * @param signingKeyName The signing key name.\n\t * @param userIdentity The subject for the token.\n\t * @param organizationIdentity The organization for the token.\n\t * @param ttlMinutes The time to live for the token in minutes.\n\t * @returns The new token and its expiry date.\n\t */\n\tpublic static async createToken(\n\t\tvaultConnector: IVaultConnector,\n\t\tsigningKeyName: string,\n\t\tuserIdentity: string,\n\t\torganizationIdentity: string | undefined,\n\t\tttlMinutes: number\n\t): Promise<{\n\t\ttoken: string;\n\t\texpiry: number;\n\t}> {\n\t\tconst nowSeconds = Math.trunc(Date.now() / 1000);\n\t\tconst ttlSeconds = ttlMinutes * 60;\n\n\t\tconst jwt = await Jwt.encodeWithSigner(\n\t\t\t{ alg: \"EdDSA\" },\n\t\t\t{\n\t\t\t\tsub: userIdentity,\n\t\t\t\torg: organizationIdentity,\n\t\t\t\texp: nowSeconds + ttlSeconds\n\t\t\t},\n\t\t\tasync (header, payload) =>\n\t\t\t\tVaultConnectorHelper.jwtSigner(vaultConnector, signingKeyName, header, payload)\n\t\t);\n\n\t\treturn {\n\t\t\ttoken: jwt,\n\t\t\texpiry: (nowSeconds + ttlSeconds) * 1000\n\t\t};\n\t}\n\n\t/**\n\t * Verify the token.\n\t * @param vaultConnector The vault connector.\n\t * @param signingKeyName The signing key name.\n\t * @param token The token to verify.\n\t * @returns The verified details.\n\t * @throws UnauthorizedError if the token is missing, invalid or expired.\n\t */\n\tpublic static async verify(\n\t\tvaultConnector: IVaultConnector,\n\t\tsigningKeyName: string,\n\t\ttoken: string | undefined\n\t): Promise<{\n\t\theader: IJwtHeader;\n\t\tpayload: IJwtPayload;\n\t}> {\n\t\tif (!Is.stringValue(token)) {\n\t\t\tthrow new UnauthorizedError(TokenHelper.CLASS_NAME, \"missing\");\n\t\t}\n\n\t\tconst decoded = await Jwt.verifyWithVerifier(token, async t =>\n\t\t\tVaultConnectorHelper.jwtVerifier(vaultConnector, signingKeyName, t)\n\t\t);\n\n\t\t// If some of the header/payload data is not properly populated then it is unauthorized.\n\t\tif (!Is.stringValue(decoded.payload.sub)) {\n\t\t\tthrow new UnauthorizedError(TokenHelper.CLASS_NAME, \"payloadMissingSubject\");\n\t\t} else if (!Is.stringValue(decoded.payload.org)) {\n\t\t\tthrow new UnauthorizedError(TokenHelper.CLASS_NAME, \"payloadMissingOrganization\");\n\t\t} else if (\n\t\t\t!Is.empty(decoded.payload?.exp) &&\n\t\t\tdecoded.payload.exp < Math.trunc(Date.now() / 1000)\n\t\t) {\n\t\t\tthrow new UnauthorizedError(TokenHelper.CLASS_NAME, \"expired\");\n\t\t}\n\n\t\treturn {\n\t\t\theader: decoded.header,\n\t\t\tpayload: decoded.payload\n\t\t};\n\t}\n\n\t/**\n\t * Extract the auth token from the headers, either from the authorization header or the cookie header.\n\t * @param headers The headers to extract the token from.\n\t * @param cookieName The name of the cookie to extract the token from.\n\t * @returns The token if found.\n\t */\n\tpublic static extractTokenFromHeaders(\n\t\theaders?: IHttpHeaders,\n\t\tcookieName?: string\n\t):\n\t\t| {\n\t\t\t\ttoken: string;\n\t\t\t\tlocation: \"authorization\" | \"cookie\";\n\t\t }\n\t\t| undefined {\n\t\tconst authHeader = headers?.[HeaderTypes.Authorization];\n\t\tconst cookiesHeader = headers?.[HeaderTypes.Cookie];\n\n\t\tconst bearerToken = HeaderHelper.extractBearer(authHeader);\n\t\tif (Is.stringValue(bearerToken)) {\n\t\t\treturn {\n\t\t\t\ttoken: bearerToken,\n\t\t\t\tlocation: \"authorization\"\n\t\t\t};\n\t\t} else if (Is.notEmpty(cookiesHeader) && Is.stringValue(cookieName)) {\n\t\t\tconst cookies = Is.arrayValue(cookiesHeader) ? cookiesHeader : [cookiesHeader];\n\t\t\tfor (const cookie of cookies) {\n\t\t\t\tif (Is.stringValue(cookie)) {\n\t\t\t\t\tconst accessTokenCookie = cookie\n\t\t\t\t\t\t.split(\";\")\n\t\t\t\t\t\t.map(c => c.trim())\n\t\t\t\t\t\t.find(c => c.startsWith(cookieName));\n\t\t\t\t\tif (Is.stringValue(accessTokenCookie)) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttoken: accessTokenCookie.slice(cookieName.length + 1).trim(),\n\t\t\t\t\t\t\tlocation: \"cookie\"\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"tokenHelper.js","sourceRoot":"","sources":["../../../src/utils/tokenHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC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Ac,EAAE,CAAC;gBAC5C,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;oBAC1C,MAAM,IAAI,iBAAiB,CAAC,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC;gBAC3E,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO;YACN,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,OAAO;SACxB,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,uBAAuB,CACpC,OAAsB,EACtB,UAAmB;QAOnB,MAAM,UAAU,GAAG,OAAO,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QACxD,MAAM,aAAa,GAAG,OAAO,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAEpD,MAAM,WAAW,GAAG,YAAY,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;YACjC,OAAO;gBACN,KAAK,EAAE,WAAW;gBAClB,QAAQ,EAAE,eAAe;aACzB,CAAC;QACH,CAAC;aAAM,IAAI,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;YACrE,MAAM,KAAK,GAAG,YAAY,CAAC,oBAAoB,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;YAC3E,IAAI,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3B,OAAO;oBACN,KAAK,EAAE,KAAK;oBACZ,QAAQ,EAAE,QAAQ;iBAClB,CAAC;YACH,CAAC;QACF,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Is, UnauthorizedError } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { type IVaultConnector, VaultConnectorHelper } from \"@twin.org/vault-models\";\nimport {\n\tCookieHelper,\n\tHeaderHelper,\n\tHeaderTypes,\n\ttype IHttpHeaders,\n\ttype IJwtHeader,\n\ttype IJwtPayload,\n\tJwt\n} from \"@twin.org/web\";\n\n/**\n * Helper class for token operations.\n */\nexport class TokenHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<TokenHelper>();\n\n\t/**\n\t * Create a new token.\n\t * @param vaultConnector The vault connector.\n\t * @param signingKeyName The signing key name.\n\t * @param userIdentity The subject for the token.\n\t * @param organizationIdentity The organization for the token.\n\t * @param tenantId The tenant id for the token.\n\t * @param ttlMinutes The time to live for the token in minutes.\n\t * @param scope The scopes for the token.\n\t * @returns The new token and its expiry date.\n\t */\n\tpublic static async createToken(\n\t\tvaultConnector: IVaultConnector,\n\t\tsigningKeyName: string,\n\t\tuserIdentity: string,\n\t\torganizationIdentity: string | undefined,\n\t\ttenantId: string | undefined,\n\t\tttlMinutes: number,\n\t\tscope?: string\n\t): Promise<{\n\t\ttoken: string;\n\t\texpiry: number;\n\t}> {\n\t\tconst nowSeconds = Math.trunc(Date.now() / 1000);\n\t\tconst ttlSeconds = ttlMinutes * 60;\n\n\t\tconst jwt = await Jwt.encodeWithSigner(\n\t\t\t{ alg: \"EdDSA\" },\n\t\t\t{\n\t\t\t\tsub: userIdentity,\n\t\t\t\torg: organizationIdentity,\n\t\t\t\ttid: tenantId,\n\t\t\t\texp: nowSeconds + ttlSeconds,\n\t\t\t\tscope\n\t\t\t},\n\t\t\tasync (header, payload) =>\n\t\t\t\tVaultConnectorHelper.jwtSigner(vaultConnector, signingKeyName, header, payload)\n\t\t);\n\n\t\treturn {\n\t\t\ttoken: jwt,\n\t\t\texpiry: (nowSeconds + ttlSeconds) * 1000\n\t\t};\n\t}\n\n\t/**\n\t * Verify the token.\n\t * @param vaultConnector The vault connector.\n\t * @param signingKeyName The signing key name.\n\t * @param token The token to verify.\n\t * @param requiredScopes The required scopes.\n\t * @returns The verified details.\n\t * @throws UnauthorizedError if the token is missing, invalid or expired.\n\t */\n\tpublic static async verify(\n\t\tvaultConnector: IVaultConnector,\n\t\tsigningKeyName: string,\n\t\ttoken: string | undefined,\n\t\trequiredScopes?: string[]\n\t): Promise<{\n\t\theader: IJwtHeader;\n\t\tpayload: IJwtPayload;\n\t}> {\n\t\tif (!Is.stringValue(token)) {\n\t\t\tthrow new UnauthorizedError(TokenHelper.CLASS_NAME, \"missing\");\n\t\t}\n\n\t\tconst decoded = await Jwt.verifyWithVerifier(token, async t =>\n\t\t\tVaultConnectorHelper.jwtVerifier(vaultConnector, signingKeyName, t)\n\t\t);\n\n\t\t// If some of the header/payload data is not properly populated then it is unauthorized.\n\t\tif (!Is.stringValue(decoded.payload.sub)) {\n\t\t\tthrow new UnauthorizedError(TokenHelper.CLASS_NAME, \"payloadMissingSubject\");\n\t\t} else if (!Is.stringValue(decoded.payload.org)) {\n\t\t\tthrow new UnauthorizedError(TokenHelper.CLASS_NAME, \"payloadMissingOrganization\");\n\t\t} else if (\n\t\t\t!Is.empty(decoded.payload?.exp) &&\n\t\t\tdecoded.payload.exp < Math.trunc(Date.now() / 1000)\n\t\t) {\n\t\t\tthrow new UnauthorizedError(TokenHelper.CLASS_NAME, \"expired\");\n\t\t}\n\n\t\tif (Is.arrayValue(requiredScopes)) {\n\t\t\tconst tokenScopes = Is.stringValue(decoded.payload.scope)\n\t\t\t\t? decoded.payload.scope.split(\",\")\n\t\t\t\t: [];\n\n\t\t\tfor (const requiredScope of requiredScopes) {\n\t\t\t\tif (!tokenScopes.includes(requiredScope)) {\n\t\t\t\t\tthrow new UnauthorizedError(TokenHelper.CLASS_NAME, \"insufficientScopes\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\theader: decoded.header,\n\t\t\tpayload: decoded.payload\n\t\t};\n\t}\n\n\t/**\n\t * Extract the auth token from the headers, either from the authorization header or the cookie header.\n\t * @param headers The headers to extract the token from.\n\t * @param cookieName The name of the cookie to extract the token from.\n\t * @returns The token if found.\n\t */\n\tpublic static extractTokenFromHeaders(\n\t\theaders?: IHttpHeaders,\n\t\tcookieName?: string\n\t):\n\t\t| {\n\t\t\t\ttoken: string;\n\t\t\t\tlocation: \"authorization\" | \"cookie\";\n\t\t }\n\t\t| undefined {\n\t\tconst authHeader = headers?.[HeaderTypes.Authorization];\n\t\tconst cookiesHeader = headers?.[HeaderTypes.Cookie];\n\n\t\tconst bearerToken = HeaderHelper.extractBearer(authHeader);\n\t\tif (Is.stringValue(bearerToken)) {\n\t\t\treturn {\n\t\t\t\ttoken: bearerToken,\n\t\t\t\tlocation: \"authorization\"\n\t\t\t};\n\t\t} else if (Is.notEmpty(cookiesHeader) && Is.stringValue(cookieName)) {\n\t\t\tconst value = CookieHelper.getCookieFromHeaders(cookiesHeader, cookieName);\n\t\t\tif (Is.stringValue(value)) {\n\t\t\t\treturn {\n\t\t\t\t\ttoken: value,\n\t\t\t\t\tlocation: \"cookie\"\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -22,4 +22,8 @@ export declare class AuthenticationUser {
22
22
  * The users organization.
23
23
  */
24
24
  organization: string;
25
+ /**
26
+ * The scope assigned to the user, comma separated.
27
+ */
28
+ scope: string;
25
29
  }
@@ -7,9 +7,9 @@ export * from "./models/IEntityStorageAuthenticationServiceConfig.js";
7
7
  export * from "./models/IEntityStorageAuthenticationServiceConstructorOptions.js";
8
8
  export * from "./processors/authHeaderProcessor.js";
9
9
  export * from "./restEntryPoints.js";
10
+ export * from "./routes/entityStorageAuthenticationAdminRoutes.js";
10
11
  export * from "./routes/entityStorageAuthenticationRoutes.js";
11
12
  export * from "./schema.js";
12
13
  export * from "./services/entityStorageAuthenticationAdminService.js";
13
14
  export * from "./services/entityStorageAuthenticationService.js";
14
- export * from "./utils/passwordHelper.js";
15
15
  export * from "./utils/tokenHelper.js";
@@ -0,0 +1,61 @@
1
+ import type { IAdminUserCreateRequest, IAdminUserGetByIdentityRequest, IAdminUserGetRequest, IAdminUserGetResponse, IAdminUserRemoveRequest, IAdminUserUpdatePasswordRequest, IAdminUserUpdateRequest } from "@twin.org/api-auth-entity-storage-models";
2
+ import type { ICreatedResponse, IHttpRequestContext, INoContentResponse, IRestRoute, ITag } from "@twin.org/api-models";
3
+ /**
4
+ * The tag to associate with the routes.
5
+ */
6
+ export declare const tagsAuthenticationAdmin: ITag[];
7
+ /**
8
+ * The REST routes for authentication admin.
9
+ * @param baseRouteName Prefix to prepend to the paths.
10
+ * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
11
+ * @returns The generated routes.
12
+ */
13
+ export declare function generateRestRoutesAuthenticationAdmin(baseRouteName: string, componentName: string): IRestRoute[];
14
+ /**
15
+ * Create a new user.
16
+ * @param httpRequestContext The request context for the API.
17
+ * @param componentName The name of the component to use in the routes.
18
+ * @param request The request.
19
+ * @returns The response object with additional http response properties.
20
+ */
21
+ export declare function authenticationAdminCreateUser(httpRequestContext: IHttpRequestContext, componentName: string, request: IAdminUserCreateRequest): Promise<ICreatedResponse>;
22
+ /**
23
+ * Update an existing user.
24
+ * @param httpRequestContext The request context for the API.
25
+ * @param componentName The name of the component to use in the routes.
26
+ * @param request The request.
27
+ * @returns The response object with additional http response properties.
28
+ */
29
+ export declare function authenticationAdminUpdateUser(httpRequestContext: IHttpRequestContext, componentName: string, request: IAdminUserUpdateRequest): Promise<INoContentResponse>;
30
+ /**
31
+ * Update an existing user password.
32
+ * @param httpRequestContext The request context for the API.
33
+ * @param componentName The name of the component to use in the routes.
34
+ * @param request The request.
35
+ * @returns The response object with additional http response properties.
36
+ */
37
+ export declare function authenticationAdminUpdateUserPassword(httpRequestContext: IHttpRequestContext, componentName: string, request: IAdminUserUpdatePasswordRequest): Promise<INoContentResponse>;
38
+ /**
39
+ * Get an existing user.
40
+ * @param httpRequestContext The request context for the API.
41
+ * @param componentName The name of the component to use in the routes.
42
+ * @param request The request.
43
+ * @returns The response object with additional http response properties.
44
+ */
45
+ export declare function authenticationAdminGetUser(httpRequestContext: IHttpRequestContext, componentName: string, request: IAdminUserGetRequest): Promise<IAdminUserGetResponse>;
46
+ /**
47
+ * Get an existing user by identity.
48
+ * @param httpRequestContext The request context for the API.
49
+ * @param componentName The name of the component to use in the routes.
50
+ * @param request The request.
51
+ * @returns The response object with additional http response properties.
52
+ */
53
+ export declare function authenticationAdminGetUserByIdentity(httpRequestContext: IHttpRequestContext, componentName: string, request: IAdminUserGetByIdentityRequest): Promise<IAdminUserGetResponse>;
54
+ /**
55
+ * Remove an existing user.
56
+ * @param httpRequestContext The request context for the API.
57
+ * @param componentName The name of the component to use in the routes.
58
+ * @param request The request.
59
+ * @returns The response object with additional http response properties.
60
+ */
61
+ export declare function authenticationAdminRemoveUser(httpRequestContext: IHttpRequestContext, componentName: string, request: IAdminUserRemoveRequest): Promise<INoContentResponse>;
@@ -1,4 +1,4 @@
1
- import type { IAuthenticationAdminComponent } from "@twin.org/api-auth-entity-storage-models";
1
+ import type { IAuthenticationAdminComponent, IAuthenticationUser } from "@twin.org/api-auth-entity-storage-models";
2
2
  import type { IEntityStorageAuthenticationAdminServiceConstructorOptions } from "../models/IEntityStorageAuthenticationAdminServiceConstructorOptions.js";
3
3
  /**
4
4
  * Implementation of the authentication component using entity storage.
@@ -20,13 +20,28 @@ export declare class EntityStorageAuthenticationAdminService implements IAuthent
20
20
  className(): string;
21
21
  /**
22
22
  * Create a login for the user.
23
- * @param email The email address for the user.
24
- * @param password The password for the user.
25
- * @param userIdentity The DID to associate with the account.
26
- * @param organizationIdentity The organization of the user.
23
+ * @param user The user to create.
27
24
  * @returns Nothing.
28
25
  */
29
- create(email: string, password: string, userIdentity: string, organizationIdentity: string): Promise<void>;
26
+ create(user: Omit<IAuthenticationUser, "salt">): Promise<void>;
27
+ /**
28
+ * Update a login for the user.
29
+ * @param user The user to update.
30
+ * @returns Nothing.
31
+ */
32
+ update(user: Partial<Omit<IAuthenticationUser, "password" | "salt">>): Promise<void>;
33
+ /**
34
+ * Get a user by email.
35
+ * @param email The email address of the user to get.
36
+ * @returns The user details.
37
+ */
38
+ get(email: string): Promise<Omit<IAuthenticationUser, "password" | "salt">>;
39
+ /**
40
+ * Get a user by identity.
41
+ * @param identity The identity of the user to get.
42
+ * @returns The user details.
43
+ */
44
+ getByIdentity(identity: string): Promise<Omit<IAuthenticationUser, "password" | "salt">>;
30
45
  /**
31
46
  * Remove the current user.
32
47
  * @param email The email address of the user to remove.
@@ -46,15 +46,14 @@ export declare class EntityStorageAuthenticationService implements IAuthenticati
46
46
  * @returns The refreshed token, if it uses a mechanism with public access.
47
47
  */
48
48
  refresh(token?: string): Promise<{
49
- token: string;
49
+ token?: string;
50
50
  expiry: number;
51
51
  }>;
52
52
  /**
53
53
  * Update the user's password.
54
- * @param email The email address of the user to update.
55
54
  * @param currentPassword The current password for the user.
56
55
  * @param newPassword The new password for the user.
57
56
  * @returns Nothing.
58
57
  */
59
- updatePassword(email: string, currentPassword: string, newPassword: string): Promise<void>;
58
+ updatePassword(currentPassword: string, newPassword: string): Promise<void>;
60
59
  }
@@ -14,10 +14,12 @@ export declare class TokenHelper {
14
14
  * @param signingKeyName The signing key name.
15
15
  * @param userIdentity The subject for the token.
16
16
  * @param organizationIdentity The organization for the token.
17
+ * @param tenantId The tenant id for the token.
17
18
  * @param ttlMinutes The time to live for the token in minutes.
19
+ * @param scope The scopes for the token.
18
20
  * @returns The new token and its expiry date.
19
21
  */
20
- static createToken(vaultConnector: IVaultConnector, signingKeyName: string, userIdentity: string, organizationIdentity: string | undefined, ttlMinutes: number): Promise<{
22
+ static createToken(vaultConnector: IVaultConnector, signingKeyName: string, userIdentity: string, organizationIdentity: string | undefined, tenantId: string | undefined, ttlMinutes: number, scope?: string): Promise<{
21
23
  token: string;
22
24
  expiry: number;
23
25
  }>;
@@ -26,10 +28,11 @@ export declare class TokenHelper {
26
28
  * @param vaultConnector The vault connector.
27
29
  * @param signingKeyName The signing key name.
28
30
  * @param token The token to verify.
31
+ * @param requiredScopes The required scopes.
29
32
  * @returns The verified details.
30
33
  * @throws UnauthorizedError if the token is missing, invalid or expired.
31
34
  */
32
- static verify(vaultConnector: IVaultConnector, signingKeyName: string, token: string | undefined): Promise<{
35
+ static verify(vaultConnector: IVaultConnector, signingKeyName: string, token: string | undefined, requiredScopes?: string[]): Promise<{
33
36
  header: IJwtHeader;
34
37
  payload: IJwtPayload;
35
38
  }>;
package/docs/changelog.md CHANGED
@@ -1,4 +1,341 @@
1
- # @twin.org/api-auth-entity-storage-service - Changelog
1
+ # Changelog
2
+
3
+ ## [0.0.3-next.21](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.20...api-auth-entity-storage-service-v0.0.3-next.21) (2026-03-11)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **api-auth-entity-storage-service:** Synchronize repo versions
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.3-next.20 to 0.0.3-next.21
16
+ * @twin.org/api-core bumped from 0.0.3-next.20 to 0.0.3-next.21
17
+ * @twin.org/api-models bumped from 0.0.3-next.20 to 0.0.3-next.21
18
+
19
+ ## [0.0.3-next.20](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.19...api-auth-entity-storage-service-v0.0.3-next.20) (2026-02-09)
20
+
21
+
22
+ ### Features
23
+
24
+ * location encoding ([#79](https://github.com/twinfoundation/api/issues/79)) ([c684465](https://github.com/twinfoundation/api/commit/c684465f2a871376152472bdecb6aa230b1101a1))
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.3-next.19 to 0.0.3-next.20
32
+ * @twin.org/api-core bumped from 0.0.3-next.19 to 0.0.3-next.20
33
+ * @twin.org/api-models bumped from 0.0.3-next.19 to 0.0.3-next.20
34
+
35
+ ## [0.0.3-next.19](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.18...api-auth-entity-storage-service-v0.0.3-next.19) (2026-02-06)
36
+
37
+
38
+ ### Features
39
+
40
+ * user admin service ([#77](https://github.com/twinfoundation/api/issues/77)) ([c8491df](https://github.com/twinfoundation/api/commit/c8491df7b07c1f45560c8a78c6adc806d0ececbb))
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.3-next.18 to 0.0.3-next.19
48
+ * @twin.org/api-core bumped from 0.0.3-next.18 to 0.0.3-next.19
49
+ * @twin.org/api-models bumped from 0.0.3-next.18 to 0.0.3-next.19
50
+
51
+ ## [0.0.3-next.18](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.17...api-auth-entity-storage-service-v0.0.3-next.18) (2026-02-04)
52
+
53
+
54
+ ### Features
55
+
56
+ * tenant api and scopes ([#75](https://github.com/twinfoundation/api/issues/75)) ([c663141](https://github.com/twinfoundation/api/commit/c663141091e8974d769f8f9904ecdab009ebd083))
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.3-next.17 to 0.0.3-next.18
64
+ * @twin.org/api-core bumped from 0.0.3-next.17 to 0.0.3-next.18
65
+ * @twin.org/api-models bumped from 0.0.3-next.17 to 0.0.3-next.18
66
+
67
+ ## [0.0.3-next.17](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.16...api-auth-entity-storage-service-v0.0.3-next.17) (2026-01-26)
68
+
69
+
70
+ ### Miscellaneous Chores
71
+
72
+ * **api-auth-entity-storage-service:** Synchronize repo versions
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.3-next.16 to 0.0.3-next.17
80
+ * @twin.org/api-core bumped from 0.0.3-next.16 to 0.0.3-next.17
81
+ * @twin.org/api-models bumped from 0.0.3-next.16 to 0.0.3-next.17
82
+
83
+ ## [0.0.3-next.16](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.15...api-auth-entity-storage-service-v0.0.3-next.16) (2026-01-26)
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.3-next.15 to 0.0.3-next.16
96
+ * @twin.org/api-core bumped from 0.0.3-next.15 to 0.0.3-next.16
97
+ * @twin.org/api-models bumped from 0.0.3-next.15 to 0.0.3-next.16
98
+
99
+ ## [0.0.3-next.15](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.14...api-auth-entity-storage-service-v0.0.3-next.15) (2026-01-22)
100
+
101
+
102
+ ### Miscellaneous Chores
103
+
104
+ * **api-auth-entity-storage-service:** Synchronize repo versions
105
+
106
+
107
+ ### Dependencies
108
+
109
+ * The following workspace dependencies were updated
110
+ * dependencies
111
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.14 to 0.0.3-next.15
112
+ * @twin.org/api-core bumped from 0.0.3-next.14 to 0.0.3-next.15
113
+ * @twin.org/api-models bumped from 0.0.3-next.14 to 0.0.3-next.15
114
+
115
+ ## [0.0.3-next.14](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.13...api-auth-entity-storage-service-v0.0.3-next.14) (2026-01-20)
116
+
117
+
118
+ ### Miscellaneous Chores
119
+
120
+ * **api-auth-entity-storage-service:** Synchronize repo versions
121
+
122
+
123
+ ### Dependencies
124
+
125
+ * The following workspace dependencies were updated
126
+ * dependencies
127
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.13 to 0.0.3-next.14
128
+ * @twin.org/api-core bumped from 0.0.3-next.13 to 0.0.3-next.14
129
+ * @twin.org/api-models bumped from 0.0.3-next.13 to 0.0.3-next.14
130
+
131
+ ## [0.0.3-next.13](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.12...api-auth-entity-storage-service-v0.0.3-next.13) (2026-01-19)
132
+
133
+
134
+ ### Miscellaneous Chores
135
+
136
+ * **api-auth-entity-storage-service:** Synchronize repo versions
137
+
138
+
139
+ ### Dependencies
140
+
141
+ * The following workspace dependencies were updated
142
+ * dependencies
143
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.12 to 0.0.3-next.13
144
+ * @twin.org/api-core bumped from 0.0.3-next.12 to 0.0.3-next.13
145
+ * @twin.org/api-models bumped from 0.0.3-next.12 to 0.0.3-next.13
146
+
147
+ ## [0.0.3-next.12](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.11...api-auth-entity-storage-service-v0.0.3-next.12) (2026-01-12)
148
+
149
+
150
+ ### Miscellaneous Chores
151
+
152
+ * **api-auth-entity-storage-service:** Synchronize repo versions
153
+
154
+
155
+ ### Dependencies
156
+
157
+ * The following workspace dependencies were updated
158
+ * dependencies
159
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.11 to 0.0.3-next.12
160
+ * @twin.org/api-core bumped from 0.0.3-next.11 to 0.0.3-next.12
161
+ * @twin.org/api-models bumped from 0.0.3-next.11 to 0.0.3-next.12
162
+
163
+ ## [0.0.3-next.11](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.10...api-auth-entity-storage-service-v0.0.3-next.11) (2026-01-08)
164
+
165
+
166
+ ### Miscellaneous Chores
167
+
168
+ * **api-auth-entity-storage-service:** Synchronize repo versions
169
+
170
+
171
+ ### Dependencies
172
+
173
+ * The following workspace dependencies were updated
174
+ * dependencies
175
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.10 to 0.0.3-next.11
176
+ * @twin.org/api-core bumped from 0.0.3-next.10 to 0.0.3-next.11
177
+ * @twin.org/api-models bumped from 0.0.3-next.10 to 0.0.3-next.11
178
+
179
+ ## [0.0.3-next.10](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.9...api-auth-entity-storage-service-v0.0.3-next.10) (2026-01-05)
180
+
181
+
182
+ ### Bug Fixes
183
+
184
+ * remove token from return payload ([eaa4266](https://github.com/twinfoundation/api/commit/eaa42661b8540881b0751f5d2513258b3413f3ef))
185
+
186
+
187
+ ### Dependencies
188
+
189
+ * The following workspace dependencies were updated
190
+ * dependencies
191
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.9 to 0.0.3-next.10
192
+ * @twin.org/api-core bumped from 0.0.3-next.9 to 0.0.3-next.10
193
+ * @twin.org/api-models bumped from 0.0.3-next.9 to 0.0.3-next.10
194
+
195
+ ## [0.0.3-next.9](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.8...api-auth-entity-storage-service-v0.0.3-next.9) (2026-01-05)
196
+
197
+
198
+ ### Features
199
+
200
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
201
+ * add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
202
+ * add livez endpoint ([#57](https://github.com/twinfoundation/api/issues/57)) ([ef007db](https://github.com/twinfoundation/api/commit/ef007db8201736dd3053211f849ffd03baaa485e))
203
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
204
+ * check tenant id in auth if set ([66f7337](https://github.com/twinfoundation/api/commit/66f73374d3cf4c1c85ea96ec74bb30712fb84dd7))
205
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
206
+ * modify authHeaderProcessor to retain token in response body ([#53](https://github.com/twinfoundation/api/issues/53)) ([5d9ae76](https://github.com/twinfoundation/api/commit/5d9ae76b5b52a8e10dac391b2d5784638a186583))
207
+ * remove unused namespace ([08478f2](https://github.com/twinfoundation/api/commit/08478f27efda9beb0271fdb22f6972e918361965))
208
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
209
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
210
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
211
+ * use new extractBearer method ([3e0cc54](https://github.com/twinfoundation/api/commit/3e0cc5462c06f59a6b744386eeff8326e5abbc95))
212
+ * use new extractBearerToken method ([df654e9](https://github.com/twinfoundation/api/commit/df654e9caee5bd62f0be36f7be9902c8fab6ead6))
213
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
214
+
215
+
216
+ ### Bug Fixes
217
+
218
+ * include org in context ids from jwt ([a12cfdd](https://github.com/twinfoundation/api/commit/a12cfdddb05e2ed0300b26f3d7c0cfc033e59bd3))
219
+
220
+
221
+ ### Dependencies
222
+
223
+ * The following workspace dependencies were updated
224
+ * dependencies
225
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.8 to 0.0.3-next.9
226
+ * @twin.org/api-core bumped from 0.0.3-next.8 to 0.0.3-next.9
227
+ * @twin.org/api-models bumped from 0.0.3-next.8 to 0.0.3-next.9
228
+
229
+ ## [0.0.3-next.8](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.7...api-auth-entity-storage-service-v0.0.3-next.8) (2025-12-17)
230
+
231
+
232
+ ### Miscellaneous Chores
233
+
234
+ * **api-auth-entity-storage-service:** Synchronize repo versions
235
+
236
+
237
+ ### Dependencies
238
+
239
+ * The following workspace dependencies were updated
240
+ * dependencies
241
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.7 to 0.0.3-next.8
242
+ * @twin.org/api-core bumped from 0.0.3-next.7 to 0.0.3-next.8
243
+ * @twin.org/api-models bumped from 0.0.3-next.7 to 0.0.3-next.8
244
+
245
+ ## [0.0.3-next.7](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.6...api-auth-entity-storage-service-v0.0.3-next.7) (2025-11-26)
246
+
247
+
248
+ ### Miscellaneous Chores
249
+
250
+ * **api-auth-entity-storage-service:** Synchronize repo versions
251
+
252
+
253
+ ### Dependencies
254
+
255
+ * The following workspace dependencies were updated
256
+ * dependencies
257
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.6 to 0.0.3-next.7
258
+ * @twin.org/api-core bumped from 0.0.3-next.6 to 0.0.3-next.7
259
+ * @twin.org/api-models bumped from 0.0.3-next.6 to 0.0.3-next.7
260
+
261
+ ## [0.0.3-next.6](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.5...api-auth-entity-storage-service-v0.0.3-next.6) (2025-11-20)
262
+
263
+
264
+ ### Features
265
+
266
+ * check tenant id in auth if set ([66f7337](https://github.com/twinfoundation/api/commit/66f73374d3cf4c1c85ea96ec74bb30712fb84dd7))
267
+
268
+
269
+ ### Dependencies
270
+
271
+ * The following workspace dependencies were updated
272
+ * dependencies
273
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.5 to 0.0.3-next.6
274
+ * @twin.org/api-core bumped from 0.0.3-next.5 to 0.0.3-next.6
275
+ * @twin.org/api-models bumped from 0.0.3-next.5 to 0.0.3-next.6
276
+
277
+ ## [0.0.3-next.5](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.4...api-auth-entity-storage-service-v0.0.3-next.5) (2025-11-14)
278
+
279
+
280
+ ### Miscellaneous Chores
281
+
282
+ * **api-auth-entity-storage-service:** Synchronize repo versions
283
+
284
+
285
+ ### Dependencies
286
+
287
+ * The following workspace dependencies were updated
288
+ * dependencies
289
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.4 to 0.0.3-next.5
290
+ * @twin.org/api-core bumped from 0.0.3-next.4 to 0.0.3-next.5
291
+ * @twin.org/api-models bumped from 0.0.3-next.4 to 0.0.3-next.5
292
+
293
+ ## [0.0.3-next.4](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.3...api-auth-entity-storage-service-v0.0.3-next.4) (2025-11-14)
294
+
295
+
296
+ ### Features
297
+
298
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
299
+ * add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
300
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
301
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
302
+ * remove unused namespace ([08478f2](https://github.com/twinfoundation/api/commit/08478f27efda9beb0271fdb22f6972e918361965))
303
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
304
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
305
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
306
+ * use new extractBearer method ([3e0cc54](https://github.com/twinfoundation/api/commit/3e0cc5462c06f59a6b744386eeff8326e5abbc95))
307
+ * use new extractBearerToken method ([df654e9](https://github.com/twinfoundation/api/commit/df654e9caee5bd62f0be36f7be9902c8fab6ead6))
308
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
309
+
310
+
311
+ ### Bug Fixes
312
+
313
+ * include org in context ids from jwt ([a12cfdd](https://github.com/twinfoundation/api/commit/a12cfdddb05e2ed0300b26f3d7c0cfc033e59bd3))
314
+
315
+
316
+ ### Dependencies
317
+
318
+ * The following workspace dependencies were updated
319
+ * dependencies
320
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.3 to 0.0.3-next.4
321
+ * @twin.org/api-core bumped from 0.0.3-next.3 to 0.0.3-next.4
322
+ * @twin.org/api-models bumped from 0.0.3-next.3 to 0.0.3-next.4
323
+
324
+ ## [0.0.3-next.3](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.2...api-auth-entity-storage-service-v0.0.3-next.3) (2025-11-14)
325
+
326
+
327
+ ### Bug Fixes
328
+
329
+ * include org in context ids from jwt ([a12cfdd](https://github.com/twinfoundation/api/commit/a12cfdddb05e2ed0300b26f3d7c0cfc033e59bd3))
330
+
331
+
332
+ ### Dependencies
333
+
334
+ * The following workspace dependencies were updated
335
+ * dependencies
336
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.2 to 0.0.3-next.3
337
+ * @twin.org/api-core bumped from 0.0.3-next.2 to 0.0.3-next.3
338
+ * @twin.org/api-models bumped from 0.0.3-next.2 to 0.0.3-next.3
2
339
 
3
340
  ## [0.0.3-next.2](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.1...api-auth-entity-storage-service-v0.0.3-next.2) (2025-11-12)
4
341