@igo2/auth 20.2.0 → 21.0.0-next.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"igo2-auth-monitoring.mjs","sources":["../../../packages/auth/monitoring/src/auth-monitoring/auth-monitoring.service.ts","../../../packages/auth/monitoring/src/auth-monitoring/auth-monitoring.provider.ts","../../../packages/auth/monitoring/src/igo2-auth-monitoring.ts"],"sourcesContent":["import { Injectable, Injector, inject } from '@angular/core';\n\nimport { AuthService, User } from '@igo2/auth';\nimport { ConfigService } from '@igo2/core/config';\nimport {\n AnyMonitoringOptions,\n MONITORING_OPTIONS,\n identifySentryUser\n} from '@igo2/core/monitoring';\n\nimport { first, switchMap } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthMonitoringService {\n private configService = inject(ConfigService);\n private monitoringOptions = inject<AnyMonitoringOptions | null>(\n MONITORING_OPTIONS,\n { optional: true }\n );\n private injector = inject(Injector);\n\n // The AuthService need to be lazy provided because this service is provided in the APP_INITIALIZER\n authService?: AuthService;\n\n constructor() {\n if (!this.monitoringOptions?.identifyUser) {\n return;\n }\n\n this.configService.isLoaded$\n .pipe(\n first((isLoaded) => isLoaded),\n switchMap(() => {\n this.authService = this.injector.get(AuthService);\n return this.authService?.authenticate$;\n })\n )\n .subscribe((isAuthenticated) => {\n const user = isAuthenticated ? this.authService.user : null;\n this._identifyUser(user);\n });\n }\n\n private _identifyUser(user: User | null): void {\n switch (this.monitoringOptions.provider) {\n case 'sentry':\n identifySentryUser(user);\n break;\n\n default:\n break;\n }\n }\n}\n","import {\n EnvironmentProviders,\n Injector,\n Provider,\n inject,\n provideAppInitializer\n} from '@angular/core';\n\nimport { ConfigService } from '@igo2/core/config';\nimport {\n AnyMonitoringOptions,\n MONITORING_OPTIONS\n} from '@igo2/core/monitoring';\n\nimport { AuthMonitoringService } from './auth-monitoring.service';\n\nexport function provideAuthUserMonitoring(\n options: AnyMonitoringOptions | null\n): (Provider | EnvironmentProviders)[] {\n if (!options) {\n return [];\n }\n\n return [\n {\n provide: AuthMonitoringService,\n useClass: AuthMonitoringService,\n deps: [ConfigService, MONITORING_OPTIONS, Injector]\n },\n // Force instantiate Tracing service to avoid require it in any constructor.\n provideAppInitializer(() => {\n inject(AuthMonitoringService);\n return;\n })\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;MAea,qBAAqB,CAAA;AACxB,IAAA,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;IACrC,iBAAiB,GAAG,MAAM,CAChC,kBAAkB,EAClB,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB;AACO,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;;AAGnC,IAAA,WAAW;AAEX,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,YAAY,EAAE;YACzC;QACF;QAEA,IAAI,CAAC,aAAa,CAAC;AAChB,aAAA,IAAI,CACH,KAAK,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,EAC7B,SAAS,CAAC,MAAK;YACb,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;AACjD,YAAA,OAAO,IAAI,CAAC,WAAW,EAAE,aAAa;AACxC,QAAA,CAAC,CAAC;AAEH,aAAA,SAAS,CAAC,CAAC,eAAe,KAAI;AAC7B,YAAA,MAAM,IAAI,GAAG,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,IAAI;AAC3D,YAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;AAC1B,QAAA,CAAC,CAAC;IACN;AAEQ,IAAA,aAAa,CAAC,IAAiB,EAAA;AACrC,QAAA,QAAQ,IAAI,CAAC,iBAAiB,CAAC,QAAQ;AACrC,YAAA,KAAK,QAAQ;gBACX,kBAAkB,CAAC,IAAI,CAAC;gBACxB;AAEF,YAAA;gBACE;;IAEN;wGAvCW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAArB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cAFpB,MAAM,EAAA,CAAA;;4FAEP,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACEK,SAAU,yBAAyB,CACvC,OAAoC,EAAA;IAEpC,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,OAAO,EAAE;IACX;IAEA,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,qBAAqB;AAC9B,YAAA,QAAQ,EAAE,qBAAqB;AAC/B,YAAA,IAAI,EAAE,CAAC,aAAa,EAAE,kBAAkB,EAAE,QAAQ;AACnD,SAAA;;QAED,qBAAqB,CAAC,MAAK;YACzB,MAAM,CAAC,qBAAqB,CAAC;YAC7B;AACF,QAAA,CAAC;KACF;AACH;;ACnCA;;AAEG;;;;"}
1
+ {"version":3,"file":"igo2-auth-monitoring.mjs","sources":["../../../packages/auth/monitoring/src/auth-monitoring/auth-monitoring.service.ts","../../../packages/auth/monitoring/src/auth-monitoring/auth-monitoring.provider.ts","../../../packages/auth/monitoring/src/igo2-auth-monitoring.ts"],"sourcesContent":["import { Injectable, Injector, inject } from '@angular/core';\n\nimport { AuthService, User } from '@igo2/auth';\nimport { ConfigService } from '@igo2/core/config';\nimport {\n AnyMonitoringOptions,\n MONITORING_OPTIONS,\n identifySentryUser\n} from '@igo2/core/monitoring';\n\nimport { first, switchMap } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthMonitoringService {\n private configService = inject(ConfigService);\n private monitoringOptions = inject<AnyMonitoringOptions | null>(\n MONITORING_OPTIONS,\n { optional: true }\n );\n private injector = inject(Injector);\n\n // The AuthService need to be lazy provided because this service is provided in the APP_INITIALIZER\n authService?: AuthService;\n\n constructor() {\n if (!this.monitoringOptions?.identifyUser) {\n return;\n }\n\n this.configService.isLoaded$\n .pipe(\n first((isLoaded) => isLoaded),\n switchMap(() => {\n this.authService = this.injector.get(AuthService);\n return this.authService?.authenticate$;\n })\n )\n .subscribe((isAuthenticated) => {\n const user = isAuthenticated ? this.authService!.user : null;\n this._identifyUser(user);\n });\n }\n\n private _identifyUser(user: User | null): void {\n switch (this.monitoringOptions?.provider) {\n case 'sentry':\n identifySentryUser(user);\n break;\n\n default:\n break;\n }\n }\n}\n","import {\n EnvironmentProviders,\n Injector,\n Provider,\n inject,\n provideAppInitializer\n} from '@angular/core';\n\nimport { ConfigService } from '@igo2/core/config';\nimport {\n AnyMonitoringOptions,\n MONITORING_OPTIONS\n} from '@igo2/core/monitoring';\n\nimport { AuthMonitoringService } from './auth-monitoring.service';\n\nexport function provideAuthUserMonitoring(\n options: AnyMonitoringOptions | null\n): (Provider | EnvironmentProviders)[] {\n if (!options) {\n return [];\n }\n\n return [\n {\n provide: AuthMonitoringService,\n useClass: AuthMonitoringService,\n deps: [ConfigService, MONITORING_OPTIONS, Injector]\n },\n // Force instantiate Tracing service to avoid require it in any constructor.\n provideAppInitializer(() => {\n inject(AuthMonitoringService);\n return;\n })\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;MAea,qBAAqB,CAAA;AACxB,IAAA,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;IACrC,iBAAiB,GAAG,MAAM,CAChC,kBAAkB,EAClB,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB;AACO,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;;AAGnC,IAAA,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,EAAE;AACZ,QAAA,OAAO,EAAE;IACX;IAEA,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,qBAAqB;AAC9B,YAAA,QAAQ,EAAE,qBAAqB;AAC/B,YAAA,IAAI,EAAE,CAAC,aAAa,EAAE,kBAAkB,EAAE,QAAQ;AACnD,SAAA;;QAED,qBAAqB,CAAC,MAAK;YACzB,MAAM,CAAC,qBAAqB,CAAC;YAC7B;AACF,QAAA,CAAC;KACF;AACH;;ACnCA;;AAEG;;;;"}
@@ -20,7 +20,7 @@ class TokenService {
20
20
  constructor() {
21
21
  const config = this.injector.get(ConfigService);
22
22
  this.options = config.getConfig('auth');
23
- this.tokenKey = this.options?.tokenKey;
23
+ this.tokenKey = this.options?.tokenKey ?? '';
24
24
  }
25
25
  set(token) {
26
26
  localStorage.setItem(this.tokenKey, token);
@@ -29,7 +29,7 @@ class TokenService {
29
29
  localStorage.removeItem(this.tokenKey);
30
30
  }
31
31
  get() {
32
- return localStorage.getItem(this.tokenKey);
32
+ return localStorage.getItem(this.tokenKey) ?? undefined;
33
33
  }
34
34
  decode() {
35
35
  const token = this.get();
@@ -41,15 +41,15 @@ class TokenService {
41
41
  isExpired() {
42
42
  const jwt = this.decode();
43
43
  const currentTime = new Date().getTime() / 1000;
44
- if (jwt && currentTime < jwt.exp) {
44
+ if (jwt?.exp && currentTime < jwt.exp) {
45
45
  return false;
46
46
  }
47
47
  return true;
48
48
  }
49
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: TokenService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
50
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: TokenService, providedIn: 'root' });
49
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: TokenService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
50
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: TokenService, providedIn: 'root' });
51
51
  }
52
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: TokenService, decorators: [{
52
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: TokenService, decorators: [{
53
53
  type: Injectable,
54
54
  args: [{
55
55
  providedIn: 'root'
@@ -79,10 +79,10 @@ class UserService {
79
79
  updatePreference(preference) {
80
80
  return this.http.patch(this.baseUrl, { preference });
81
81
  }
82
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: UserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
83
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: UserService });
82
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: UserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
83
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: UserService });
84
84
  }
85
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: UserService, decorators: [{
85
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: UserService, decorators: [{
86
86
  type: Injectable
87
87
  }], ctorParameters: () => [] });
88
88
 
@@ -96,13 +96,13 @@ class AuthService {
96
96
  languageService = inject(LanguageService);
97
97
  messageService = inject(MessageService);
98
98
  router = inject(Router, { optional: true });
99
- authenticate$ = new BehaviorSubject(undefined);
100
- logged$ = new BehaviorSubject(undefined);
99
+ authenticate$ = new BehaviorSubject(false);
100
+ logged$ = new BehaviorSubject(false);
101
101
  redirectUrl;
102
102
  languageForce = false;
103
103
  authOptions;
104
104
  anonymous = false;
105
- isLogging = signal(false, ...(ngDevMode ? [{ debugName: "isLogging" }] : []));
105
+ isLogging = signal(false, ...(ngDevMode ? [{ debugName: "isLogging" }] : /* istanbul ignore next */ []));
106
106
  get hasAuthService() {
107
107
  return this.authOptions?.url !== undefined;
108
108
  }
@@ -153,7 +153,7 @@ class AuthService {
153
153
  logout() {
154
154
  this.logoutInternal();
155
155
  if (this.authOptions.logoutRedirectRoute) {
156
- this.router.navigate([this.authOptions.logoutRedirectRoute]);
156
+ this.router?.navigate([this.authOptions.logoutRedirectRoute]);
157
157
  }
158
158
  }
159
159
  logoutInternal() {
@@ -250,7 +250,7 @@ class AuthService {
250
250
  return of(null);
251
251
  }
252
252
  if (this.userService) {
253
- const obs$ = this.authOptions.user.withSync
253
+ const obs$ = this.authOptions.user?.withSync
254
254
  ? this.userService.sync()
255
255
  : this.userService.getUser();
256
256
  return obs$.pipe(tap$1(() => this.authenticate$.next(true)));
@@ -258,10 +258,10 @@ class AuthService {
258
258
  this.authenticate$.next(true);
259
259
  return of(null);
260
260
  }
261
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
262
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthService, providedIn: 'root' });
261
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
262
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthService, providedIn: 'root' });
263
263
  }
264
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthService, decorators: [{
264
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthService, decorators: [{
265
265
  type: Injectable,
266
266
  args: [{
267
267
  providedIn: 'root'
@@ -283,10 +283,10 @@ class AdminGuard {
283
283
  }
284
284
  return false;
285
285
  }
286
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AdminGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
287
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AdminGuard, providedIn: 'root' });
286
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AdminGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
287
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AdminGuard, providedIn: 'root' });
288
288
  }
289
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AdminGuard, decorators: [{
289
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AdminGuard, decorators: [{
290
290
  type: Injectable,
291
291
  args: [{
292
292
  providedIn: 'root'
@@ -384,10 +384,10 @@ class AuthStorageService extends BaseStorage {
384
384
  });
385
385
  }
386
386
  }
387
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
388
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthStorageService, providedIn: 'root' });
387
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
388
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthStorageService, providedIn: 'root' });
389
389
  }
