@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.
- package/api/server/gateway.js +1 -1
- package/authentication/authentication.api.d.ts +9 -0
- package/authentication/authentication.api.js +3 -0
- package/authentication/client/authentication.service.d.ts +23 -15
- package/authentication/client/authentication.service.js +30 -21
- package/authentication/index.d.ts +1 -0
- package/authentication/index.js +1 -0
- package/authentication/models/authentication-credentials.model.d.ts +2 -2
- package/authentication/models/authentication-credentials.model.js +5 -5
- package/authentication/models/authentication-session.model.d.ts +2 -2
- package/authentication/models/authentication-session.model.js +3 -3
- package/authentication/models/subject.model.js +5 -3
- package/authentication/models/token-payload-base.model.d.ts +5 -1
- package/authentication/models/token-payload-base.model.js +10 -2
- package/authentication/models/token.model.d.ts +9 -1
- package/authentication/server/authentication-ancillary.service.d.ts +12 -15
- package/authentication/server/authentication-ancillary.service.js +3 -0
- package/authentication/server/authentication.api-controller.js +5 -5
- package/authentication/server/authentication.audit.d.ts +7 -5
- package/authentication/server/authentication.service.d.ts +32 -22
- package/authentication/server/authentication.service.js +116 -65
- package/authentication/types.d.ts +6 -0
- package/authentication/types.js +1 -0
- package/examples/api/authentication.js +3 -2
- package/examples/api/custom-authentication.js +11 -9
- 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/
|
|
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
|
-
|
|
72
|
-
|
|
71
|
+
async resolveSubjects(data) {
|
|
72
|
+
const subjects = await this.subjectRepository.loadManyByQuery({ id: data.subject });
|
|
73
|
+
return subjects;
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
+
canImpersonate(_token, _subject, _authenticationData) {
|
|
75
76
|
throw new Error('Method not implemented.');
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
|
|
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.
|
|
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
|
}
|