@tstdl/base 0.93.80 → 0.93.81

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 (26) hide show
  1. package/api/server/gateway.js +1 -1
  2. package/authentication/authentication.api.d.ts +9 -0
  3. package/authentication/authentication.api.js +3 -0
  4. package/authentication/client/authentication.service.d.ts +23 -15
  5. package/authentication/client/authentication.service.js +30 -21
  6. package/authentication/index.d.ts +1 -0
  7. package/authentication/index.js +1 -0
  8. package/authentication/models/authentication-credentials.model.d.ts +2 -2
  9. package/authentication/models/authentication-credentials.model.js +5 -5
  10. package/authentication/models/authentication-session.model.d.ts +2 -2
  11. package/authentication/models/authentication-session.model.js +3 -3
  12. package/authentication/models/subject.model.js +5 -3
  13. package/authentication/models/token-payload-base.model.d.ts +5 -1
  14. package/authentication/models/token-payload-base.model.js +10 -2
  15. package/authentication/models/token.model.d.ts +9 -1
  16. package/authentication/server/authentication-ancillary.service.d.ts +12 -15
  17. package/authentication/server/authentication-ancillary.service.js +3 -0
  18. package/authentication/server/authentication.api-controller.js +5 -5
  19. package/authentication/server/authentication.audit.d.ts +7 -5
  20. package/authentication/server/authentication.service.d.ts +32 -22
  21. package/authentication/server/authentication.service.js +116 -65
  22. package/authentication/types.d.ts +6 -0
  23. package/authentication/types.js +1 -0
  24. package/examples/api/authentication.js +3 -2
  25. package/examples/api/custom-authentication.js +11 -9
  26. package/package.json +1 -1
@@ -18,7 +18,7 @@ import { AuthenticationAncillaryService, AuthenticationApiController, Authentica
18
18
  import { configureUndiciHttpClientAdapter } from '../../http/client/adapters/undici.adapter.js';
19
19
  import { configureHttpClient } from '../../http/client/module.js';
20
20
  import { configureNodeHttpServer } from '../../http/server/node/module.js';
21
- import { Singleton } from '../../injector/decorators.js';
21
+ import { Singleton } from '../../injector/index.js';
22
22
  import { inject, injectAsync } from '../../injector/inject.js';
23
23
  import { configureLocalMessageBus } from '../../message-bus/local/module.js';
24
24
  import { WebServerModule } from '../../module/modules/index.js';
@@ -65,17 +65,18 @@ __decorate([
65
65
  ], AuthenticationData.prototype, "deviceId", void 0);
66
66
  const CustomAuthenticationApiClient = getAuthenticationApiClient(CustomTokenPaylod, AuthenticationData, emptyObjectSchema);
67
67
  let CustomAuthenticationAncillaryService = class CustomAuthenticationAncillaryService extends AuthenticationAncillaryService {
68
- getTokenPayload(_subject, authenticationData) {
68
+ getTokenPayload(_subject, authenticationData, _context) {
69
69
  return { deviceRegistrationId: `registration:${authenticationData.deviceId}` };
70
70
  }
71
- resolveSubject() {
72
- throw new Error('Method not implemented.');
71
+ async resolveSubjects(data) {
72
+ const subjects = await this.subjectRepository.loadManyByQuery({ id: data.subject });
73
+ return subjects;
73
74
  }
74
- handleInitSecretReset() {
75
+ canImpersonate(_token, _subject, _authenticationData) {
75
76
  throw new Error('Method not implemented.');
76
77
  }
77
- canImpersonate() {
78
- throw new Error('Method not implemented.');
78
+ handleInitSecretReset() {
79
+ // send mail
79
80
  }
80
81
  };
81
82
  CustomAuthenticationAncillaryService = __decorate([
@@ -83,13 +84,14 @@ CustomAuthenticationAncillaryService = __decorate([
83
84
  ], CustomAuthenticationAncillaryService);
84
85
  async function serverTest() {
85
86
  const authenticationService = await injectAsync(AuthenticationServerService);
86
- await authenticationService.setCredentials('foobar', 'supersecret-dupidupudoo9275');
87
+ const subject = await authenticationService.resolveSubject({ subject: 'foobar' });
88
+ await authenticationService.setCredentials(subject, 'supersecret-dupidupudoo9275');
87
89
  }
88
90
  async function clientTest(application) {
89
91
  const authenticationService = inject(AuthenticationClientService);
90
92
  await timeout(1500); // allow server to initialize
91
93
  authenticationService.initialize();
92
- await authenticationService.login('foobar', 'supersecret-dupidupudoo9275');
94
+ await authenticationService.login({ subject: 'foobar' }, 'supersecret-dupidupudoo9275');
93
95
  authenticationService.token$.subscribe((token) => console.log({ token }));
94
96
  application.requestShutdown();
95
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.93.80",
3
+ "version": "0.93.81",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"