@kolektor/nucleus-identity 0.0.12-pre.7931 → 0.1.0-pre.124

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 (63) hide show
  1. package/README.md +7 -0
  2. package/esm2022/index.mjs +7 -0
  3. package/esm2022/kolektor-nucleus-identity.mjs +5 -0
  4. package/esm2022/lib/models/client-registration.mjs +8 -0
  5. package/esm2022/lib/models/device-code.mjs +19 -0
  6. package/esm2022/lib/models/identity.mjs +52 -0
  7. package/esm2022/lib/models/otp.mjs +11 -0
  8. package/esm2022/lib/models/service-principal.mjs +16 -0
  9. package/esm2022/lib/nucleus-identity-config.mjs +7 -0
  10. package/esm2022/lib/nucleus-identity.module.mjs +32 -0
  11. package/esm2022/lib/nucleus-identity.service.mjs +350 -0
  12. package/esm2022/lib/nucleus-token-interceptor.service.mjs +69 -0
  13. package/esm2022/lib/utils/angular-requestor.mjs +44 -0
  14. package/esm2022/lib/utils/authorization-service-configuration.mjs +28 -0
  15. package/esm2022/lib/utils/location.service.mjs +72 -0
  16. package/esm2022/lib/utils/nucleus-authorization-notifier.mjs +15 -0
  17. package/esm2022/lib/utils/oidc-configuration.service.mjs +95 -0
  18. package/esm2022/lib/utils/secrets-store.mjs +120 -0
  19. package/esm2022/lib/utils/token-client.mjs +140 -0
  20. package/{fesm2020 → fesm2022}/kolektor-nucleus-identity.mjs +980 -1012
  21. package/fesm2022/kolektor-nucleus-identity.mjs.map +1 -0
  22. package/index.d.ts +6 -5
  23. package/lib/models/client-registration.d.ts +11 -11
  24. package/lib/models/device-code.d.ts +19 -19
  25. package/lib/models/identity.d.ts +14 -14
  26. package/lib/models/otp.d.ts +14 -14
  27. package/lib/models/service-principal.d.ts +12 -12
  28. package/lib/nucleus-identity-config.d.ts +12 -12
  29. package/lib/nucleus-identity.module.d.ts +9 -9
  30. package/lib/nucleus-identity.service.d.ts +63 -63
  31. package/lib/nucleus-token-interceptor.service.d.ts +19 -19
  32. package/lib/utils/angular-requestor.d.ts +11 -11
  33. package/lib/utils/authorization-service-configuration.d.ts +12 -12
  34. package/lib/utils/location.service.d.ts +25 -25
  35. package/lib/utils/nucleus-authorization-notifier.d.ts +9 -9
  36. package/lib/utils/oidc-configuration.service.d.ts +23 -23
  37. package/lib/utils/secrets-store.d.ts +33 -33
  38. package/lib/utils/token-client.d.ts +23 -23
  39. package/package.json +29 -33
  40. package/esm2020/kolektor-nucleus-identity.mjs +0 -5
  41. package/esm2020/lib/models/client-registration.mjs +0 -8
  42. package/esm2020/lib/models/device-code.mjs +0 -19
  43. package/esm2020/lib/models/identity.mjs +0 -49
  44. package/esm2020/lib/models/otp.mjs +0 -11
  45. package/esm2020/lib/models/service-principal.mjs +0 -16
  46. package/esm2020/lib/nucleus-identity-config.mjs +0 -8
  47. package/esm2020/lib/nucleus-identity.module.mjs +0 -28
  48. package/esm2020/lib/nucleus-identity.service.mjs +0 -341
  49. package/esm2020/lib/nucleus-token-interceptor.service.mjs +0 -64
  50. package/esm2020/lib/utils/angular-requestor.mjs +0 -38
  51. package/esm2020/lib/utils/authorization-service-configuration.mjs +0 -23
  52. package/esm2020/lib/utils/location.service.mjs +0 -72
  53. package/esm2020/lib/utils/nucleus-authorization-notifier.mjs +0 -13
  54. package/esm2020/lib/utils/nucleus-crypto.mjs +0 -68
  55. package/esm2020/lib/utils/oidc-configuration.service.mjs +0 -90
  56. package/esm2020/lib/utils/secrets-store.mjs +0 -120
  57. package/esm2020/lib/utils/token-client.mjs +0 -140
  58. package/esm2020/public-api.mjs +0 -11
  59. package/fesm2015/kolektor-nucleus-identity.mjs +0 -1139
  60. package/fesm2015/kolektor-nucleus-identity.mjs.map +0 -1
  61. package/fesm2020/kolektor-nucleus-identity.mjs.map +0 -1
  62. package/lib/utils/nucleus-crypto.d.ts +0 -9
  63. package/public-api.d.ts +0 -7