390
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthStorageService, decorators: [{
390
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthStorageService, decorators: [{
391
391
  type: Injectable,
392
392
  args: [{
393
393
  providedIn: 'root'
@@ -409,10 +409,10 @@ class AuthGuard {
409
409
  }
410
410
  return false;
411
411
  }
412
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
413
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthGuard, providedIn: 'root' });
412
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
413
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthGuard, providedIn: 'root' });
414
414
  }
415
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthGuard, decorators: [{
415
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthGuard, decorators: [{
416
416
  type: Injectable,
417
417
  args: [{
418
418
  providedIn: 'root'
@@ -509,12 +509,15 @@ class AuthInterceptor {
509
509
  handleHostsWithCredentials(reqUrl) {
510
510
  let withCredentials = false;
511
511
  for (const hostWithCredentials of this.hostsWithCredentials) {
512
+ if (!hostWithCredentials.domainRegFilters) {
513
+ return;
514
+ }
512
515
  const domainRegex = new RegExp(hostWithCredentials.domainRegFilters);
513
516
  if (domainRegex.test(reqUrl)) {
514
517
  withCredentials =
515
518
  hostWithCredentials.withCredentials !== undefined
516
519
  ? hostWithCredentials.withCredentials
517
- : undefined;
520
+ : false;
518
521
  break;
519
522
  }
520
523
  }
@@ -523,6 +526,9 @@ class AuthInterceptor {
523
526
  handleHostsAuthByKey(reqUrl) {
524
527
  let hostWithKey;
525
528
  for (const hostWithAuthByKey of this.hostsWithAuthByKey) {
529
+ if (!hostWithAuthByKey.domainRegFilters) {
530
+ return;
531
+ }
526
532
  const domainRegex = new RegExp(hostWithAuthByKey.domainRegFilters);
527
533
  if (domainRegex.test(reqUrl)) {
528
534
  const replace = `${hostWithAuthByKey.keyProperty}=${hostWithAuthByKey.keyValue}`;
@@ -542,7 +548,7 @@ class AuthInterceptor {
542
548
  const jwt = this.tokenService.decode();
543
549
  const currentTime = new Date().getTime() / 1000;
544
550
  if (!this.refreshInProgress &&
545
- jwt &&
551
+ jwt?.exp &&
546
552
  currentTime < jwt.exp &&
547
553
  currentTime > jwt.exp - 1800) {
548
554
  this.refreshInProgress = true;
@@ -558,10 +564,10 @@ class AuthInterceptor {
558
564
  });
559
565
  }
560
566
  }
561
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
562
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthInterceptor, providedIn: 'root' });
567
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
568
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthInterceptor, providedIn: 'root' });
563
569
  }
564
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthInterceptor, decorators: [{
570
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AuthInterceptor, decorators: [{
565
571
  type: Injectable,
566
572
  args: [{
567
573
  providedIn: 'root'
@@ -589,10 +595,10 @@ class LoggedGuard {
589
595
  }
590
596
  return false;
591
597
  }
592
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: LoggedGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
593
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: LoggedGuard, providedIn: 'root' });
598
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: LoggedGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
599
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: LoggedGuard, providedIn: 'root' });
594
600
  }
595
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: LoggedGuard, decorators: [{
601
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: LoggedGuard, decorators: [{
596
602
  type: Injectable,
597
603
  args: [{
598
604
  providedIn: 'root'
@@ -608,7 +614,7 @@ class ProfilsGuard {
608
614
  const authConfig = this.config.getConfig('auth');
609
615
  if (profils &&
610
616
  profils.profils &&
611
- profils.profils.some((v) => authConfig.profilsGuard.indexOf(v) !== -1)) {
617
+ profils.profils.some((v) => authConfig.profilsGuard?.indexOf(v) !== -1)) {
612
618
  return true;
613
619
  }
614
620
  this.authService.redirectUrl = state.url;
@@ -618,10 +624,10 @@ class ProfilsGuard {
618
624
  return false;
619
625
  }));
620
626
  }
621
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: ProfilsGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
622
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: ProfilsGuard, providedIn: 'root' });
627
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: ProfilsGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
628
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: ProfilsGuard, providedIn: 'root' });
623
629
  }
624
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: ProfilsGuard, decorators: [{
630
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: ProfilsGuard, decorators: [{
625
631
  type: Injectable,
626
632
  args: [{
627
633
  providedIn: 'root'
@@ -1 +1 @@
1
- {"version":3,"file":"igo2-auth.mjs","sources":["../../../packages/auth/src/lib/shared/token.service.ts","../../../packages/auth/src/lib/shared/user/user.service.ts","../../../packages/auth/src/lib/shared/auth.service.ts","../../../packages/auth/src/lib/shared/admin.guard.ts","../../../packages/auth/src/lib/shared/auth-storage.service.ts","../../../packages/auth/src/lib/shared/auth.guard.ts","../../../packages/auth/src/lib/shared/auth.interceptor.ts","../../../packages/auth/src/lib/shared/auth.interface.ts","../../../packages/auth/src/lib/shared/logged.guard.ts","../../../packages/auth/src/lib/shared/profils.guard.ts","../../../packages/auth/src/lib/shared/user/user.provider.ts","../../../packages/auth/src/lib/auth.provider.ts","../../../packages/auth/src/public_api.ts","../../../packages/auth/src/igo2-auth.ts"],"sourcesContent":["import { Injectable, Injector, inject } from '@angular/core';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { jwtDecode } from 'jwt-decode';\n\nimport { AuthOptions } from './auth.interface';\nimport { IgoJwtPayload } from './token.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class TokenService {\n private injector = inject(Injector);\n\n private options?: AuthOptions;\n private tokenKey: string;\n\n constructor() {\n const config = this.injector.get<ConfigService>(ConfigService);\n this.options = config.getConfig('auth');\n this.tokenKey = this.options?.tokenKey;\n }\n\n set(token: string) {\n localStorage.setItem(this.tokenKey, token);\n }\n\n remove() {\n localStorage.removeItem(this.tokenKey);\n }\n\n get(): string {\n return localStorage.getItem(this.tokenKey);\n }\n\n decode(): IgoJwtPayload | null {\n const token = this.get();\n if (!token) {\n return;\n }\n return jwtDecode(token) satisfies IgoJwtPayload;\n }\n\n isExpired() {\n const jwt = this.decode();\n const currentTime = new Date().getTime() / 1000;\n if (jwt && currentTime < jwt.exp) {\n return false;\n }\n return true;\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable, InjectionToken, inject } from '@angular/core';\n\nimport { BehaviorSubject, Observable, tap } from 'rxjs';\n\nimport { IAuthUserIgoOptions } from '../auth.interface';\nimport { IUser, IUserPreference } from './user.interface';\n\nexport const USER_AUTH_OPTIONS = new InjectionToken<IAuthUserIgoOptions>(\n 'USER_AUTH_OPTIONS'\n);\n\n@Injectable()\nexport class UserService {\n private http = inject(HttpClient);\n private options = inject(USER_AUTH_OPTIONS);\n\n private baseUrl: string;\n\n private _user$ = new BehaviorSubject<IUser>(undefined);\n user$ = this._user$.asObservable();\n\n constructor() {\n this.baseUrl = this.options.apiUrl;\n }\n\n getUser(): Observable<IUser> {\n return this.http\n .get<IUser>(this.baseUrl)\n .pipe(tap((user) => this._user$.next(user)));\n }\n\n sync(): Observable<IUser> {\n return this.http\n .get<IUser>(`${this.baseUrl}/sync`)\n .pipe(tap((user) => this._user$.next(user)));\n }\n\n updatePreference(preference: IUserPreference) {\n return this.http.patch<{ id: number }>(this.baseUrl, { preference });\n }\n}\n","import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport { ConfigService } from '@igo2/core/config';\nimport { LanguageService } from '@igo2/core/language';\nimport { MessageService } from '@igo2/core/message';\nimport { Base64 } from '@igo2/utils';\n\nimport { BehaviorSubject, Observable, of } from 'rxjs';\nimport { catchError, finalize, switchMap, tap } from 'rxjs/operators';\nimport { globalCacheBusterNotifier } from 'ts-cacheable';\n\nimport { AuthOptions, IInfosUser, User } from './auth.interface';\nimport { IgoJwtPayload } from './token.interface';\nimport { TokenService } from './token.service';\nimport { IUser } from './user/user.interface';\nimport { UserService } from './user/user.service';\n\ninterface IToken {\n token: string;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthService<T extends AuthOptions = AuthOptions> {\n private http = inject(HttpClient);\n private tokenService = inject(TokenService);\n private userService = inject(UserService, {\n optional: true\n });\n private config = inject(ConfigService);\n private languageService = inject(LanguageService);\n private messageService = inject(MessageService);\n private router = inject(Router, { optional: true });\n\n public authenticate$ = new BehaviorSubject<boolean>(undefined);\n public logged$ = new BehaviorSubject<boolean>(undefined);\n public redirectUrl: string;\n public languageForce = false;\n public authOptions: T;\n\n private anonymous = false;\n\n isLogging = signal(false);\n\n get hasAuthService() {\n return this.authOptions?.url !== undefined;\n }\n\n get user(): User | null {\n const decodedToken = this.decodeToken();\n return decodedToken?.user ? decodedToken.user : null;\n }\n\n constructor() {\n this.authOptions = this.config.getConfig('auth');\n\n this.initializeAuthentication(this.authenticated).subscribe();\n\n this.authenticate$.subscribe((authenticated) => {\n this.logged$.next(authenticated);\n globalCacheBusterNotifier.next();\n });\n }\n\n login(username: string, password: string): Observable<IUser> {\n this.isLogging.set(true);\n const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });\n\n const body = {\n username,\n password: this.encodePassword(password)\n };\n\n return this.loginCall(body, myHeader).pipe(\n finalize(() => this.isLogging.set(false))\n );\n }\n\n loginWithToken(\n token: string,\n type: string,\n infosUser?: IInfosUser,\n applicationId?: string\n ): Observable<IUser> {\n const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });\n\n const body = {\n token,\n typeConnection: type,\n infosUser,\n applicationId\n };\n\n return this.loginCall(body, myHeader);\n }\n\n loginAnonymous(): Observable<boolean> {\n this.anonymous = true;\n this.logged$.next(true);\n return of(true);\n }\n\n refresh(): Observable<IToken> {\n return this.http.post(`${this.authOptions?.url}/refresh`, {}).pipe(\n tap((data: IToken) => {\n this.tokenService.set(data.token);\n }),\n catchError((err) => {\n err.error.caught = true;\n throw err;\n })\n );\n }\n\n logout(): void {\n this.logoutInternal();\n if (this.authOptions.logoutRedirectRoute) {\n this.router.navigate([this.authOptions.logoutRedirectRoute]);\n }\n }\n\n private logoutInternal(): void {\n this.anonymous = false;\n this.tokenService.remove();\n this.authenticate$.next(false);\n }\n\n isAuthenticated(): boolean {\n return !this.tokenService.isExpired();\n }\n\n getToken(): string {\n return this.tokenService.get();\n }\n\n decodeToken(): IgoJwtPayload | null {\n if (this.isAuthenticated()) {\n return this.tokenService.decode();\n }\n return;\n }\n\n goToRedirectUrl() {\n if (!this.router) {\n return;\n }\n const redirectUrl = this.redirectUrl ?? this.authOptions.homeRoute ?? '/';\n\n this.router.navigateByUrl(redirectUrl);\n }\n\n getUserInfo(): Observable<User> {\n const url = this.authOptions?.url + '/info';\n return this.http.get<User>(url);\n }\n\n getProfils(): Observable<{ profils: string[] }> {\n return this.http.get<{ profils: string[] }>(\n `${this.authOptions?.url}/profils`\n );\n }\n\n updateUser(user: User): Observable<User> {\n return this.http.patch<User>(this.authOptions?.url, user);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n translateError(prefix: string, error: any): Observable<string> {\n return new Observable((observer) => {\n try {\n this.languageService.translate\n .get(prefix + error.error.message)\n .subscribe((errorMsg) => {\n observer.next(errorMsg);\n observer.complete();\n });\n } catch {\n if (error.error) observer.next(error.error.message);\n observer.complete();\n }\n });\n }\n\n private encodePassword(password: string) {\n return Base64.encode(password);\n }\n\n // authenticated or anonymous\n get logged(): boolean {\n return this.authenticated || this.isAnonymous;\n }\n\n get isAnonymous(): boolean {\n return this.anonymous;\n }\n\n get authenticated(): boolean {\n return this.isAuthenticated();\n }\n\n get isAdmin(): boolean {\n const token = this.decodeToken();\n if (token?.user?.isAdmin) {\n return true;\n }\n return false;\n }\n\n protected loginCall(body, headers) {\n return this.http\n .post<IToken>(`${this.authOptions?.url}/login`, body, { headers })\n .pipe(\n tap((data) => {\n this.tokenService.set(data.token);\n const tokenDecoded = this.decodeToken();\n if (tokenDecoded?.user) {\n if (tokenDecoded.user.locale && !this.languageForce) {\n this.languageService.setLanguage(tokenDecoded.user.locale);\n }\n if (tokenDecoded.user.isExpired) {\n this.messageService.alert(\n 'igo.auth.error.intern.Password expired'\n );\n }\n }\n }),\n switchMap(() => this.initializeAuthentication(true))\n );\n }\n\n private initializeAuthentication(\n isAuthenticated: boolean\n ): Observable<IUser> {\n if (!isAuthenticated) {\n this.authenticate$.next(false);\n return of(null);\n }\n\n if (this.userService) {\n const obs$ = this.authOptions.user.withSync\n ? this.userService.sync()\n : this.userService.getUser();\n\n return obs$.pipe(tap(() => this.authenticate$.next(true)));\n }\n\n this.authenticate$.next(true);\n return of(null);\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { AuthOptions } from './auth.interface';\nimport { AuthService } from './auth.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AdminGuard {\n private authService = inject(AuthService);\n private config = inject(ConfigService);\n private router = inject(Router);\n\n canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\n if (this.authService.isAdmin) {\n return true;\n }\n\n this.authService.redirectUrl = state.url;\n\n const authConfig = this.config.getConfig('auth') as AuthOptions;\n if (authConfig?.loginRoute) {\n this.router.navigateByUrl(authConfig.loginRoute);\n }\n\n return false;\n }\n}\n","import { Injectable, OnDestroy, inject } from '@angular/core';\n\nimport { ConfigService } from '@igo2/core/config';\nimport { BaseStorage, StorageScope } from '@igo2/core/storage';\n\nimport { EMPTY, Subject } from 'rxjs';\nimport { debounceTime, switchMap, takeUntil } from 'rxjs/operators';\n\nimport { AuthStorageOptions } from './auth-storage.interface';\nimport { AuthService } from './auth.service';\nimport { TokenService } from './token.service';\nimport { UserService } from './user/user.service';\n\nconst DEBOUNCE_TIME = 3000; // 3 seconds;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthStorageService\n extends BaseStorage<AuthStorageOptions>\n implements OnDestroy\n{\n private authService = inject(AuthService);\n private userService = inject(UserService, {\n optional: true\n });\n private tokenService = inject(TokenService);\n\n private preferencesChanged$ = new Subject<void>();\n private destroy$ = new Subject<void>();\n private pendingPreferences: Record<string, unknown> = {};\n private serverPreferences: Record<string, unknown> = {};\n\n constructor() {\n const config = inject(ConfigService);\n super(config);\n\n this.authService.authenticate$\n .pipe(\n switchMap((isAuthenticated) => {\n if (isAuthenticated && this.userService) {\n return this.userService.user$;\n }\n return EMPTY;\n }),\n takeUntil(this.destroy$)\n )\n .subscribe((user) => {\n if (!user?.preference) {\n return;\n }\n\n this.serverPreferences = { ...user.preference };\n for (const key of Object.keys(user.preference)) {\n const value = user.preference[key];\n super.set(key, value);\n }\n });\n\n this.preferencesChanged$\n .pipe(\n debounceTime(DEBOUNCE_TIME), // Wait for more changes to accumulate\n takeUntil(this.destroy$)\n )\n .subscribe(() => {\n this.syncPreferences();\n });\n }\n\n ngOnDestroy() {\n this.destroy$.next();\n this.destroy$.complete();\n this.preferencesChanged$.complete();\n }\n\n set(\n key: string,\n value: string | object | boolean | number,\n scope: StorageScope = StorageScope.LOCAL\n ) {\n if (scope === StorageScope.LOCAL && this.authService.authenticated) {\n this.pendingPreferences[key] = value;\n this.preferencesChanged$.next();\n }\n super.set(key, value, scope);\n }\n\n remove(key: string, scope: StorageScope = StorageScope.LOCAL) {\n if (scope === StorageScope.LOCAL && this.authService.authenticated) {\n this.pendingPreferences[key] = undefined;\n this.preferencesChanged$.next();\n }\n super.remove(key, scope);\n }\n\n clear(scope: StorageScope = StorageScope.LOCAL) {\n if (scope === StorageScope.LOCAL && this.authService.authenticated) {\n this.pendingPreferences = {};\n this.preferencesChanged$.next();\n }\n\n let token: string;\n if (scope === StorageScope.LOCAL) {\n token = this.tokenService.get();\n }\n\n super.clear(scope);\n\n if (token) {\n this.tokenService.set(token);\n }\n }\n\n private syncPreferences() {\n if (Object.keys(this.pendingPreferences).length === 0) {\n return;\n }\n\n // Filter out preferences that haven't actually changed\n const changedPreferences: Record<string, unknown> = {};\n for (const key of Object.keys(this.pendingPreferences)) {\n const newValue = this.pendingPreferences[key];\n const oldValue = this.serverPreferences[key];\n\n if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {\n changedPreferences[key] = newValue;\n }\n }\n\n this.pendingPreferences = {};\n\n if (Object.keys(changedPreferences).length > 0) {\n this.userService?.updatePreference(changedPreferences).subscribe(() => {\n Object.assign(this.serverPreferences, changedPreferences);\n });\n }\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { AuthOptions } from './auth.interface';\nimport { AuthService } from './auth.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthGuard {\n private authService = inject(AuthService);\n private config = inject(ConfigService);\n private router = inject(Router);\n\n canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\n if (this.authService.authenticated) {\n return true;\n }\n\n this.authService.redirectUrl = state.url;\n\n const authConfig = this.config.getConfig('auth') as AuthOptions;\n if (authConfig?.loginRoute) {\n this.router.navigateByUrl(authConfig.loginRoute);\n }\n\n return false;\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport {\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpRequest\n} from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { Observable } from 'rxjs';\nimport { Md5 } from 'ts-md5';\n\nimport {\n AuthByKeyOptions,\n AuthOptions,\n WithCredentialsOptions\n} from './auth.interface';\nimport { TokenService } from './token.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthInterceptor implements HttpInterceptor {\n private config = inject(ConfigService);\n private tokenService = inject(TokenService);\n private http = inject(HttpClient);\n\n private authOptions: AuthOptions;\n private refreshInProgress = false;\n private trustHosts: string[];\n private hostsWithCredentials: WithCredentialsOptions[];\n private hostsWithAuthByKey: AuthByKeyOptions[];\n\n constructor() {\n this.authOptions = this.config.getConfig('auth') as AuthOptions;\n\n this.trustHosts = this.authOptions?.trustHosts || [];\n this.trustHosts.push(window.location.hostname);\n\n this.hostsWithCredentials = this.authOptions?.hostsWithCredentials || [];\n this.hostsWithAuthByKey = this.authOptions?.hostsByKey || [];\n }\n\n intercept(\n originalReq: HttpRequest<unknown>,\n next: HttpHandler\n ): Observable<HttpEvent<unknown>> {\n const withCredentials = this.handleHostsWithCredentials(originalReq.url);\n let req = originalReq.clone();\n const hostWithKey = this.handleHostsAuthByKey(originalReq.url);\n if (hostWithKey) {\n req = req.clone({\n params: req.params.set(hostWithKey.key, hostWithKey.value)\n });\n }\n if (withCredentials) {\n req = originalReq.clone({\n withCredentials\n });\n return next.handle(req);\n }\n this.refreshToken();\n const token = this.tokenService.get();\n const element = document.createElement('a');\n element.href = req.url;\n\n if (!token || this.trustHosts.indexOf(element.hostname) === -1) {\n return next.handle(req);\n }\n\n const authHeader = `Bearer ${token}`;\n let authReq = req.clone({\n headers: req.headers.set('Authorization', authHeader)\n });\n\n const tokenDecoded = this.tokenService.decode();\n if (authReq.params.get('_i') === 'true' && tokenDecoded?.user?.sourceId) {\n const hashUser = Md5.hashStr(tokenDecoded.user.sourceId) as string;\n authReq = authReq.clone({\n params: authReq.params.set('_i', hashUser)\n });\n } else if (authReq.params.get('_i') === 'true') {\n authReq = authReq.clone({\n params: authReq.params.delete('_i')\n });\n }\n\n return next.handle(authReq);\n }\n\n interceptXhr(xhr, url: string): boolean {\n const withCredentials = this.handleHostsWithCredentials(url);\n if (withCredentials) {\n xhr.withCredentials = withCredentials;\n return true;\n }\n\n this.refreshToken();\n const element = document.createElement('a');\n element.href = url;\n\n const token = this.tokenService.get();\n if (!token || this.trustHosts.indexOf(element.hostname) === -1) {\n return false;\n }\n xhr.setRequestHeader('Authorization', 'Bearer ' + token);\n return true;\n }\n\n alterUrlWithKeyAuth(url: string): string {\n const hostWithKey = this.handleHostsAuthByKey(url);\n const interceptedUrl = url;\n if (hostWithKey) {\n const urlDecomposed = interceptedUrl.split(/[?&]/);\n let urlWithKeyAdded = urlDecomposed.shift();\n const paramsToKeep = urlDecomposed.filter((p) => p.length !== 0);\n paramsToKeep.push(`${hostWithKey.key}=${hostWithKey.value}`);\n if (paramsToKeep.length) {\n urlWithKeyAdded += '?' + paramsToKeep.join('&');\n }\n return urlWithKeyAdded;\n }\n return;\n }\n\n private handleHostsWithCredentials(reqUrl: string) {\n let withCredentials = false;\n for (const hostWithCredentials of this.hostsWithCredentials) {\n const domainRegex = new RegExp(hostWithCredentials.domainRegFilters);\n if (domainRegex.test(reqUrl)) {\n withCredentials =\n hostWithCredentials.withCredentials !== undefined\n ? hostWithCredentials.withCredentials\n : undefined;\n break;\n }\n }\n return withCredentials;\n }\n\n private handleHostsAuthByKey(reqUrl: string): { key: string; value: string } {\n let hostWithKey;\n for (const hostWithAuthByKey of this.hostsWithAuthByKey) {\n const domainRegex = new RegExp(hostWithAuthByKey.domainRegFilters);\n if (domainRegex.test(reqUrl)) {\n const replace = `${hostWithAuthByKey.keyProperty}=${hostWithAuthByKey.keyValue}`;\n const keyAdded = new RegExp(replace, 'gm');\n if (!keyAdded.test(reqUrl)) {\n hostWithKey = {\n key: hostWithAuthByKey.keyProperty,\n value: hostWithAuthByKey.keyValue\n };\n break;\n }\n }\n }\n return hostWithKey;\n }\n\n refreshToken() {\n const jwt = this.tokenService.decode();\n const currentTime = new Date().getTime() / 1000;\n\n if (\n !this.refreshInProgress &&\n jwt &&\n currentTime < jwt.exp &&\n currentTime > jwt.exp - 1800\n ) {\n this.refreshInProgress = true;\n\n const url = this.authOptions?.url;\n return this.http.post(`${url}/refresh`, {}).subscribe(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (data: any) => {\n this.tokenService.set(data.token);\n this.refreshInProgress = false;\n },\n (err) => {\n err.error.caught = true;\n return err;\n }\n );\n }\n }\n}\n","import { Provider } from '@angular/core';\n\nimport { BaseUser } from '@igo2/core/user';\n\nexport interface AuthInternOptions {\n enabled?: boolean;\n}\n\nexport interface AuthFacebookOptions {\n enabled?: boolean;\n appId: string;\n}\n\nexport interface AuthGoogleOptions {\n enabled?: boolean;\n apiKey: string;\n clientId: string;\n}\n\nexport interface AuthByKeyOptions {\n domainRegFilters?: string;\n keyProperty?: string;\n keyValue?: string;\n}\nexport interface WithCredentialsOptions {\n withCredentials?: boolean;\n domainRegFilters?: string;\n}\n\nexport interface User extends BaseUser {\n source?: string;\n sourceId?: string;\n locale?: string;\n isExpired?: boolean;\n isAdmin?: boolean;\n defaultContextId?: string;\n}\n\nexport interface IInfosUser {\n tokenId: string;\n}\n\nexport interface AuthOptions {\n url: string;\n /** User api url is the igo user versus the url is the authentification API */\n user?: IAuthUserIgoOptions;\n tokenKey?: string;\n allowAnonymous?: boolean;\n loginRoute?: string;\n logoutRedirectRoute?: string;\n logoutRoute?: string;\n homeRoute?: string;\n trustHosts?: string[];\n profilsGuard?: string[];\n hostsWithCredentials?: WithCredentialsOptions[];\n hostsByKey?: AuthByKeyOptions[];\n intern?: AuthInternOptions;\n}\n\nexport interface IAuthUserIgoOptions {\n apiUrl: string;\n // Allow to sync the user. Use it when the user may not exist on the user API system.\n withSync?: boolean;\n}\n\nexport interface AuthByKeyOptions {\n domainRegFilters?: string;\n keyProperty?: string;\n keyValue?: string;\n}\nexport interface WithCredentialsOptions {\n withCredentials?: boolean;\n domainRegFilters?: string;\n}\n\nexport interface AuthInternOptions {\n enabled?: boolean;\n}\n\nexport interface AuthFeature<KindT extends AuthFeatureKind> {\n kind: KindT;\n providers: Provider[];\n}\n\nexport enum AuthFeatureKind {\n Microsoft = 0,\n User\n}\n","import { Injectable, inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { AuthOptions } from './auth.interface';\nimport { AuthService } from './auth.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class LoggedGuard {\n private authService = inject(AuthService);\n private config = inject(ConfigService);\n private router = inject(Router);\n\n canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\n if (this.authService.logged) {\n return true;\n }\n\n this.authService.redirectUrl = state.url;\n\n const authConfig = this.config.getConfig('auth') as AuthOptions;\n if (authConfig?.loginRoute) {\n this.router.navigateByUrl(authConfig.loginRoute);\n }\n\n return false;\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { map } from 'rxjs/operators';\n\nimport { AuthOptions } from './auth.interface';\nimport { AuthService } from './auth.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ProfilsGuard {\n private authService = inject(AuthService);\n private config = inject(ConfigService);\n private router = inject(Router);\n\n canActivate(_route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\n return this.authService.getProfils().pipe(\n map((profils: { profils: string[] }) => {\n const authConfig = this.config.getConfig('auth') as AuthOptions;\n if (\n profils &&\n profils.profils &&\n profils.profils.some((v) => authConfig.profilsGuard.indexOf(v) !== -1)\n ) {\n return true;\n }\n\n this.authService.redirectUrl = state.url;\n\n if (authConfig?.loginRoute) {\n this.router.navigateByUrl(authConfig.loginRoute);\n }\n\n return false;\n })\n );\n }\n}\n","import { ConfigService } from '@igo2/core/config';\n\nimport {\n AuthFeature,\n AuthFeatureKind,\n IAuthUserIgoOptions\n} from '../auth.interface';\nimport { USER_AUTH_OPTIONS, UserService } from './user.service';\n\nexport function withUserIgo(): AuthFeature<AuthFeatureKind.User> {\n return {\n kind: AuthFeatureKind.User,\n providers: [\n {\n provide: USER_AUTH_OPTIONS,\n useFactory: (config: ConfigService) => config.getConfig('auth.user'),\n deps: [ConfigService]\n },\n {\n provide: UserService,\n useFactory: (options: IAuthUserIgoOptions | undefined) => {\n if (!options) {\n return undefined;\n }\n\n return new UserService();\n },\n deps: [USER_AUTH_OPTIONS]\n }\n ]\n };\n}\n","import { HTTP_INTERCEPTORS } from '@angular/common/http';\nimport {\n EnvironmentProviders,\n Provider,\n makeEnvironmentProviders\n} from '@angular/core';\n\nimport { StorageService } from '@igo2/core/storage';\n\nimport {\n AuthFeature,\n AuthFeatureKind,\n AuthInterceptor,\n AuthStorageService\n} from './shared';\n\nexport function provideAuthentification(\n ...features: AuthFeature<AuthFeatureKind>[]\n): EnvironmentProviders {\n const providers: Provider[] = [\n {\n provide: HTTP_INTERCEPTORS,\n useClass: AuthInterceptor,\n multi: true\n },\n {\n provide: StorageService,\n useClass: AuthStorageService\n }\n ];\n\n for (const feature of features) {\n providers.push(...feature.providers);\n }\n\n return makeEnvironmentProviders(providers);\n}\n","/*\n * Public API Surface of auth\n */\nexport * from './lib/auth.provider';\nexport * from './lib/shared';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["tap"],"mappings":";;;;;;;;;;;;;;;MAYa,YAAY,CAAA;AACf,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAE3B,IAAA,OAAO;AACP,IAAA,QAAQ;AAEhB,IAAA,WAAA,GAAA;QACE,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAgB,aAAa,CAAC;QAC9D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ;IACxC;AAEA,IAAA,GAAG,CAAC,KAAa,EAAA;QACf,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC;IAC5C;IAEA,MAAM,GAAA;AACJ,QAAA,YAAY,CAAC,U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["../../../packages/auth/src/lib/shared/token.service.ts","../../../packages/auth/src/lib/shared/user/user.service.ts","../../../packages/auth/src/lib/shared/auth.service.ts","../../../packages/auth/src/lib/shared/admin.guard.ts","../../../packages/auth/src/lib/shared/auth-storage.service.ts","../../../packages/auth/src/lib/shared/auth.guard.ts","../../../packages/auth/src/lib/shared/auth.interceptor.ts","../../../packages/auth/src/lib/shared/auth.interface.ts","../../../packages/auth/src/lib/shared/logged.guard.ts","../../../packages/auth/src/lib/shared/profils.guard.ts","../../../packages/auth/src/lib/shared/user/user.provider.ts","../../../packages/auth/src/lib/auth.provider.ts","../../../packages/auth/src/public_api.ts","../../../packages/auth/src/igo2-auth.ts"],"sourcesContent":["import { Injectable, Injector, inject } from '@angular/core';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { jwtDecode } from 'jwt-decode';\n\nimport { AuthOptions } from './auth.interface';\nimport { IgoJwtPayload } from './token.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class TokenService {\n private injector = inject(Injector);\n\n private options?: AuthOptions;\n private tokenKey: string;\n\n constructor() {\n const config = this.injector.get<ConfigService>(ConfigService);\n this.options = config.getConfig('auth');\n this.tokenKey = this.options?.tokenKey ?? '';\n }\n\n set(token: string) {\n localStorage.setItem(this.tokenKey, token);\n }\n\n remove() {\n localStorage.removeItem(this.tokenKey);\n }\n\n get(): string | undefined {\n return localStorage.getItem(this.tokenKey) ?? undefined;\n }\n\n decode(): IgoJwtPayload | undefined {\n const token = this.get();\n if (!token) {\n return;\n }\n return jwtDecode(token) satisfies IgoJwtPayload;\n }\n\n isExpired() {\n const jwt = this.decode();\n const currentTime = new Date().getTime() / 1000;\n if (jwt?.exp && currentTime < jwt.exp) {\n return false;\n }\n return true;\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable, InjectionToken, inject } from '@angular/core';\n\nimport { BehaviorSubject, Observable, tap } from 'rxjs';\n\nimport { IAuthUserIgoOptions } from '../auth.interface';\nimport { IUser, IUserPreference } from './user.interface';\n\nexport const USER_AUTH_OPTIONS = new InjectionToken<IAuthUserIgoOptions>(\n 'USER_AUTH_OPTIONS'\n);\n\n@Injectable()\nexport class UserService {\n private http = inject(HttpClient);\n private options = inject(USER_AUTH_OPTIONS);\n\n private baseUrl: string;\n\n private _user$ = new BehaviorSubject<IUser | undefined>(undefined);\n user$ = this._user$.asObservable();\n\n constructor() {\n this.baseUrl = this.options.apiUrl;\n }\n\n getUser(): Observable<IUser> {\n return this.http\n .get<IUser>(this.baseUrl)\n .pipe(tap((user) => this._user$.next(user)));\n }\n\n sync(): Observable<IUser> {\n return this.http\n .get<IUser>(`${this.baseUrl}/sync`)\n .pipe(tap((user) => this._user$.next(user)));\n }\n\n updatePreference(preference: IUserPreference) {\n return this.http.patch<{ id: number }>(this.baseUrl, { preference });\n }\n}\n","import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport { ConfigService } from '@igo2/core/config';\nimport { LanguageService } from '@igo2/core/language';\nimport { MessageService } from '@igo2/core/message';\nimport { Base64 } from '@igo2/utils';\n\nimport { BehaviorSubject, Observable, of } from 'rxjs';\nimport { catchError, finalize, switchMap, tap } from 'rxjs/operators';\nimport { globalCacheBusterNotifier } from 'ts-cacheable';\n\nimport { AuthOptions, IInfosUser, User } from './auth.interface';\nimport { IgoJwtPayload } from './token.interface';\nimport { TokenService } from './token.service';\nimport { IUser } from './user/user.interface';\nimport { UserService } from './user/user.service';\n\ninterface IToken {\n token: string;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthService<T extends AuthOptions = AuthOptions> {\n private http = inject(HttpClient);\n private tokenService = inject(TokenService);\n private userService = inject(UserService, {\n optional: true\n });\n private config = inject(ConfigService);\n private languageService = inject(LanguageService);\n private messageService = inject(MessageService);\n private router = inject(Router, { optional: true });\n\n public authenticate$ = new BehaviorSubject<boolean>(false);\n public logged$ = new BehaviorSubject<boolean>(false);\n public redirectUrl?: string;\n public languageForce = false;\n public authOptions: T;\n\n private anonymous = false;\n\n isLogging = signal(false);\n\n get hasAuthService() {\n return this.authOptions?.url !== undefined;\n }\n\n get user(): User | null {\n const decodedToken = this.decodeToken();\n return decodedToken?.user ? decodedToken.user : null;\n }\n\n constructor() {\n this.authOptions = this.config.getConfig('auth');\n\n this.initializeAuthentication(this.authenticated).subscribe();\n\n this.authenticate$.subscribe((authenticated) => {\n this.logged$.next(authenticated);\n globalCacheBusterNotifier.next();\n });\n }\n\n login(username: string, password: string): Observable<IUser | null> {\n this.isLogging.set(true);\n const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });\n\n const body = {\n username,\n password: this.encodePassword(password)\n };\n\n return this.loginCall(body, myHeader).pipe(\n finalize(() => this.isLogging.set(false))\n );\n }\n\n loginWithToken(\n token: string,\n type: string,\n infosUser?: IInfosUser,\n applicationId?: string\n ): Observable<IUser | null> {\n const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });\n\n const body = {\n token,\n typeConnection: type,\n infosUser,\n applicationId\n };\n\n return this.loginCall(body, myHeader);\n }\n\n loginAnonymous(): Observable<boolean> {\n this.anonymous = true;\n this.logged$.next(true);\n return of(true);\n }\n\n refresh(): Observable<IToken> {\n return this.http.post<IToken>(`${this.authOptions?.url}/refresh`, {}).pipe(\n tap((data) => {\n this.tokenService.set(data.token);\n }),\n catchError((err) => {\n err.error.caught = true;\n throw err;\n })\n );\n }\n\n logout(): void {\n this.logoutInternal();\n if (this.authOptions.logoutRedirectRoute) {\n this.router?.navigate([this.authOptions.logoutRedirectRoute]);\n }\n }\n\n private logoutInternal(): void {\n this.anonymous = false;\n this.tokenService.remove();\n this.authenticate$.next(false);\n }\n\n isAuthenticated(): boolean {\n return !this.tokenService.isExpired();\n }\n\n getToken(): string | undefined {\n return this.tokenService.get();\n }\n\n decodeToken(): IgoJwtPayload | undefined {\n if (this.isAuthenticated()) {\n return this.tokenService.decode();\n }\n return;\n }\n\n goToRedirectUrl() {\n if (!this.router) {\n return;\n }\n const redirectUrl = this.redirectUrl ?? this.authOptions.homeRoute ?? '/';\n\n this.router.navigateByUrl(redirectUrl);\n }\n\n getUserInfo(): Observable<User> {\n const url = this.authOptions?.url + '/info';\n return this.http.get<User>(url);\n }\n\n getProfils(): Observable<{ profils: string[] }> {\n return this.http.get<{ profils: string[] }>(\n `${this.authOptions?.url}/profils`\n );\n }\n\n updateUser(user: User): Observable<User> {\n return this.http.patch<User>(this.authOptions?.url, user);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n translateError(prefix: string, error: any): Observable<string> {\n return new Observable((observer) => {\n try {\n this.languageService.translate\n .get(prefix + error.error.message)\n .subscribe((errorMsg) => {\n observer.next(errorMsg);\n observer.complete();\n });\n } catch {\n if (error.error) observer.next(error.error.message);\n observer.complete();\n }\n });\n }\n\n private encodePassword(password: string) {\n return Base64.encode(password);\n }\n\n // authenticated or anonymous\n get logged(): boolean {\n return this.authenticated || this.isAnonymous;\n }\n\n get isAnonymous(): boolean {\n return this.anonymous;\n }\n\n get authenticated(): boolean {\n return this.isAuthenticated();\n }\n\n get isAdmin(): boolean {\n const token = this.decodeToken();\n if (token?.user?.isAdmin) {\n return true;\n }\n return false;\n }\n\n protected loginCall(body: unknown, headers: HttpHeaders) {\n return this.http\n .post<IToken>(`${this.authOptions?.url}/login`, body, { headers })\n .pipe(\n tap((data) => {\n this.tokenService.set(data.token);\n const tokenDecoded = this.decodeToken();\n if (tokenDecoded?.user) {\n if (tokenDecoded.user.locale && !this.languageForce) {\n this.languageService.setLanguage(tokenDecoded.user.locale);\n }\n if (tokenDecoded.user.isExpired) {\n this.messageService.alert(\n 'igo.auth.error.intern.Password expired'\n );\n }\n }\n }),\n switchMap(() => this.initializeAuthentication(true))\n );\n }\n\n private initializeAuthentication(\n isAuthenticated: boolean\n ): Observable<IUser | null> {\n if (!isAuthenticated) {\n this.authenticate$.next(false);\n return of(null);\n }\n\n if (this.userService) {\n const obs$ = this.authOptions.user?.withSync\n ? this.userService.sync()\n : this.userService.getUser();\n\n return obs$.pipe(tap(() => this.authenticate$.next(true)));\n }\n\n this.authenticate$.next(true);\n return of(null);\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { AuthOptions } from './auth.interface';\nimport { AuthService } from './auth.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AdminGuard {\n private authService = inject(AuthService);\n private config = inject(ConfigService);\n private router = inject(Router);\n\n canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\n if (this.authService.isAdmin) {\n return true;\n }\n\n this.authService.redirectUrl = state.url;\n\n const authConfig = this.config.getConfig('auth') as AuthOptions;\n if (authConfig?.loginRoute) {\n this.router.navigateByUrl(authConfig.loginRoute);\n }\n\n return false;\n }\n}\n","import { Injectable, OnDestroy, inject } from '@angular/core';\n\nimport { ConfigService } from '@igo2/core/config';\nimport { BaseStorage, StorageScope } from '@igo2/core/storage';\n\nimport { EMPTY, Subject } from 'rxjs';\nimport { debounceTime, switchMap, takeUntil } from 'rxjs/operators';\n\nimport { AuthStorageOptions } from './auth-storage.interface';\nimport { AuthService } from './auth.service';\nimport { TokenService } from './token.service';\nimport { UserService } from './user/user.service';\n\nconst DEBOUNCE_TIME = 3000; // 3 seconds;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthStorageService\n extends BaseStorage<AuthStorageOptions>\n implements OnDestroy\n{\n private authService = inject(AuthService);\n private userService = inject(UserService, {\n optional: true\n });\n private tokenService = inject(TokenService);\n\n private preferencesChanged$ = new Subject<void>();\n private destroy$ = new Subject<void>();\n private pendingPreferences: Record<string, unknown> = {};\n private serverPreferences: Record<string, unknown> = {};\n\n constructor() {\n const config = inject(ConfigService);\n super(config);\n\n this.authService.authenticate$\n .pipe(\n switchMap((isAuthenticated) => {\n if (isAuthenticated && this.userService) {\n return this.userService.user$;\n }\n return EMPTY;\n }),\n takeUntil(this.destroy$)\n )\n .subscribe((user) => {\n if (!user?.preference) {\n return;\n }\n\n this.serverPreferences = { ...user.preference };\n for (const key of Object.keys(user.preference)) {\n const value = user.preference[key];\n super.set(key, value);\n }\n });\n\n this.preferencesChanged$\n .pipe(\n debounceTime(DEBOUNCE_TIME), // Wait for more changes to accumulate\n takeUntil(this.destroy$)\n )\n .subscribe(() => {\n this.syncPreferences();\n });\n }\n\n ngOnDestroy() {\n this.destroy$.next();\n this.destroy$.complete();\n this.preferencesChanged$.complete();\n }\n\n set(\n key: string,\n value: string | object | boolean | number,\n scope: StorageScope = StorageScope.LOCAL\n ) {\n if (scope === StorageScope.LOCAL && this.authService.authenticated) {\n this.pendingPreferences[key] = value;\n this.preferencesChanged$.next();\n }\n super.set(key, value, scope);\n }\n\n remove(key: string, scope: StorageScope = StorageScope.LOCAL) {\n if (scope === StorageScope.LOCAL && this.authService.authenticated) {\n this.pendingPreferences[key] = undefined;\n this.preferencesChanged$.next();\n }\n super.remove(key, scope);\n }\n\n clear(scope: StorageScope = StorageScope.LOCAL) {\n if (scope === StorageScope.LOCAL && this.authService.authenticated) {\n this.pendingPreferences = {};\n this.preferencesChanged$.next();\n }\n\n let token: string | undefined;\n if (scope === StorageScope.LOCAL) {\n token = this.tokenService.get();\n }\n\n super.clear(scope);\n\n if (token) {\n this.tokenService.set(token);\n }\n }\n\n private syncPreferences() {\n if (Object.keys(this.pendingPreferences).length === 0) {\n return;\n }\n\n // Filter out preferences that haven't actually changed\n const changedPreferences: Record<string, unknown> = {};\n for (const key of Object.keys(this.pendingPreferences)) {\n const newValue = this.pendingPreferences[key];\n const oldValue = this.serverPreferences[key];\n\n if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {\n changedPreferences[key] = newValue;\n }\n }\n\n this.pendingPreferences = {};\n\n if (Object.keys(changedPreferences).length > 0) {\n this.userService?.updatePreference(changedPreferences).subscribe(() => {\n Object.assign(this.serverPreferences, changedPreferences);\n });\n }\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { AuthOptions } from './auth.interface';\nimport { AuthService } from './auth.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthGuard {\n private authService = inject(AuthService);\n private config = inject(ConfigService);\n private router = inject(Router);\n\n canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\n if (this.authService.authenticated) {\n return true;\n }\n\n this.authService.redirectUrl = state.url;\n\n const authConfig = this.config.getConfig('auth') as AuthOptions;\n if (authConfig?.loginRoute) {\n this.router.navigateByUrl(authConfig.loginRoute);\n }\n\n return false;\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport {\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpRequest\n} from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { Observable } from 'rxjs';\nimport { Md5 } from 'ts-md5';\n\nimport {\n AuthByKeyOptions,\n AuthOptions,\n WithCredentialsOptions\n} from './auth.interface';\nimport { TokenService } from './token.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthInterceptor implements HttpInterceptor {\n private config = inject(ConfigService);\n private tokenService = inject(TokenService);\n private http = inject(HttpClient);\n\n private authOptions: AuthOptions;\n private refreshInProgress = false;\n private trustHosts: string[];\n private hostsWithCredentials: WithCredentialsOptions[];\n private hostsWithAuthByKey: AuthByKeyOptions[];\n\n constructor() {\n this.authOptions = this.config.getConfig('auth') as AuthOptions;\n\n this.trustHosts = this.authOptions?.trustHosts || [];\n this.trustHosts.push(window.location.hostname);\n\n this.hostsWithCredentials = this.authOptions?.hostsWithCredentials || [];\n this.hostsWithAuthByKey = this.authOptions?.hostsByKey || [];\n }\n\n intercept(\n originalReq: HttpRequest<unknown>,\n next: HttpHandler\n ): Observable<HttpEvent<unknown>> {\n const withCredentials = this.handleHostsWithCredentials(originalReq.url);\n let req = originalReq.clone();\n const hostWithKey = this.handleHostsAuthByKey(originalReq.url);\n if (hostWithKey) {\n req = req.clone({\n params: req.params.set(hostWithKey.key, hostWithKey.value)\n });\n }\n if (withCredentials) {\n req = originalReq.clone({\n withCredentials\n });\n return next.handle(req);\n }\n this.refreshToken();\n const token = this.tokenService.get();\n const element = document.createElement('a');\n element.href = req.url;\n\n if (!token || this.trustHosts.indexOf(element.hostname) === -1) {\n return next.handle(req);\n }\n\n const authHeader = `Bearer ${token}`;\n let authReq = req.clone({\n headers: req.headers.set('Authorization', authHeader)\n });\n\n const tokenDecoded = this.tokenService.decode();\n if (authReq.params.get('_i') === 'true' && tokenDecoded?.user?.sourceId) {\n const hashUser = Md5.hashStr(tokenDecoded.user.sourceId) as string;\n authReq = authReq.clone({\n params: authReq.params.set('_i', hashUser)\n });\n } else if (authReq.params.get('_i') === 'true') {\n authReq = authReq.clone({\n params: authReq.params.delete('_i')\n });\n }\n\n return next.handle(authReq);\n }\n\n interceptXhr(xhr: XMLHttpRequest, url: string): boolean {\n const withCredentials = this.handleHostsWithCredentials(url);\n if (withCredentials) {\n xhr.withCredentials = withCredentials;\n return true;\n }\n\n this.refreshToken();\n const element = document.createElement('a');\n element.href = url;\n\n const token = this.tokenService.get();\n if (!token || this.trustHosts.indexOf(element.hostname) === -1) {\n return false;\n }\n xhr.setRequestHeader('Authorization', 'Bearer ' + token);\n return true;\n }\n\n alterUrlWithKeyAuth(url: string): string | undefined {\n const hostWithKey = this.handleHostsAuthByKey(url);\n const interceptedUrl = url;\n if (hostWithKey) {\n const urlDecomposed = interceptedUrl.split(/[?&]/);\n let urlWithKeyAdded = urlDecomposed.shift();\n const paramsToKeep = urlDecomposed.filter((p) => p.length !== 0);\n paramsToKeep.push(`${hostWithKey.key}=${hostWithKey.value}`);\n if (paramsToKeep.length) {\n urlWithKeyAdded += '?' + paramsToKeep.join('&');\n }\n return urlWithKeyAdded;\n }\n return;\n }\n\n private handleHostsWithCredentials(reqUrl: string) {\n let withCredentials = false;\n for (const hostWithCredentials of this.hostsWithCredentials) {\n if (!hostWithCredentials.domainRegFilters) {\n return;\n }\n const domainRegex = new RegExp(hostWithCredentials.domainRegFilters);\n if (domainRegex.test(reqUrl)) {\n withCredentials =\n hostWithCredentials.withCredentials !== undefined\n ? hostWithCredentials.withCredentials\n : false;\n break;\n }\n }\n return withCredentials;\n }\n\n private handleHostsAuthByKey(\n reqUrl: string\n ): { key: string; value: string } | undefined {\n let hostWithKey: { key: string; value: string } | undefined;\n for (const hostWithAuthByKey of this.hostsWithAuthByKey) {\n if (!hostWithAuthByKey.domainRegFilters) {\n return;\n }\n const domainRegex = new RegExp(hostWithAuthByKey.domainRegFilters);\n if (domainRegex.test(reqUrl)) {\n const replace = `${hostWithAuthByKey.keyProperty}=${hostWithAuthByKey.keyValue}`;\n const keyAdded = new RegExp(replace, 'gm');\n if (!keyAdded.test(reqUrl)) {\n hostWithKey = {\n key: hostWithAuthByKey.keyProperty,\n value: hostWithAuthByKey.keyValue\n };\n break;\n }\n }\n }\n return hostWithKey;\n }\n\n refreshToken() {\n const jwt = this.tokenService.decode();\n const currentTime = new Date().getTime() / 1000;\n\n if (\n !this.refreshInProgress &&\n jwt?.exp &&\n currentTime < jwt.exp &&\n currentTime > jwt.exp - 1800\n ) {\n this.refreshInProgress = true;\n\n const url = this.authOptions?.url;\n return this.http.post(`${url}/refresh`, {}).subscribe(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (data: any) => {\n this.tokenService.set(data.token);\n this.refreshInProgress = false;\n },\n (err) => {\n err.error.caught = true;\n return err;\n }\n );\n }\n }\n}\n","import { Provider } from '@angular/core';\n\nimport { BaseUser } from '@igo2/core/user';\n\nexport interface AuthInternOptions {\n enabled?: boolean;\n}\n\nexport interface User extends BaseUser {\n source?: string;\n sourceId?: string;\n locale?: string;\n isExpired?: boolean;\n isAdmin?: boolean;\n defaultContextId?: string;\n}\n\nexport interface IInfosUser {\n tokenId: string;\n}\n\nexport interface AuthOptions {\n url: string;\n /** User api url is the igo user versus the url is the authentification API */\n user?: IAuthUserIgoOptions;\n tokenKey?: string;\n allowAnonymous?: boolean;\n loginRoute?: string;\n logoutRedirectRoute?: string;\n logoutRoute?: string;\n homeRoute?: string;\n trustHosts?: string[];\n profilsGuard?: string[];\n hostsWithCredentials?: WithCredentialsOptions[];\n hostsByKey?: AuthByKeyOptions[];\n intern?: AuthInternOptions;\n}\n\nexport interface IAuthUserIgoOptions {\n apiUrl: string;\n // Allow to sync the user. Use it when the user may not exist on the user API system.\n withSync?: boolean;\n}\n\nexport interface AuthByKeyOptions {\n domainRegFilters?: string;\n keyProperty: string;\n keyValue: string;\n}\nexport interface WithCredentialsOptions {\n withCredentials?: boolean;\n domainRegFilters?: string;\n}\n\nexport interface AuthInternOptions {\n enabled?: boolean;\n}\n\nexport interface AuthFeature<KindT extends AuthFeatureKind> {\n kind: KindT;\n providers: Provider[];\n}\n\nexport enum AuthFeatureKind {\n Microsoft = 0,\n User\n}\n","import { Injectable, inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { AuthOptions } from './auth.interface';\nimport { AuthService } from './auth.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class LoggedGuard {\n private authService = inject(AuthService);\n private config = inject(ConfigService);\n private router = inject(Router);\n\n canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\n if (this.authService.logged) {\n return true;\n }\n\n this.authService.redirectUrl = state.url;\n\n const authConfig = this.config.getConfig('auth') as AuthOptions;\n if (authConfig?.loginRoute) {\n this.router.navigateByUrl(authConfig.loginRoute);\n }\n\n return false;\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\n\nimport { ConfigService } from '@igo2/core/config';\n\nimport { map } from 'rxjs/operators';\n\nimport { AuthOptions } from './auth.interface';\nimport { AuthService } from './auth.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ProfilsGuard {\n private authService = inject(AuthService);\n private config = inject(ConfigService);\n private router = inject(Router);\n\n canActivate(_route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\n return this.authService.getProfils().pipe(\n map((profils: { profils: string[] }) => {\n const authConfig = this.config.getConfig('auth') as AuthOptions;\n if (\n profils &&\n profils.profils &&\n profils.profils.some(\n (v) => authConfig.profilsGuard?.indexOf(v) !== -1\n )\n ) {\n return true;\n }\n\n this.authService.redirectUrl = state.url;\n\n if (authConfig?.loginRoute) {\n this.router.navigateByUrl(authConfig.loginRoute);\n }\n\n return false;\n })\n );\n }\n}\n","import { ConfigService } from '@igo2/core/config';\n\nimport {\n AuthFeature,\n AuthFeatureKind,\n IAuthUserIgoOptions\n} from '../auth.interface';\nimport { USER_AUTH_OPTIONS, UserService } from './user.service';\n\nexport function withUserIgo(): AuthFeature<AuthFeatureKind.User> {\n return {\n kind: AuthFeatureKind.User,\n providers: [\n {\n provide: USER_AUTH_OPTIONS,\n useFactory: (config: ConfigService) => config.getConfig('auth.user'),\n deps: [ConfigService]\n },\n {\n provide: UserService,\n useFactory: (options: IAuthUserIgoOptions | undefined) => {\n if (!options) {\n return undefined;\n }\n\n return new UserService();\n },\n deps: [USER_AUTH_OPTIONS]\n }\n ]\n };\n}\n","import { HTTP_INTERCEPTORS } from '@angular/common/http';\nimport {\n EnvironmentProviders,\n Provider,\n makeEnvironmentProviders\n} from '@angular/core';\n\nimport { StorageService } from '@igo2/core/storage';\n\nimport {\n AuthFeature,\n AuthFeatureKind,\n AuthInterceptor,\n AuthStorageService\n} from './shared';\n\nexport function provideAuthentification(\n ...features: AuthFeature<AuthFeatureKind>[]\n): EnvironmentProviders {\n const providers: Provider[] = [\n {\n provide: HTTP_INTERCEPTORS,\n useClass: AuthInterceptor,\n multi: true\n },\n {\n provide: StorageService,\n useClass: AuthStorageService\n }\n ];\n\n for (const feature of features) {\n providers.push(...feature.providers);\n }\n\n return makeEnvironmentProviders(providers);\n}\n","/*\n * Public API Surface of auth\n */\nexport * from './lib/auth.provider';\nexport * from './lib/shared';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["tap"],"mappings":";;;;;;;;;;;;;;;MAYa,YAAY,CAAA;AACf,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAE3B,IAAA,OAAO;AACP,IAAA,QAAQ;AAEhB,IAAA,WAAA,GAAA;QACE,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAgB,aAAa,CAAC;QAC9D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,IAAI,EAAE;IAC9C;AAEA,IAAA,GAAG,CAAC,KAAa,EAAA;QACf,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC;IAC5C;IAEA,MAAM,GAAA;AACJ,QAAA,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC;IACxC;IAEA,GAAG,GAAA;QACD,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,SAAS;IACzD;IAEA,MAAM,GAAA;AACJ,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE;QACxB,IAAI,CAAC,KAAK,EAAE;YACV;QACF;AACA,QAAA,OAAO,SAAS,CAAC,KAAK,CAAyB;IACjD;IAEA,SAAS,GAAA;AACP,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE;QACzB,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI;QAC/C,IAAI,GAAG,EAAE,GAAG,IAAI,WAAW,GAAG,GAAG,CAAC,GAAG,EAAE;AACrC,YAAA,OAAO,KAAK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BAC1B,UAAU,EAAE,CAAC,MAAqB,KAAK,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;gBACpE,IAAI,EAAE,CAAC,aAAa;AACrB,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,WAAW;AACpB,gBAAA,UAAU,EAAE,CAAC,OAAwC,KAAI;oBACvD,IAAI,CAAC,OAAO,EAAE;AACZ,wBAAA,OAAO,SAAS;oBAClB;oBAEA,OAAO,IAAI,WAAW,EAAE;gBAC1B,CAAC;gBACD,IAAI,EAAE,CAAC,iBAAiB;AACzB;AACF;KACF;AACH;;ACfM,SAAU,uBAAuB,CACrC,GAAG,QAAwC,EAAA;AAE3C,IAAA,MAAM,SAAS,GAAe;AAC5B,QAAA;AACE,YAAA,OAAO,EAAE,iBAAiB;AAC1B,YAAA,QAAQ,EAAE,eAAe;AACzB,YAAA,KAAK,EAAE;AACR,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,cAAc;AACvB,YAAA,QAAQ,EAAE;AACX;KACF;AAED,IAAA,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IACtC;AAEA,IAAA,OAAO,wBAAwB,CAAC,SAAS,CAAC;AAC5C;;ACpCA;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igo2/auth",
3
- "version": "20.2.0",
3
+ "version": "21.0.0-next.10",
4
4
  "description": "IGO Library",
5
5
  "author": "IGO Community",
6
6
  "keywords": [
@@ -18,38 +18,32 @@
18
18
  },
19
19
  "exports": {
20
20
  ".": {
21
- "types": "./index.d.ts",
21
+ "types": "./types/igo2-auth.d.ts",
22
22
  "default": "./fesm2022/igo2-auth.mjs"
23
23
  },
24
24
  "./environment": {
25
- "types": "./environment/index.d.ts",
25
+ "types": "./types/igo2-auth-environment.d.ts",
26
26
  "default": "./fesm2022/igo2-auth-environment.mjs"
27
27
  },
28
- "./facebook": {
29
- "types": "./facebook/index.d.ts",
30
- "default": "./fesm2022/igo2-auth-facebook.mjs"
31
- },
28
+ "./facebook": {},
32
29
  "./form": {
33
- "types": "./form/index.d.ts",
30
+ "types": "./types/igo2-auth-form.d.ts",
34
31
  "default": "./fesm2022/igo2-auth-form.mjs"
35
32
  },
36
- "./google": {
37
- "types": "./google/index.d.ts",
38
- "default": "./fesm2022/igo2-auth-google.mjs"
39
- },
33
+ "./google": {},
40
34
  "./internal": {
41
- "types": "./internal/index.d.ts",
35
+ "types": "./types/igo2-auth-internal.d.ts",
42
36
  "default": "./fesm2022/igo2-auth-internal.mjs"
43
37
  },
44
38
  "./microsoft": {
45
- "types": "./microsoft/index.d.ts",
39
+ "types": "./types/igo2-auth-microsoft.d.ts",
46
40
  "default": "./fesm2022/igo2-auth-microsoft.mjs"
47
41
  },
48
42
  "./package.json": {
49
43
  "default": "./package.json"
50
44
  },
51
45
  "./monitoring": {
52
- "types": "./monitoring/index.d.ts",
46
+ "types": "./types/igo2-auth-monitoring.d.ts",
53
47
  "default": "./fesm2022/igo2-auth-monitoring.mjs"
54
48
  }
55
49
  },
@@ -57,26 +51,27 @@
57
51
  "tslib": "^2.6.0"
58
52
  },
59
53
  "peerDependencies": {
60
- "@angular/cdk": "^20.0.0",
61
- "@angular/common": "^20.0.0",
62
- "@angular/core": "^20.0.0",
63
- "@angular/forms": "^20.0.0",
64
- "@angular/material": "^20.0.0",
65
- "@angular/router": "^20.0.0",
66
- "@azure/msal-angular": "^4.0.0",
67
- "@azure/msal-browser": "^4.0.0",
68
- "@igo2/common": "^20.2.0",
69
- "@igo2/core": "^20.2.0",
70
- "@igo2/utils": "^20.2.0",
54
+ "@angular/cdk": "^21.0.0",
55
+ "@angular/common": "^21.0.0",
56
+ "@angular/core": "^21.0.0",
57
+ "@angular/forms": "^21.0.0",
58
+ "@angular/material": "^21.0.0",
59
+ "@angular/router": "^21.0.0",
60
+ "@azure/msal-angular": "^5.0.0",
61
+ "@azure/msal-browser": "^5.0.0",
62
+ "@igo2/common": "^21.0.0-next.10",
63
+ "@igo2/core": "^21.0.0-next.10",
64
+ "@igo2/utils": "^21.0.0-next.10",
71
65
  "jwt-decode": "^4.0.0",
72
66
  "rxjs": "^7.8.0",
73
67
  "ts-cacheable": "^1.0.6",
74
- "ts-md5": "^1.3.0"
68
+ "ts-md5": "^2.0.0"
75
69
  },
76
70
  "engines": {
77
71
  "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
78
72
  },
79
73
  "module": "fesm2022/igo2-auth.mjs",
80
- "typings": "index.d.ts",
81
- "sideEffects": false
74
+ "typings": "types/igo2-auth.d.ts",
75
+ "sideEffects": false,
76
+ "type": "module"
82
77
  }