@@ -1,1139 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, NgModule } from '@angular/core';
3
- import * as i1$1 from '@angular/common/http';
4
- import { HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
5
- import { lastValueFrom, from, throwError } from 'rxjs';
6
- import { mergeMap, catchError } from 'rxjs/operators';
7
- import { __awaiter } from 'tslib';
8
- import { AppAuthError, AuthorizationNotifier, TokenResponse, AuthorizationServiceConfiguration, JQueryRequestor, Requestor, nowInSeconds, BaseTokenRequestHandler, BasicQueryStringUtils, TokenRequest, GRANT_TYPE_AUTHORIZATION_CODE, GRANT_TYPE_REFRESH_TOKEN, LocalStorageBackend, RedirectRequestHandler, AuthorizationRequest } from '@openid/appauth';
9
- import { App } from '@capacitor/app';
10
- import { Browser } from '@capacitor/browser';
11
- import { Device } from '@capacitor/device';
12
- import * as base64 from 'base64-js';
13
- import { SecureStoragePlugin } from 'capacitor-secure-storage-plugin';
14
- import * as i1 from '@kolektor/nucleus-common';
15
-
16
- const CHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
17
- class NucleusCrypto {
18
- constructor() {
19
- this.browserCrypto = window.crypto || window.msCrypto;
20
- }
21
- generateRandom(size) {
22
- const buffer = new Uint8Array(size);
23
- if (this.browserCrypto) {
24
- this.browserCrypto.getRandomValues(buffer);
25
- }
26
- else {
27
- // fall back to Math.random() if nothing else is available
28
- for (let i = 0; i < size; i += 1) {
29
- buffer[i] = Math.random();
30
- }
31
- }
32
- return this.bufferToString(buffer);
33
- }
34
- deriveChallenge(code) {
35
- if (code.length < 43 || code.length > 128) {
36
- return Promise.reject(new AppAuthError('Invalid code length.'));
37
- }
38
- if (!this.browserCrypto.subtle) {
39
- return Promise.reject(new AppAuthError('window.crypto.subtle is unavailable.'));
40
- }
41
- const ecode = this.textEncodeLite(code);
42
- const op = this.browserCrypto.subtle.digest('SHA-256', ecode);
43
- return new Promise((resolve, reject) => {
44
- // if operation contains algorithm it means it is not a promise which means it is CryptoOperation from IE.
45
- // We just return result as promise
46
- if (op.algorithm) {
47
- console.log('we have a CryptoOperation');
48
- op.addEventListener('complete', () => {
49
- resolve(this.urlSafe(op.result));
50
- });
51
- op.addEventListener('error', () => {
52
- reject(op.result);
53
- });
54
- }
55
- else { // the result is promise
56
- op.then(buffer => resolve(this.urlSafe(buffer)), error => reject(error));
57
- }
58
- });
59
- }
60
- urlSafe(buffer) {
61
- const encoded = base64.fromByteArray(new Uint8Array(buffer));
62
- return encoded.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
63
- }
64
- textEncodeLite(str) {
65
- const buf = new ArrayBuffer(str.length);
66
- const bufView = new Uint8Array(buf);
67
- for (let i = 0; i < str.length; i++) {
68
- bufView[i] = str.charCodeAt(i);
69
- }
70
- return bufView;
71
- }
72
- bufferToString(buffer) {
73
- const state = [];
74
- for (let i = 0; i < buffer.byteLength; i += 1) {
75
- const index = buffer[i] % CHARSET.length;
76
- state.push(CHARSET[index]);
77
- }
78
- return state.join('');
79
- }
80
- }
81
-
82
- class NucleusAuthorizationNotifier extends AuthorizationNotifier {
83
- constructor() {
84
- super();
85
- this.setAuthorizationListener((request, response, error) => {
86
- console.log('Authorization request complete ', request, response, error);
87
- this.response = response;
88
- this.request = request;
89
- this.error = error;
90
- });
91
- }
92
- }
93
-
94
- class Claim {
95
- constructor(name, values) {
96
- this.name = name;
97
- this.values = values;
98
- }
99
- }
100
- class Identity {
101
- constructor() {
102
- this.claims = [];
103
- }
104
- static createFromResponse(res) {
105
- const token = this.decodeToken(res.idToken);
106
- const id = new Identity();
107
- id.name = token.name;
108
- id.subject = token.sub;
109
- for (const key in token) {
110
- if ({}.hasOwnProperty.call(token, key)) {
111
- let vals = token[key];
112
- if (!Array.isArray(vals)) {
113
- vals = [vals];
114
- }
115
- const claim = new Claim(key, vals);
116
- id.claims.push(claim);
117
- }
118
- }
119
- return id;
120
- }
121
- static decodeToken(jwt) {
122
- if (!jwt) {
123
- throw new Error('NucleusIdentity: There was no identity token in the response!');
124
- }
125
- try {
126
- const arr = jwt.split('.');
127
- // var header = arr[0];
128
- const payload = this.b64DecodeUnicode(arr[1]);
129
- // var signature = arr[2];
130
- return JSON.parse(payload);
131
- }
132
- catch (error) {
133
- console.error('Error while decoding identity token', error);
134
- console.error('Error while decoding identity token JWT', jwt);
135
- }
136
- }
137
- static b64DecodeUnicode(str) {
138
- str = str.replace(/-/g, '+').replace(/_/g, '/'); // Qlector fix :)
139
- return decodeURIComponent(atob(str).split('').map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join(''));
140
- }
141
- }
142
-
143
- class SecretsStore {
144
- constructor(clientId) {
145
- this._tokens = {};
146
- this._identities = {};
147
- // this specify which identity id is used by default, when If id is not specified in getToken or getIdentity
148
- this._defaultIdentityId = null;
149
- this._defaultIdentityIdStorageKey = null;
150
- this._tokenStorageKeyPrefix = `Nucleus.Identity.${clientId}`; // do not change this or login with existing tokens will fail
151
- this._servicePrincipalKey = `${this._tokenStorageKeyPrefix}.SvcP`;
152
- this._defaultIdentityIdStorageKey = `${this._tokenStorageKeyPrefix}.IdId`;
153
- this._defaultIdentityId = localStorage.getItem(this._defaultIdentityIdStorageKey);
154
- }
155
- get defaultIdentityId() {
156
- return this._defaultIdentityId;
157
- }
158
- removeServicePrincipal() {
159
- this._servicePrincipal = null;
160
- return this.clear(this._servicePrincipalKey);
161
- }
162
- setServicePrincipal(servicePrincipal) {
163
- return __awaiter(this, void 0, void 0, function* () {
164
- this._servicePrincipal = servicePrincipal;
165
- yield this.save(this._servicePrincipalKey, servicePrincipal);
166
- });
167
- }
168
- getServicePrincipal() {
169
- return __awaiter(this, void 0, void 0, function* () {
170
- if (!this._servicePrincipal) {
171
- this._servicePrincipal = yield this.load(this._servicePrincipalKey);
172
- }
173
- return this._servicePrincipal;
174
- });
175
- }
176
- setToken(token, id = null) {
177
- return this.setTokenInternal(token, true, id);
178
- }
179
- getIdentity(id = null) {
180
- const key = this.getTokenKey(id);
181
- return this._identities[key];
182
- }
183
- setDefaultIdentityId(id) {
184
- this._defaultIdentityId = id;
185
- if (this._defaultIdentityId) {
186
- localStorage.setItem(this._defaultIdentityIdStorageKey, this._defaultIdentityId);
187
- }
188
- else {
189
- localStorage.removeItem(this._defaultIdentityIdStorageKey);
190
- }
191
- }
192
- getToken(id = null) {
193
- return __awaiter(this, void 0, void 0, function* () {
194
- const key = this.getTokenKey(id);
195
- // if token is not there or it is invalid we check storage again before returning
196
- if (!this._tokens[key] || !this._tokens[key].isValid()) {
197
- yield this.reloadTokenFromStorage(id);
198
- }
199
- return this._tokens[key];
200
- });
201
- }
202
- removeToken(id = null) {
203
- const key = this.getTokenKey(id);
204
- delete this._tokens[key];
205
- delete this._identities[key];
206
- return this.clear(key);
207
- }
208
- reloadTokenFromStorage(id) {
209
- return __awaiter(this, void 0, void 0, function* () {
210
- const key = this.getTokenKey(id);
211
- const storedToken = yield this.load(key);
212
- if (storedToken) {
213
- const res = new TokenResponse(storedToken);
214
- if ((res === null || res === void 0 ? void 0 : res.accessToken) || (res === null || res === void 0 ? void 0 : res.idToken)) {
215
- yield this.setTokenInternal(res, false, id);
216
- }
217
- }
218
- return null;
219
- });
220
- }
221
- setTokenInternal(token, save, id = null) {
222
- return __awaiter(this, void 0, void 0, function* () {
223
- const key = this.getTokenKey(id);
224
- if (token == null) {
225
- yield this.removeToken(id);
226
- }
227
- else {
228
- this._tokens[key] = token;
229
- this._identities[key] = Identity.createFromResponse(token);
230
- if (save) {
231
- try {
232
- yield this.save(key, token.toJson());
233
- }
234
- catch (e) {
235
- console.warn('Nucleus.Identity: Could not save to SecureStorage.');
236
- }
237
- }
238
- }
239
- });
240
- }
241
- getTokenKey(id = null) {
242
- if (!id) {
243
- id = this._defaultIdentityId;
244
- }
245
- return id ? `${this._tokenStorageKeyPrefix}.${id}` : this._tokenStorageKeyPrefix;
246
- }
247
- clear(key) {
248
- return SecureStoragePlugin.remove({ key });
249
- }
250
- save(key, value) {
251
- return SecureStoragePlugin.set({ key, value: JSON.stringify(value) });
252
- }
253
- load(key) {
254
- return __awaiter(this, void 0, void 0, function* () {
255
- try {
256
- const x = yield SecureStoragePlugin.get({ key });
257
- if (x === null || x === void 0 ? void 0 : x.value) {
258
- return JSON.parse(x.value);
259
- }
260
- else {
261
- return null;
262
- }
263
- }
264
- catch (_a) {
265
- return null;
266
- }
267
- });
268
- }
269
- }
270
-
271
- class ServicePrincipal {
272
- }
273
- class ServicePrincipalRegistrationStatus {
274
- constructor(servicePrincipal) {
275
- this.isRegistered = false;
276
- if (servicePrincipal) {
277
- this.isRegistered = true;
278
- this.id = servicePrincipal.id;
279
- this.expiresAt = servicePrincipal.expiresAt;
280
- }
281
- }
282
- get isExpired() {
283
- return false;
284
- }
285
- }
286
-
287
- class LocationService {
288
- constructor(appService) {
289
- this.appService = appService;
290
- }
291
- get hash() {
292
- return window.location.hash;
293
- }
294
- set hash(v) {
295
- window.location.hash = v;
296
- }
297
- get host() {
298
- return window.location.host;
299
- }
300
- set host(v) {
301
- window.location.host = v;
302
- }
303
- get origin() {
304
- return window.location.origin;
305
- }
306
- get hostname() {
307
- return window.location.hostname;
308
- }
309
- set hostname(v) {
310
- window.location.hostname = v;
311
- }
312
- get pathname() {
313
- return window.location.pathname;
314
- }
315
- set pathname(v) {
316
- window.location.pathname = v;
317
- }
318
- get port() {
319
- return window.location.port;
320
- }
321
- set port(v) {
322
- window.location.port = v;
323
- }
324
- get protocol() {
325
- return window.location.protocol;
326
- }
327
- set protocol(v) {
328
- window.location.protocol = v;
329
- }
330
- get search() {
331
- return window.location.search;
332
- }
333
- set search(v) {
334
- window.location.search = v;
335
- }
336
- assign(url) {
337
- if (this.appService.isNative) {
338
- Browser.open({ url });
339
- }
340
- else {
341
- window.location.assign(url);
342
- }
343
- }
344
- }
345
- LocationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocationService, deps: [{ token: i1.NucleusAppService }], target: i0.ɵɵFactoryTarget.Injectable });
346
- LocationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocationService, providedIn: 'root' });
347
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocationService, decorators: [{
348
- type: Injectable,
349
- args: [{
350
- providedIn: 'root'
351
- }]
352
- }], ctorParameters: function () { return [{ type: i1.NucleusAppService }]; } });
353
-
354
- const WELL_KNOWN_PATH = '.well-known';
355
- const OPENID_CONFIGURATION = 'openid-configuration';
356
- class NucleusAuthorizationServiceConfiguration extends AuthorizationServiceConfiguration {
357
- constructor(request) {
358
- super(request);
359
- this.deviceAuthorizationEndpoint = request.device_authorization_endpoint;
360
- this.registrationEndpoint = request.registration_endpoint;
361
- }
362
- static fetchFromIssuer(openIdIssuerUrl, requestor) {
363
- const fullUrl = `${openIdIssuerUrl}/${WELL_KNOWN_PATH}/${OPENID_CONFIGURATION}`;
364
- const requestorToUse = requestor || new JQueryRequestor();
365
- return requestorToUse
366
- .xhr({ url: fullUrl, dataType: 'json', method: 'GET' })
367
- .then(json => new NucleusAuthorizationServiceConfiguration(json));
368
- }
369
- toJson() {
370
- const res = super.toJson();
371
- res.device_authorization_endpoint = this.deviceAuthorizationEndpoint;
372
- return res;
373
- }
374
- }
375
-
376
- class AngularRequestor extends Requestor {
377
- constructor(http) {
378
- super();
379
- this.http = http;
380
- }
381
- // eslint-disable-next-line no-undef
382
- xhr(settings) {
383
- if (settings.method === undefined) {
384
- settings.method = 'GET';
385
- }
386
- return new Promise((resolve, reject) => {
387
- this.http.request(settings.method, settings.url, {
388
- body: settings.data,
389
- headers: settings.headers,
390
- }).subscribe(res => resolve(res), err => {
391
- var _a;
392
- let e = new AppAuthError(err);
393
- if (err instanceof HttpErrorResponse) {
394
- e = new AppAuthError(((_a = err.error) === null || _a === void 0 ? void 0 : _a.error) || err.statusText);
395
- }
396
- reject(e);
397
- });
398
- });
399
- }
400
- }
401
- AngularRequestor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AngularRequestor, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
402
- AngularRequestor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AngularRequestor, providedIn: 'root' });
403
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AngularRequestor, decorators: [{
404
- type: Injectable,
405
- args: [{
406
- providedIn: 'root'
407
- }]
408
- }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
409
-
410
- class NucleusIdentityConfig {
411
- constructor() {
412
- this.authority = null;
413
- this.httpInterceptorUrls = [];
414
- this.automaticLoginOnHttp401 = false;
415
- }
416
- }
417
-
418
- class OidcConfigurationService {
419
- constructor(requestor, config, appService) {
420
- this.requestor = requestor;
421
- this.config = config;
422
- this.appService = appService;
423
- this._configuration = null;
424
- }
425
- getConfiguration() {
426
- return __awaiter(this, void 0, void 0, function* () {
427
- yield this.assureConfiguration();
428
- return this._configuration;
429
- });
430
- }
431
- get clientId() {
432
- return this.config.clientId;
433
- }
434
- get requestedScopes() {
435
- return this.config.requestedScopes;
436
- }
437
- get servicePrincipalRequestedScopes() {
438
- return this.config.servicePrincipalRequestedScopes;
439
- }
440
- get authProviderHint() {
441
- return this.config.authProviderHint;
442
- }
443
- get redirectUrl() {
444
- let uri = window.location.href;
445
- const platform = this.appService.platform;
446
- if (platform === 'android' && this.config.androidRedirectUri) {
447
- uri = this.config.androidRedirectUri;
448
- }
449
- else if (platform === 'ios' && this.config.iOSRedirectUri) {
450
- uri = this.config.iOSRedirectUri;
451
- }
452
- else if (this.config.redirectUri) {
453
- uri = this.config.redirectUri;
454
- }
455
- return this.NormalizeRedirectUri(uri);
456
- }
457
- getServerUrl(relativeUri = null) {
458
- let authority = this.config.authority;
459
- if (!authority || authority === 'origin') {
460
- authority = window.origin;
461
- }
462
- let url = new URL(authority);
463
- if (relativeUri) {
464
- url = new URL(relativeUri, url);
465
- }
466
- return url.href;
467
- }
468
- NormalizeRedirectUri(uri) {
469
- const i = uri.indexOf('#');
470
- if (i > 0) {
471
- uri = uri.substring(0, i);
472
- }
473
- return uri;
474
- }
475
- assureConfiguration() {
476
- return __awaiter(this, void 0, void 0, function* () {
477
- if (this._configuration != null) {
478
- return;
479
- }
480
- let authority = this.getServerUrl();
481
- if (authority[authority.length - 1] === '/') {
482
- authority = authority.slice(0, -1);
483
- }
484
- try {
485
- this._configuration = yield NucleusAuthorizationServiceConfiguration.fetchFromIssuer(authority, this.requestor);
486
- }
487
- catch (e) {
488
- console.error('Nucleus.Identity: Cannot load OIDC configuration: ' + e.message);
489
- throw e;
490
- }
491
- });
492
- }
493
- }
494
- OidcConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OidcConfigurationService, deps: [{ token: AngularRequestor }, { token: NucleusIdentityConfig }, { token: i1.NucleusAppService }], target: i0.ɵɵFactoryTarget.Injectable });
495
- OidcConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OidcConfigurationService, providedIn: 'root' });
496
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OidcConfigurationService, decorators: [{
497
- type: Injectable,
498
- args: [{
499
- providedIn: 'root'
500
- }]
501
- }], ctorParameters: function () { return [{ type: AngularRequestor }, { type: NucleusIdentityConfig }, { type: i1.NucleusAppService }]; } });
502
-
503
- class DeviceCode {
504
- constructor(response) {
505
- this.deviceCode = response.device_code;
506
- this.userCode = response.user_code;
507
- this.verificationUrl = response.verification_uri;
508
- this.verificationUrlComplete = response.verification_uri_complete;
509
- this.expiresIn = parseInt(response.expires_in, 10);
510
- this.issuedAt = nowInSeconds();
511
- }
512
- isExpired(buffer = 60) {
513
- return this.secondsLeft(buffer) <= 0;
514
- }
515
- secondsLeft(buffer = 60) {
516
- const now = nowInSeconds();
517
- return (this.issuedAt + this.expiresIn - buffer) - now;
518
- }
519
- }
520
-
521
- class ClientRegistrationResponse {
522
- constructor(response) {
523
- this.clientId = response.client_id;
524
- this.clientSecret = response.client_secret;
525
- this.secretExpirationDate = new Date(response.client_secret_expires_at * 1000);
526
- }
527
- }
528
-
529
- class TokenClient {
530
- constructor(requestor, config) {
531
- this.requestor = requestor;
532
- this.config = config;
533
- this._tokenHandler = new BaseTokenRequestHandler(requestor);
534
- this._utils = new BasicQueryStringUtils();
535
- }
536
- getByAuthorizationCode(redirectUrl, code, codeVerifier) {
537
- return __awaiter(this, void 0, void 0, function* () {
538
- const config = yield this.config.getConfiguration();
539
- const redirectUri = redirectUrl;
540
- const req = new TokenRequest({
541
- client_id: this.config.clientId,
542
- redirect_uri: redirectUri,
543
- grant_type: GRANT_TYPE_AUTHORIZATION_CODE,
544
- code,
545
- extras: { code_verifier: codeVerifier }
546
- });
547
- return yield this._tokenHandler.performTokenRequest(config, req);
548
- });
549
- }
550
- getByRefreshToken(refreshToken) {
551
- return __awaiter(this, void 0, void 0, function* () {
552
- const config = yield this.config.getConfiguration();
553
- const redirectUri = this.config.redirectUrl;
554
- const req = new TokenRequest({
555
- client_id: this.config.clientId,
556
- redirect_uri: redirectUri,
557
- grant_type: GRANT_TYPE_REFRESH_TOKEN,
558
- refresh_token: refreshToken
559
- });
560
- return yield this._tokenHandler.performTokenRequest(config, req);
561
- });
562
- }
563
- getByClientCredentials(clientId, clientSecret, scope) {
564
- return __awaiter(this, void 0, void 0, function* () {
565
- const config = yield this.config.getConfiguration();
566
- const req = new TokenRequest({
567
- client_id: clientId,
568
- redirect_uri: null,
569
- grant_type: 'client_credentials',
570
- extras: {
571
- client_secret: clientSecret,
572
- scope,
573
- }
574
- });
575
- return yield this._tokenHandler.performTokenRequest(config, req);
576
- });
577
- }
578
- getBySecret(provider, secret, assertionToken, scope) {
579
- return __awaiter(this, void 0, void 0, function* () {
580
- const config = yield this.config.getConfiguration();
581
- const req = new TokenRequest({
582
- client_id: this.config.clientId,
583
- redirect_uri: null,
584
- grant_type: 'urn:kolektor:nucleus:secret',
585
- extras: {
586
- secret_provider: provider,
587
- secret_value: secret,
588
- client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
589
- client_assertion: assertionToken,
590
- scope,
591
- }
592
- });
593
- return yield this._tokenHandler.performTokenRequest(config, req);
594
- });
595
- }
596
- getByDeviceCode(deviceCode) {
597
- return __awaiter(this, void 0, void 0, function* () {
598
- const config = yield this.config.getConfiguration();
599
- const req = new TokenRequest({
600
- client_id: this.config.clientId,
601
- redirect_uri: null,
602
- grant_type: 'urn:ietf:params:oauth:grant-type:device_code',
603
- extras: {
604
- device_code: deviceCode
605
- }
606
- });
607
- return yield this._tokenHandler.performTokenRequest(config, req);
608
- });
609
- }
610
- registerServicePrincipal(token) {
611
- return __awaiter(this, void 0, void 0, function* () {
612
- const config = yield this.config.getConfiguration();
613
- const response = yield this.requestor.xhr({
614
- url: config.registrationEndpoint,
615
- method: 'POST',
616
- dataType: 'json',
617
- headers: {
618
- 'Content-Type': 'application/json',
619
- Authorization: `Bearer ${token}`
620
- }
621
- // data: this._utils.stringify(map)
622
- });
623
- if (response.error === undefined) {
624
- return new ClientRegistrationResponse(response);
625
- }
626
- else {
627
- throw new AppAuthError(response.error);
628
- }
629
- });
630
- }
631
- getRegistrationCode(existingServicePrincipalId = null) {
632
- return __awaiter(this, void 0, void 0, function* () {
633
- const params = {
634
- custom_action: 'sp_register',
635
- service_principal_id: existingServicePrincipalId
636
- };
637
- return this.getDeviceCodeInternal(params);
638
- });
639
- }
640
- getDeviceCode(scope) {
641
- return __awaiter(this, void 0, void 0, function* () {
642
- const params = {
643
- scope,
644
- };
645
- return this.getDeviceCodeInternal(params);
646
- });
647
- }
648
- getDeviceCodeInternal(params) {
649
- return __awaiter(this, void 0, void 0, function* () {
650
- const config = yield this.config.getConfiguration();
651
- params['client_id'] = this.config.clientId;
652
- const map = params;
653
- const response = yield this.requestor.xhr({
654
- url: config.deviceAuthorizationEndpoint,
655
- method: 'POST',
656
- dataType: 'json',
657
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
658
- data: this._utils.stringify(map)
659
- });
660
- if (response.error === undefined) {
661
- return new DeviceCode(response);
662
- }
663
- else {
664
- throw new AppAuthError(response.error);
665
- }
666
- });
667
- }
668
- }
669
- TokenClient.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TokenClient, deps: [{ token: AngularRequestor }, { token: OidcConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
670
- TokenClient.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TokenClient, providedIn: 'root' });
671
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TokenClient, decorators: [{
672
- type: Injectable,
673
- args: [{
674
- providedIn: 'root'
675
- }]
676
- }], ctorParameters: function () { return [{ type: AngularRequestor }, { type: OidcConfigurationService }]; } });
677
-
678
- class NucleusIdentityService {
679
- constructor(appService, location, http, config, tokenClient) {
680
- this.appService = appService;
681
- this.http = http;
682
- this.config = config;
683
- this.tokenClient = tokenClient;
684
- this._authorizationNotifier = new NucleusAuthorizationNotifier();
685
- this._initStarted = false;
686
- this._initialized = false;
687
- this._servicePrincipalTokenId = '_svcp';
688
- const storage = new LocalStorageBackend();
689
- this._crypto = new NucleusCrypto();
690
- this._authorizationHandler = new RedirectRequestHandler(storage, new BasicQueryStringUtils(), location, this._crypto);
691
- this._authorizationHandler.setAuthorizationNotifier(this._authorizationNotifier);
692
- this._store = new SecretsStore(config.clientId);
693
- }
694
- get identity() {
695
- return this._store.getIdentity();
696
- }
697
- get isAuthenticated() {
698
- return this.identity != null;
699
- }
700
- get servicePrincipalIdentity() {
701
- return this._store.getIdentity(this._servicePrincipalTokenId);
702
- }
703
- get isServicePrincipalAuthenticated() {
704
- return this.servicePrincipalIdentity != null;
705
- }
706
- get isIdentityServicePrincipal() {
707
- return this._store.defaultIdentityId === this._servicePrincipalTokenId;
708
- }
709
- init(startLogin = false) {
710
- return __awaiter(this, void 0, void 0, function* () {
711
- if (this._initStarted || this._initialized) {
712
- console.warn('Nucleus.Identity: Auth initialization was already started. Don\'t call init() multiple times!');
713
- return;
714
- }
715
- this._initStarted = true;
716
- this.handleLaunchCodeHash();
717
- yield this._authorizationHandler.completeAuthorizationRequestIfPossible();
718
- const authErr = this._authorizationNotifier.error;
719
- if (authErr) {
720
- throw new Error('Authorization err: ' + authErr.error + ': ' + authErr.errorDescription);
721
- }
722
- else if (this._authorizationNotifier.response) {
723
- window.location.hash = '';
724
- const request = this._authorizationNotifier.request;
725
- const response = this._authorizationNotifier.response;
726
- const res = yield this.tokenClient.getByAuthorizationCode(request.redirectUri, response.code, request.internal['code_verifier']);
727
- this._store.setDefaultIdentityId(null);
728
- yield this._store.setToken(res);
729
- }
730
- else {
731
- const res = yield this._store.getToken();
732
- if (!res && startLogin) {
733
- yield this.login();
734
- }
735
- }
736
- this._initialized = true;
737
- });
738
- }
739
- loginWithSecret(provider, secret) {
740
- var _a;
741
- return __awaiter(this, void 0, void 0, function* () {
742
- this._store.removeToken();
743
- const assertionToken = yield this.getServicePrincipalAccessToken();
744
- const scope = this.prepareScope(true, (_a = this.config) === null || _a === void 0 ? void 0 : _a.requestedScopes);
745
- const res = yield this.tokenClient.getBySecret(provider, secret, assertionToken, scope);
746
- this._store.setDefaultIdentityId(null);
747
- yield this._store.setToken(res);
748
- });
749
- }
750
- login() {
751
- return __awaiter(this, void 0, void 0, function* () {
752
- this._store.removeToken();
753
- const config = yield this.config.getConfiguration();
754
- const request = this.prepareAuthorizationRequest();
755
- if (this.appService.isNative) {
756
- const listener = App.addListener('appUrlOpen', data => {
757
- if (this.appService.platform === 'ios') {
758
- Browser.close();
759
- }
760
- listener.remove();
761
- const hash = this.getCodeHash(data.url);
762
- if (hash) {
763
- const targetUrl = window.location.origin + window.location.pathname + '#' + hash;
764
- window.location.assign(targetUrl);
765
- window.location.reload();
766
- }
767
- else {
768
- console.warn('Nucleus.Identity: Redirect url did not contain authorization code!', data);
769
- }
770
- });
771
- }
772
- this._authorizationHandler.performAuthorizationRequest(config, request);
773
- });
774
- }
775
- logout() {
776
- return __awaiter(this, void 0, void 0, function* () {
777
- this._store.removeToken();
778
- const config = yield this.config.getConfiguration();
779
- const redirectUrl = this.config.redirectUrl;
780
- const logoutUrl = config.endSessionEndpoint + '?post_logout_redirect_uri=' + encodeURI(redirectUrl);
781
- if (this.appService.isNative) {
782
- const listener = App.addListener('appUrlOpen', () => {
783
- Device.getInfo().then(info => {
784
- if (info.platform === 'ios') {
785
- Browser.close();
786
- }
787
- });
788
- listener.remove();
789
- });
790
- Browser.open({ url: logoutUrl });
791
- }
792
- else {
793
- window.location.assign(logoutUrl);
794
- }
795
- });
796
- }
797
- getAccessToken() {
798
- return __awaiter(this, void 0, void 0, function* () {
799
- if (!this._getTokenPromise) {
800
- this._getTokenPromise = this.getAccessTokenInternal();
801
- }
802
- try {
803
- return yield this._getTokenPromise;
804
- }
805
- finally {
806
- this._getTokenPromise = null;
807
- }
808
- });
809
- }
810
- getServicePrincipalAccessToken() {
811
- return __awaiter(this, void 0, void 0, function* () {
812
- if (!this._getServicePrincipalTokenPromise) {
813
- this._getServicePrincipalTokenPromise = this.getServicePrincipalAccessTokenInternal();
814
- }
815
- try {
816
- return yield this._getServicePrincipalTokenPromise;
817
- }
818
- finally {
819
- this._getServicePrincipalTokenPromise = null;
820
- }
821
- });
822
- }
823
- loginServicePrincipal() {
824
- return __awaiter(this, void 0, void 0, function* () {
825
- const sp = yield this._store.getServicePrincipal();
826
- if (sp) {
827
- const scope = this.prepareScope(false, this.config.servicePrincipalRequestedScopes);
828
- const res = yield this.tokenClient.getByClientCredentials(sp.id, sp.secret, scope);
829
- yield this._store.setToken(res, this._servicePrincipalTokenId);
830
- return res;
831
- }
832
- else {
833
- throw Error('Service principal is not registered!');
834
- }
835
- });
836
- }
837
- loginAsServicePrincipal() {
838
- return __awaiter(this, void 0, void 0, function* () {
839
- const token = yield this._store.getToken(this._servicePrincipalTokenId);
840
- if (!token) {
841
- yield this.loginServicePrincipal();
842
- }
843
- this._store.setDefaultIdentityId(this._servicePrincipalTokenId);
844
- });
845
- }
846
- getOtp(type, expiresIn = -1) {
847
- return __awaiter(this, void 0, void 0, function* () {
848
- let url = this.config.getServerUrl(`/otp/create?type=${type}`);
849
- if (expiresIn > 0) {
850
- url += `&expiresIn=${expiresIn}`;
851
- }
852
- return lastValueFrom(this.http.get(url));
853
- });
854
- }
855
- getOtpStatus(id) {
856
- return __awaiter(this, void 0, void 0, function* () {
857
- const url = this.config.getServerUrl(`/otp/status/${id}`);
858
- return lastValueFrom(this.http.get(url));
859
- });
860
- }
861
- getOtpUrl(redirectUrl, password) {
862
- const encoded = encodeURIComponent(redirectUrl);
863
- const url = `/otp/auth?otpValue=${password}&returnUrl=${encoded}`;
864
- return this.config.getServerUrl(url);
865
- }
866
- startServicePrincipalRegistration() {
867
- return __awaiter(this, void 0, void 0, function* () {
868
- const sp = yield this._store.getServicePrincipal();
869
- return yield this.tokenClient.getRegistrationCode(sp === null || sp === void 0 ? void 0 : sp.id);
870
- });
871
- }
872
- completeServicePrincipalRegistration(deviceCode) {
873
- return __awaiter(this, void 0, void 0, function* () {
874
- const tokenRes = yield this.waitForDeviceToken(deviceCode);
875
- const regRes = yield this.tokenClient.registerServicePrincipal(tokenRes.accessToken);
876
- yield this._store.setServicePrincipal({
877
- id: regRes.clientId,
878
- secret: regRes.clientSecret,
879
- expiresAt: regRes.secretExpirationDate
880
- });
881
- });
882
- }
883
- removeServicePrincipalRegistration() {
884
- return this._store.removeServicePrincipal();
885
- }
886
- getServicePrincipalRegistrationStatus() {
887
- return __awaiter(this, void 0, void 0, function* () {
888
- const sp = yield this._store.getServicePrincipal();
889
- return new ServicePrincipalRegistrationStatus(sp);
890
- });
891
- }
892
- startDeviceCodeLogin() {
893
- return __awaiter(this, void 0, void 0, function* () {
894
- const scope = this.prepareScope(true, this.config.requestedScopes);
895
- return yield this.tokenClient.getDeviceCode(scope);
896
- });
897
- }
898
- completeDeviceCodeLogin(deviceCode) {
899
- return __awaiter(this, void 0, void 0, function* () {
900
- const res = yield this.waitForDeviceToken(deviceCode);
901
- yield this._store.setToken(res);
902
- });
903
- }
904
- waitForDeviceToken(deviceCode) {
905
- return __awaiter(this, void 0, void 0, function* () {
906
- let res = null;
907
- do {
908
- if (deviceCode.isExpired()) {
909
- throw Error('Device code is expired!');
910
- }
911
- try {
912
- res = yield this.tokenClient.getByDeviceCode(deviceCode.deviceCode);
913
- }
914
- catch (error) {
915
- if (error instanceof AppAuthError && error.message === 'authorization_pending') {
916
- yield this.delay(2000);
917
- }
918
- else {
919
- throw error;
920
- }
921
- }
922
- } while (!res);
923
- return res;
924
- });
925
- }
926
- prepareAuthorizationRequest() {
927
- const redirectUri = this.config.redirectUrl;
928
- const params = {
929
- response_mode: 'fragment',
930
- prompt: 'consent',
931
- access_type: 'offline',
932
- auth_provider_hint: this.config.authProviderHint
933
- };
934
- return new AuthorizationRequest({
935
- client_id: this.config.clientId,
936
- redirect_uri: redirectUri,
937
- response_type: AuthorizationRequest.RESPONSE_TYPE_CODE,
938
- scope: this.prepareScope(true, this.config.requestedScopes),
939
- extras: params,
940
- }, this._crypto, true);
941
- }
942
- getServicePrincipalAccessTokenInternal() {
943
- return __awaiter(this, void 0, void 0, function* () {
944
- let token = yield this._store.getToken(this._servicePrincipalTokenId);
945
- if (!(token === null || token === void 0 ? void 0 : token.isValid())) {
946
- token = yield this.loginServicePrincipal();
947
- }
948
- return token === null || token === void 0 ? void 0 : token.accessToken;
949
- });
950
- }
951
- getAccessTokenInternal() {
952
- return __awaiter(this, void 0, void 0, function* () {
953
- let token = yield this._store.getToken();
954
- if (token && !token.isValid()) {
955
- token = yield this.loginWithRefreshToken(token);
956
- }
957
- return token === null || token === void 0 ? void 0 : token.accessToken;
958
- });
959
- }
960
- loginWithRefreshToken(token) {
961
- return __awaiter(this, void 0, void 0, function* () {
962
- if (!this._refreshTokenPromise) {
963
- this._refreshTokenPromise = this.loginWithRefreshTokenInternal(token);
964
- }
965
- try {
966
- return yield this._refreshTokenPromise;
967
- }
968
- finally {
969
- this._refreshTokenPromise = null;
970
- }
971
- });
972
- }
973
- loginWithRefreshTokenInternal(token) {
974
- return __awaiter(this, void 0, void 0, function* () {
975
- if (token === null || token === void 0 ? void 0 : token.refreshToken) {
976
- try {
977
- const res = yield this.tokenClient.getByRefreshToken(token.refreshToken);
978
- yield this._store.setToken(res);
979
- return res;
980
- }
981
- catch (err) {
982
- console.warn('Nucleus.Identity: Failed to login with refresh token.', err);
983
- if (err.message === 'invalid_grant') {
984
- yield this.logout();
985
- }
986
- }
987
- }
988
- else {
989
- console.warn('Nucleus.Identity: There is no refresh token available.');
990
- }
991
- });
992
- }
993
- getCodeHash(url) {
994
- const arr = url.split('#');
995
- if (arr.length > 1) {
996
- const hash = arr[1];
997
- if (hash.startsWith('code=')) {
998
- return hash;
999
- }
1000
- }
1001
- return null;
1002
- }
1003
- handleLaunchCodeHash() {
1004
- if (this.appService.isNative && this.appService.launchUrl) {
1005
- const hash = this.getCodeHash(this.appService.launchUrl);
1006
- if (hash) {
1007
- console.log('Nucleus.Identity: Got authorization code from launchUrl, will assign it to hash.');
1008
- window.location.hash = '#' + hash;
1009
- }
1010
- }
1011
- }
1012
- prepareScope(offlineAccess, aditionalScope) {
1013
- let scope = 'openid';
1014
- if (offlineAccess) {
1015
- scope += ' offline_access';
1016
- }
1017
- if (scope) {
1018
- scope += ' ' + aditionalScope;
1019
- }
1020
- return scope;
1021
- }
1022
- delay(miliseconds) {
1023
- return new Promise(resolve => {
1024
- setTimeout(() => {
1025
- resolve();
1026
- }, miliseconds);
1027
- });
1028
- }
1029
- }
1030
- NucleusIdentityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NucleusIdentityService, deps: [{ token: i1.NucleusAppService }, { token: LocationService }, { token: i1$1.HttpClient }, { token: OidcConfigurationService }, { token: TokenClient }], target: i0.ɵɵFactoryTarget.Injectable });
1031
- NucleusIdentityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NucleusIdentityService, providedIn: 'root' });
1032
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NucleusIdentityService, decorators: [{
1033
- type: Injectable,
1034
- args: [{
1035
- providedIn: 'root'
1036
- }]
1037
- }], ctorParameters: function () { return [{ type: i1.NucleusAppService }, { type: LocationService }, { type: i1$1.HttpClient }, { type: OidcConfigurationService }, { type: TokenClient }]; } });
1038
-
1039
- class NucleusTokenInterceptor {
1040
- constructor(auth, config) {
1041
- var _a;
1042
- this.auth = auth;
1043
- this.config = config;
1044
- this._authorityInterceptPaths = ['/api', '/manage', '/otp/create', '/otp/status'];
1045
- this._authority = config.authority.toLowerCase();
1046
- this._interceptUrls = (_a = config.httpInterceptorUrls) === null || _a === void 0 ? void 0 : _a.map(x => x.toLowerCase());
1047
- }
1048
- intercept(req, next) {
1049
- if (this.shouldIntercept(req.url)) {
1050
- const res = this.authorizeRequest(this.auth.getAccessToken(), req, next);
1051
- return this.checkUnauthorized(res);
1052
- }
1053
- return next.handle(req);
1054
- }
1055
- shouldIntercept(url) {
1056
- var _a;
1057
- url = url.toLowerCase();
1058
- if (url.startsWith(this._authority)) {
1059
- const pathname = new URL(url).pathname;
1060
- return (this._authorityInterceptPaths.some(x => pathname.startsWith(x)));
1061
- }
1062
- if (((_a = this._interceptUrls) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1063
- return this.config.httpInterceptorUrls.some(x => url.startsWith(x));
1064
- }
1065
- return false;
1066
- }
1067
- authorizeRequest(getToken, req, next) {
1068
- return from(getToken).pipe(mergeMap(token => {
1069
- if (token) {
1070
- const headers = req.headers.set('Authorization', `Bearer ${token}`);
1071
- req = req.clone({ headers });
1072
- }
1073
- return next.handle(req);
1074
- }));
1075
- }
1076
- checkUnauthorized(response) {
1077
- return response.pipe(catchError((err) => {
1078
- if (err instanceof HttpErrorResponse && err.status === 401) {
1079
- if (this.config.automaticLoginOnHttp401) {
1080
- this.auth.login();
1081
- }
1082
- }
1083
- return throwError(err);
1084
- }));
1085
- }
1086
- }
1087
- NucleusTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NucleusTokenInterceptor, deps: [{ token: NucleusIdentityService }, { token: NucleusIdentityConfig }], target: i0.ɵɵFactoryTarget.Injectable });
1088
- NucleusTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NucleusTokenInterceptor, providedIn: 'root' });
1089
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NucleusTokenInterceptor, decorators: [{
1090
- type: Injectable,
1091
- args: [{
1092
- providedIn: 'root'
1093
- }]
1094
- }], ctorParameters: function () { return [{ type: NucleusIdentityService }, { type: NucleusIdentityConfig }]; } });
1095
-
1096
- class NucleusIdentityModule {
1097
- static forRoot(config) {
1098
- return {
1099
- ngModule: NucleusIdentityModule,
1100
- providers: [
1101
- { provide: NucleusIdentityConfig, useValue: config },
1102
- { provide: HTTP_INTERCEPTORS, useClass: NucleusTokenInterceptor, multi: true },
1103
- ]
1104
- };
1105
- }
1106
- }
1107
- NucleusIdentityModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NucleusIdentityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1108
- NucleusIdentityModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NucleusIdentityModule });
1109
- NucleusIdentityModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NucleusIdentityModule });
1110
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NucleusIdentityModule, decorators: [{
1111
- type: NgModule,
1112
- args: [{
1113
- imports: [],
1114
- declarations: [],
1115
- exports: []
1116
- }]
1117
- }] });
1118
-
1119
- class OtpResponse {
1120
- }
1121
- class OtpStatus {
1122
- }
1123
- var OtpType;
1124
- (function (OtpType) {
1125
- OtpType[OtpType["SimpleNumbers"] = 0] = "SimpleNumbers";
1126
- OtpType[OtpType["SimpleAlfanumeric"] = 1] = "SimpleAlfanumeric";
1127
- OtpType[OtpType["Complex"] = 2] = "Complex";
1128
- })(OtpType || (OtpType = {}));
1129
-
1130
- /*
1131
- * Public API Surface of nucleus-identity
1132
- */
1133
-
1134
- /**
1135
- * Generated bundle index. Do not edit.
1136
- */
1137
-
1138
- export { DeviceCode, Identity, NucleusIdentityConfig, NucleusIdentityModule, NucleusIdentityService, OtpResponse, OtpStatus, OtpType, ServicePrincipalRegistrationStatus };
1139
- //# sourceMappingURL=kolektor-nucleus-identity.mjs.map