@igo2/auth 17.0.0-next.2 → 17.0.0-next.3

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 (109) hide show
  1. package/environment/environment.interface.d.ts +6 -0
  2. package/environment/index.d.ts +5 -0
  3. package/esm2022/environment/environment.interface.mjs +2 -0
  4. package/esm2022/environment/igo2-auth-environment.mjs +5 -0
  5. package/esm2022/environment/public_api.mjs +2 -0
  6. package/esm2022/facebook/auth-facebook/auth-facebook.component.mjs +65 -0
  7. package/esm2022/facebook/igo2-auth-facebook.mjs +5 -0
  8. package/esm2022/facebook/public_api.mjs +3 -0
  9. package/esm2022/facebook/shared/auth-facebook.interface.mjs +2 -0
  10. package/esm2022/facebook/shared/index.mjs +2 -0
  11. package/esm2022/form/auth-form/auth-form.component.mjs +166 -0
  12. package/esm2022/form/auth-form.module.mjs +95 -0
  13. package/esm2022/form/igo2-auth-form.mjs +5 -0
  14. package/esm2022/form/public_api.mjs +9 -0
  15. package/esm2022/form/shared/auth-form.interface.mjs +2 -0
  16. package/esm2022/form/shared/auth-storage.interface.mjs +2 -0
  17. package/esm2022/form/shared/auth-storage.service.mjs +98 -0
  18. package/esm2022/form/shared/index.mjs +4 -0
  19. package/esm2022/google/auth-google/auth-google.component.mjs +108 -0
  20. package/esm2022/google/igo2-auth-google.mjs +5 -0
  21. package/esm2022/google/public_api.mjs +3 -0
  22. package/esm2022/google/shared/auth-google.interface.mjs +2 -0
  23. package/esm2022/google/shared/index.mjs +2 -0
  24. package/esm2022/internal/auth-intern/auth-intern.component.mjs +84 -0
  25. package/esm2022/internal/igo2-auth-internal.mjs +5 -0
  26. package/esm2022/internal/public_api.mjs +2 -0
  27. package/esm2022/lib/shared/auth.interface.mjs +1 -1
  28. package/esm2022/lib/shared/index.mjs +1 -5
  29. package/esm2022/microsoft/auth-microsoft/auth-microsoft.component.mjs +100 -0
  30. package/esm2022/microsoft/auth-microsoft.provider.mjs +92 -0
  31. package/esm2022/microsoft/auth-microsoftb2c/auth-microsoftb2c.component.mjs +98 -0
  32. package/esm2022/microsoft/auth-microsoftb2c/auth-msalBroadcastServiceb2c.service.mjs +47 -0
  33. package/esm2022/microsoft/auth-microsoftb2c/auth-msalServiceb2c.service.mjs +85 -0
  34. package/esm2022/microsoft/igo2-auth-microsoft.mjs +5 -0
  35. package/esm2022/microsoft/public_api.mjs +5 -0
  36. package/esm2022/microsoft/shared/auth-microsoft.interface.mjs +2 -0
  37. package/esm2022/microsoft/shared/index.mjs +2 -0
  38. package/esm2022/public_api.mjs +1 -8
  39. package/{lib/auth-form → facebook/auth-facebook}/auth-facebook.component.d.ts +1 -1
  40. package/facebook/index.d.ts +5 -0
  41. package/facebook/public_api.d.ts +2 -0
  42. package/facebook/shared/auth-facebook.interface.d.ts +4 -0
  43. package/facebook/shared/index.d.ts +1 -0
  44. package/fesm2022/igo2-auth-environment.mjs +4 -0
  45. package/fesm2022/igo2-auth-environment.mjs.map +1 -0
  46. package/fesm2022/igo2-auth-facebook.mjs +70 -0
  47. package/fesm2022/igo2-auth-facebook.mjs.map +1 -0
  48. package/fesm2022/igo2-auth-form.mjs +350 -0
  49. package/fesm2022/igo2-auth-form.mjs.map +1 -0
  50. package/fesm2022/igo2-auth-google.mjs +112 -0
  51. package/fesm2022/igo2-auth-google.mjs.map +1 -0
  52. package/fesm2022/igo2-auth-internal.mjs +89 -0
  53. package/fesm2022/igo2-auth-internal.mjs.map +1 -0
  54. package/fesm2022/igo2-auth-microsoft.mjs +390 -0
  55. package/fesm2022/igo2-auth-microsoft.mjs.map +1 -0
  56. package/fesm2022/igo2-auth.mjs +7 -956
  57. package/fesm2022/igo2-auth.mjs.map +1 -1
  58. package/{lib → form}/auth-form/auth-form.component.d.ts +3 -4
  59. package/form/auth-form.module.d.ts +22 -0
  60. package/form/index.d.ts +5 -0
  61. package/form/public_api.d.ts +5 -0
  62. package/form/shared/auth-form.interface.d.ts +9 -0
  63. package/{lib → form}/shared/auth-storage.service.d.ts +1 -2
  64. package/form/shared/index.d.ts +3 -0
  65. package/{lib/auth-form → google/auth-google}/auth-google.component.d.ts +1 -1
  66. package/google/index.d.ts +5 -0
  67. package/google/public_api.d.ts +2 -0
  68. package/google/shared/auth-google.interface.d.ts +5 -0
  69. package/google/shared/index.d.ts +1 -0
  70. package/{lib/auth-form → internal/auth-intern}/auth-intern.component.d.ts +1 -1
  71. package/internal/index.d.ts +5 -0
  72. package/internal/public_api.d.ts +1 -0
  73. package/lib/shared/auth.interface.d.ts +14 -71
  74. package/lib/shared/index.d.ts +0 -4
  75. package/{lib/auth-form → microsoft/auth-microsoft}/auth-microsoft.component.d.ts +2 -2
  76. package/{lib/shared → microsoft}/auth-microsoft.provider.d.ts +5 -2
  77. package/{lib/auth-form → microsoft/auth-microsoftb2c}/auth-microsoftb2c.component.d.ts +3 -3
  78. package/{lib/shared → microsoft/auth-microsoftb2c}/auth-msalBroadcastServiceb2c.service.d.ts +1 -1
  79. package/microsoft/index.d.ts +5 -0
  80. package/microsoft/public_api.d.ts +4 -0
  81. package/microsoft/shared/auth-microsoft.interface.d.ts +32 -0
  82. package/microsoft/shared/index.d.ts +1 -0
  83. package/package.json +39 -3
  84. package/public_api.d.ts +0 -7
  85. package/src/auth.theme.scss +9 -9
  86. package/esm2022/lib/auth-form/auth-facebook.component.mjs +0 -65
  87. package/esm2022/lib/auth-form/auth-form.component.mjs +0 -170
  88. package/esm2022/lib/auth-form/auth-google.component.mjs +0 -108
  89. package/esm2022/lib/auth-form/auth-intern.component.mjs +0 -84
  90. package/esm2022/lib/auth-form/auth-microsoft.component.mjs +0 -100
  91. package/esm2022/lib/auth-form/auth-microsoftb2c.component.mjs +0 -98
  92. package/esm2022/lib/auth-form/index.mjs +0 -19
  93. package/esm2022/lib/auth.module.mjs +0 -98
  94. package/esm2022/lib/environment/environment.interface.mjs +0 -2
  95. package/esm2022/lib/environment/index.mjs +0 -2
  96. package/esm2022/lib/shared/auth-microsoft.provider.mjs +0 -86
  97. package/esm2022/lib/shared/auth-msalBroadcastServiceb2c.service.mjs +0 -47
  98. package/esm2022/lib/shared/auth-msalServiceb2c.service..mjs +0 -85
  99. package/esm2022/lib/shared/auth-storage.interface.mjs +0 -2
  100. package/esm2022/lib/shared/auth-storage.service.mjs +0 -100
  101. package/esm2022/lib/shared/protected.directive.mjs +0 -21
  102. package/lib/auth-form/index.d.ts +0 -11
  103. package/lib/auth.module.d.ts +0 -24
  104. package/lib/environment/environment.interface.d.ts +0 -5
  105. package/lib/shared/protected.directive.d.ts +0 -8
  106. package/src/lib/auth-form/auth-intern.theme.scss +0 -19
  107. /package/{lib/environment/index.d.ts → environment/public_api.d.ts} +0 -0
  108. /package/{lib → form}/shared/auth-storage.interface.d.ts +0 -0
  109. /package/{lib/shared/auth-msalServiceb2c.service..d.ts → microsoft/auth-microsoftb2c/auth-msalServiceb2c.service.d.ts} +0 -0
@@ -1,39 +1,18 @@
1
+ import * as i1 from '@angular/common/http';
2
+ import { HttpHeaders } from '@angular/common/http';
1
3
  import * as i0 from '@angular/core';
2
- import { Injectable, Optional, EventEmitter, Component, ChangeDetectionStrategy, Output, Input, Inject, Directive, Injector, APP_INITIALIZER, NgModule } from '@angular/core';
4
+ import { Injectable, Optional, Inject, Injector, APP_INITIALIZER } from '@angular/core';
5
+ import * as i3 from '@angular/router';
3
6
  import * as i2 from '@igo2/core/config';
4
7
  import { ConfigService } from '@igo2/core/config';
5
- import * as i1 from '@angular/common/http';
6
- import { HttpHeaders, HTTP_INTERCEPTORS } from '@angular/common/http';
7
- import * as i3 from '@angular/router';
8
- import { NavigationStart } from '@angular/router';
9
8
  import * as i4 from '@igo2/core/language';
10
- import { IgoLanguageModule } from '@igo2/core/language';
11
9
  import * as i5 from '@igo2/core/message';
12
10
  import { Base64 } from '@igo2/utils';
13
- import { BehaviorSubject, of, Subject, from, first, switchMap } from 'rxjs';
14
- import { tap, catchError, filter, takeUntil, map } from 'rxjs/operators';
11
+ import { BehaviorSubject, of, first, switchMap } from 'rxjs';
12
+ import { tap, catchError, map } from 'rxjs/operators';
15
13
  import { globalCacheBusterNotifier } from 'ts-cacheable';
16
14
  import { jwtDecode } from 'jwt-decode';
17
- import * as i1$1 from '@angular/common';
18
- import { NgIf, CommonModule } from '@angular/common';
19
- import * as i4$2 from '@angular/material/button';
20
- import { MatButtonModule } from '@angular/material/button';
21
- import * as i6 from '@ngx-translate/core';
22
- import { TranslateModule } from '@ngx-translate/core';
23
- import * as i3$1 from '@angular/forms';
24
- import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
25
- import * as i4$1 from '@angular/material/form-field';
26
- import { MatFormFieldModule } from '@angular/material/form-field';
27
- import * as i5$1 from '@angular/material/input';
28
- import { MatInputModule } from '@angular/material/input';
29
- import { MatProgressSpinner, MatProgressSpinnerModule } from '@angular/material/progress-spinner';
30
- import * as i5$2 from '@angular/material/icon';
31
- import { MatIconModule } from '@angular/material/icon';
32
- import * as i3$2 from '@azure/msal-angular';
33
- import { MsalBroadcastService, MSAL_GUARD_CONFIG, MSAL_INSTANCE, MsalService, MsalModule } from '@azure/msal-angular';
34
- import { PublicClientApplication, InteractionStatus, InteractionRequiredAuthError, WrapperSKU, EventMessageUtils, InteractionType } from '@azure/msal-browser';
35
15
  import { Md5 } from 'ts-md5';
36
- import { BaseStorage, StorageScope, StorageService } from '@igo2/core/storage';
37
16
  import { identifySentryUser, MONITORING_OPTIONS } from '@igo2/core/monitoring';
38
17
 
39
18
  class TokenService {
@@ -237,671 +216,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImpor
237
216
  type: Optional
238
217
  }] }] });
239
218
 
240
- class AuthFacebookComponent {
241
- authService;
242
- config;
243
- appRef;
244
- options;
245
- login = new EventEmitter();
246
- constructor(authService, config, appRef) {
247
- this.authService = authService;
248
- this.config = config;
249
- this.appRef = appRef;
250
- this.options = this.config.getConfig('auth.facebook');
251
- if (this.options?.appId) {
252
- this.loadSDKFacebook();
253
- }
254
- else {
255
- console.warn('Facebook authentification needs "appId" option');
256
- }
257
- }
258
- subscribeEvents() {
259
- window.FB.Event.subscribe('auth.statusChange', (rep) => {
260
- this.statusChangeCallback(rep);
261
- });
262
- }
263
- statusChangeCallback(response) {
264
- if (response.status === 'connected') {
265
- const accessToken = response.authResponse.accessToken;
266
- this.loginFacebook(accessToken);
267
- }
268
- }
269
- loginFacebook(token) {
270
- this.authService.loginWithToken(token, 'facebook').subscribe(() => {
271
- this.appRef.tick();
272
- this.login.emit(true);
273
- });
274
- }
275
- loadSDKFacebook() {
276
- if (document.getElementById('facebook-jssdk')) {
277
- return;
278
- }
279
- const urlSDK = 'https://connect.facebook.net/fr_CA/sdk.js#xfbml=1&version=v2.9';
280
- const fjs = document.getElementsByTagName('script')[0];
281
- const js = document.createElement('script');
282
- js.id = 'facebook-jssdk';
283
- js.src = `${urlSDK}&appId=${this.options?.appId}`;
284
- js.onload = () => {
285
- this.subscribeEvents();
286
- };
287
- fjs.parentNode.insertBefore(js, fjs);
288
- }
289
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthFacebookComponent, deps: [{ token: AuthService }, { token: i2.ConfigService }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Component });
290
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: AuthFacebookComponent, isStandalone: true, selector: "igo-auth-facebook", outputs: { login: "login" }, ngImport: i0, template: "<div\r\n scope=\"public_profile,email\"\r\n class=\"fb-login-button\"\r\n data-max-rows=\"1\"\r\n data-size=\"large\"\r\n data-button-type=\"login_with\"\r\n data-show-faces=\"false\"\r\n data-auto-logout-link=\"false\"\r\n data-use-continue-as=\"false\"\r\n></div>\r\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
291
- }
292
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthFacebookComponent, decorators: [{
293
- type: Component,
294
- args: [{ selector: 'igo-auth-facebook', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<div\r\n scope=\"public_profile,email\"\r\n class=\"fb-login-button\"\r\n data-max-rows=\"1\"\r\n data-size=\"large\"\r\n data-button-type=\"login_with\"\r\n data-show-faces=\"false\"\r\n data-auto-logout-link=\"false\"\r\n data-use-continue-as=\"false\"\r\n></div>\r\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}\n"] }]
295
- }], ctorParameters: () => [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }], propDecorators: { login: [{
296
- type: Output
297
- }] } });
298
-
299
- class AuthGoogleComponent {
300
- authService;
301
- config;
302
- languageService;
303
- appRef;
304
- options;
305
- login = new EventEmitter();
306
- constructor(authService, config, languageService, appRef) {
307
- this.authService = authService;
308
- this.config = config;
309
- this.languageService = languageService;
310
- this.appRef = appRef;
311
- this.options = this.config.getConfig('auth.google');
312
- if (this.options?.apiKey && this.options?.clientId) {
313
- this.loadSDKGoogle();
314
- this.loadPlatform();
315
- }
316
- else {
317
- console.warn('Google authentification needs "apiKey" and "clientId" options');
318
- }
319
- }
320
- handleSignInClick() {
321
- window.gapi.auth2.getAuthInstance().signIn();
322
- }
323
- handleSignOutClick() {
324
- window.gapi.auth2.getAuthInstance().signOut();
325
- }
326
- handleClientLoad() {
327
- window.gapi.load('client:auth2', () => this.initClient());
328
- }
329
- initClient() {
330
- window.gapi.client
331
- .init({
332
- apiKey: this.options?.apiKey,
333
- clientId: this.options?.clientId,
334
- discoveryDocs: [
335
- 'https://people.googleapis.com/$discovery/rest?version=v1'
336
- ],
337
- scope: 'profile'
338
- })
339
- .then(() => {
340
- this.handleSignOutClick();
341
- this.updateTextButton();
342
- window.gapi.auth2
343
- .getAuthInstance()
344
- .isSignedIn.listen((rep) => {
345
- this.updateSigninStatus(rep);
346
- });
347
- });
348
- }
349
- updateSigninStatus(isSignedIn) {
350
- this.updateTextButton();
351
- if (isSignedIn) {
352
- this.loginGoogle(window.gapi.client.getToken().access_token);
353
- }
354
- }
355
- updateTextButton() {
356
- const btn = document.querySelector('span[id^="not_signed_"]');
357
- if (btn && this.languageService.getLanguage() !== 'en') {
358
- if (btn.innerHTML === 'Sign in with Google') {
359
- btn.innerHTML = this.languageService.translate.instant('igo.auth.google.login');
360
- }
361
- else if (btn.innerHTML === 'Signed in with Google') {
362
- btn.innerHTML = this.languageService.translate.instant('igo.auth.google.logged');
363
- }
364
- }
365
- }
366
- loginGoogle(token) {
367
- this.authService.loginWithToken(token, 'google').subscribe(() => {
368
- this.appRef.tick();
369
- this.login.emit(true);
370
- });
371
- }
372
- loadSDKGoogle() {
373
- const fjs = document.getElementsByTagName('script')[0];
374
- const js = document.createElement('script');
375
- js.id = 'google-jssdk';
376
- js.src = 'https://apis.google.com/js/api.js';
377
- js.onload = () => {
378
- this.handleClientLoad();
379
- };
380
- fjs.parentNode.insertBefore(js, fjs);
381
- }
382
- loadPlatform() {
383
- const fjs = document.getElementsByTagName('script')[0];
384
- const js = document.createElement('script');
385
- js.id = 'google-platform';
386
- js.src = 'https://apis.google.com/js/platform.js';
387
- fjs.parentNode.insertBefore(js, fjs);
388
- }
389
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthGoogleComponent, deps: [{ token: AuthService }, { token: i2.ConfigService }, { token: i4.LanguageService }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Component });
390
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: AuthGoogleComponent, isStandalone: true, selector: "igo-auth-google", outputs: { login: "login" }, ngImport: i0, template: "<div\r\n class=\"g-signin2 google-login-button\"\r\n data-height=\"40\"\r\n data-width=\"265\"\r\n data-longtitle=\"true\"\r\n></div>\r\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block}.google-login-button ::ng-deep .abcRioButton{color:#000000de}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
391
- }
392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthGoogleComponent, decorators: [{
393
- type: Component,
394
- args: [{ selector: 'igo-auth-google', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<div\r\n class=\"g-signin2 google-login-button\"\r\n data-height=\"40\"\r\n data-width=\"265\"\r\n data-longtitle=\"true\"\r\n></div>\r\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block}.google-login-button ::ng-deep .abcRioButton{color:#000000de}\n"] }]
395
- }], ctorParameters: () => [{ type: AuthService }, { type: i2.ConfigService }, { type: i4.LanguageService }, { type: i0.ApplicationRef }], propDecorators: { login: [{
396
- type: Output
397
- }] } });
398
-
399
- class AuthInternComponent {
400
- auth;
401
- languageService;
402
- get allowAnonymous() {
403
- return this._allowAnonymous;
404
- }
405
- set allowAnonymous(value) {
406
- this._allowAnonymous = value;
407
- }
408
- _allowAnonymous = true;
409
- error = '';
410
- form;
411
- loading = false;
412
- login = new EventEmitter();
413
- constructor(auth, languageService, fb) {
414
- this.auth = auth;
415
- this.languageService = languageService;
416
- this.form = fb.group({
417
- username: ['', Validators.required],
418
- password: ['', Validators.required]
419
- });
420
- }
421
- loginUser(values) {
422
- this.loading = true;
423
- this.auth.login(values.username, values.password).subscribe(() => {
424
- this.login.emit(true);
425
- this.loading = false;
426
- }, (error) => {
427
- try {
428
- this.languageService.translate
429
- .get('igo.auth.error.' + error.error.message)
430
- .subscribe((errorMsg) => (this.error = errorMsg));
431
- }
432
- catch (e) {
433
- this.error = error.error.message;
434
- }
435
- this.loading = false;
436
- });
437
- return false;
438
- }
439
- loginAnonymous() {
440
- this.auth.loginAnonymous().subscribe(() => {
441
- this.login.emit(true);
442
- });
443
- }
444
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthInternComponent, deps: [{ token: AuthService }, { token: i4.LanguageService }, { token: i3$1.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component });
445
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: AuthInternComponent, isStandalone: true, selector: "igo-auth-intern", inputs: { allowAnonymous: "allowAnonymous" }, outputs: { login: "login" }, ngImport: i0, template: "<form [formGroup]=\"form\" role=\"form\" (ngSubmit)=\"loginUser(form.value)\">\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <mat-label>{{ 'igo.auth.user' | translate }}</mat-label>\r\n <input\r\n matInput\r\n required\r\n placeholder=\"{{ 'igo.auth.user' | translate }}\"\r\n formControlName=\"username\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <mat-label>{{ 'igo.auth.password' | translate }}</mat-label>\r\n <input\r\n matInput\r\n required\r\n type=\"password\"\r\n placeholder=\"{{ 'igo.auth.password' | translate }}\"\r\n formControlName=\"password\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n\r\n <button mat-raised-button type=\"submit\">\r\n {{ 'igo.auth.login' | translate }}\r\n </button>\r\n <button\r\n *ngIf=\"allowAnonymous\"\r\n mat-raised-button\r\n class=\"anonymous\"\r\n type=\"button\"\r\n (click)=\"loginAnonymous()\"\r\n >\r\n {{ 'igo.auth.accessAnonymous' | translate }}\r\n </button>\r\n <div *ngIf=\"error\">\r\n <br />\r\n <font size=\"3\" color=\"red\">{{ error }}</font>\r\n </div>\r\n</form>\r\n\r\n<div *ngIf=\"loading\" class=\"loading-container\">\r\n <mat-spinner [diameter]=\"40\"></mat-spinner>\r\n</div>\r\n", styles: [".full-width{width:100%}.anonymous{margin-left:10px}.loading-container{position:absolute;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:1000;top:0;left:0;padding:24px;box-sizing:border-box}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Default });
446
- }
447
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthInternComponent, decorators: [{
448
- type: Component,
449
- args: [{ selector: 'igo-auth-intern', changeDetection: ChangeDetectionStrategy.Default, standalone: true, imports: [
450
- FormsModule,
451
- ReactiveFormsModule,
452
- MatFormFieldModule,
453
- MatInputModule,
454
- MatButtonModule,
455
- MatProgressSpinner,
456
- NgIf,
457
- TranslateModule
458
- ], template: "<form [formGroup]=\"form\" role=\"form\" (ngSubmit)=\"loginUser(form.value)\">\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <mat-label>{{ 'igo.auth.user' | translate }}</mat-label>\r\n <input\r\n matInput\r\n required\r\n placeholder=\"{{ 'igo.auth.user' | translate }}\"\r\n formControlName=\"username\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <mat-label>{{ 'igo.auth.password' | translate }}</mat-label>\r\n <input\r\n matInput\r\n required\r\n type=\"password\"\r\n placeholder=\"{{ 'igo.auth.password' | translate }}\"\r\n formControlName=\"password\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n\r\n <button mat-raised-button type=\"submit\">\r\n {{ 'igo.auth.login' | translate }}\r\n </button>\r\n <button\r\n *ngIf=\"allowAnonymous\"\r\n mat-raised-button\r\n class=\"anonymous\"\r\n type=\"button\"\r\n (click)=\"loginAnonymous()\"\r\n >\r\n {{ 'igo.auth.accessAnonymous' | translate }}\r\n </button>\r\n <div *ngIf=\"error\">\r\n <br />\r\n <font size=\"3\" color=\"red\">{{ error }}</font>\r\n </div>\r\n</form>\r\n\r\n<div *ngIf=\"loading\" class=\"loading-container\">\r\n <mat-spinner [diameter]=\"40\"></mat-spinner>\r\n</div>\r\n", styles: [".full-width{width:100%}.anonymous{margin-left:10px}.loading-container{position:absolute;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:1000;top:0;left:0;padding:24px;box-sizing:border-box}\n"] }]
459
- }], ctorParameters: () => [{ type: AuthService }, { type: i4.LanguageService }, { type: i3$1.UntypedFormBuilder }], propDecorators: { allowAnonymous: [{
460
- type: Input
461
- }], login: [{
462
- type: Output
463
- }] } });
464
-
465
- class AuthMicrosoftComponent {
466
- authService;
467
- config;
468
- appRef;
469
- msalService;
470
- msalGuardConfig;
471
- options;
472
- _destroying$ = new Subject();
473
- login = new EventEmitter();
474
- broadcastService;
475
- constructor(authService, config, appRef, msalService, msalGuardConfig) {
476
- this.authService = authService;
477
- this.config = config;
478
- this.appRef = appRef;
479
- this.msalService = msalService;
480
- this.msalGuardConfig = msalGuardConfig;
481
- this.options = this.config.getConfig('auth.microsoft');
482
- this.msalService.instance = new PublicClientApplication({
483
- auth: this.options,
484
- cache: {
485
- cacheLocation: 'sessionStorage'
486
- }
487
- });
488
- this.broadcastService = new MsalBroadcastService(this.msalService.instance, this.msalService);
489
- if (this.options?.clientId) {
490
- this.broadcastService.inProgress$
491
- .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
492
- .subscribe(() => {
493
- this.checkAccount();
494
- });
495
- }
496
- else {
497
- console.warn('Microsoft authentification needs "clientId" option');
498
- }
499
- }
500
- loginMicrosoft() {
501
- this.msalService
502
- .loginPopup({ ...this.getConf().authRequest })
503
- .subscribe((response) => {
504
- this.msalService.instance.setActiveAccount(response.account);
505
- this.checkAccount();
506
- });
507
- }
508
- checkAccount() {
509
- this.msalService.instance
510
- .acquireTokenSilent(this.getConf().authRequest)
511
- .then((response) => {
512
- const tokenAccess = response.accessToken;
513
- const tokenId = response.idToken;
514
- this.authService
515
- .loginWithToken(tokenAccess, 'microsoft', { tokenId })
516
- .subscribe(() => {
517
- this.appRef.tick();
518
- this.login.emit(true);
519
- });
520
- })
521
- .catch(async (error) => {
522
- if (error instanceof InteractionRequiredAuthError) {
523
- // fallback to interaction when silent call fails
524
- return this.msalService.acquireTokenPopup(this.getConf().authRequest);
525
- }
526
- console.log(error);
527
- })
528
- .catch((error) => {
529
- console.log('Silent token fails');
530
- });
531
- }
532
- getConf() {
533
- return this.msalGuardConfig.filter((conf) => conf.type === 'add')[0];
534
- }
535
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthMicrosoftComponent, deps: [{ token: AuthService }, { token: i2.ConfigService }, { token: i0.ApplicationRef }, { token: i3$2.MsalService }, { token: MSAL_GUARD_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
536
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: AuthMicrosoftComponent, isStandalone: true, selector: "igo-auth-microsoft", outputs: { login: "login" }, ngImport: i0, template: "<button\r\n class=\"microsoft-login-button\"\r\n mat-raised-button\r\n (click)=\"loginMicrosoft()\"\r\n>\r\n <mat-icon svgIcon=\"microsoft\"></mat-icon>\r\n {{ 'igo.auth.microsoft.login' | translate }}\r\n</button>\r\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}:host>button{font-size:15px;height:40px;width:265px}mat-icon{margin-right:10px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
537
- }
538
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthMicrosoftComponent, decorators: [{
539
- type: Component,
540
- args: [{ selector: 'igo-auth-microsoft', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [MatButtonModule, MatIconModule, TranslateModule], template: "<button\r\n class=\"microsoft-login-button\"\r\n mat-raised-button\r\n (click)=\"loginMicrosoft()\"\r\n>\r\n <mat-icon svgIcon=\"microsoft\"></mat-icon>\r\n {{ 'igo.auth.microsoft.login' | translate }}\r\n</button>\r\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}:host>button{font-size:15px;height:40px;width:265px}mat-icon{margin-right:10px}\n"] }]
541
- }], ctorParameters: () => [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: i3$2.MsalService }, { type: undefined, decorators: [{
542
- type: Inject,
543
- args: [MSAL_GUARD_CONFIG]
544
- }] }], propDecorators: { login: [{
545
- type: Output
546
- }] } });
547
-
548
- /*
549
- * Copyright (c) Microsoft Corporation. All rights reserved.
550
- * Licensed under the MIT License.
551
- */
552
- class MsalServiceb2c {
553
- instance;
554
- location;
555
- redirectHash;
556
- logger;
557
- name = '@azure/msal-angular';
558
- version = '2.0.0-beta.2';
559
- constructor(instance, location) {
560
- this.instance = instance;
561
- this.location = location;
562
- const hash = this.location.path(true).split('#').pop();
563
- if (hash) {
564
- this.redirectHash = `#${hash}`;
565
- }
566
- this.instance.initializeWrapperLibrary(WrapperSKU.Angular, this.version);
567
- }
568
- initialize() {
569
- return from(this.instance.initialize());
570
- }
571
- acquireTokenPopup(request) {
572
- return from(this.instance.acquireTokenPopup(request));
573
- }
574
- acquireTokenRedirect(request) {
575
- return from(this.instance.acquireTokenRedirect(request));
576
- }
577
- acquireTokenSilent(silentRequest) {
578
- return from(this.instance.acquireTokenSilent(silentRequest));
579
- }
580
- handleRedirectObservable(hash) {
581
- return from(this.instance.handleRedirectPromise(hash || this.redirectHash));
582
- }
583
- loginPopup(request) {
584
- return from(this.instance.loginPopup(request));
585
- }
586
- loginRedirect(request) {
587
- return from(this.instance.loginRedirect(request));
588
- }
589
- logout(logoutRequest) {
590
- return from(this.instance.logout(logoutRequest));
591
- }
592
- logoutRedirect(logoutRequest) {
593
- return from(this.instance.logoutRedirect(logoutRequest));
594
- }
595
- logoutPopup(logoutRequest) {
596
- return from(this.instance.logoutPopup(logoutRequest));
597
- }
598
- ssoSilent(request) {
599
- return from(this.instance.ssoSilent(request));
600
- }
601
- /**
602
- * Gets logger for msal-angular.
603
- * If no logger set, returns logger instance created with same options as msal-browser
604
- */
605
- getLogger() {
606
- if (!this.logger) {
607
- this.logger = this.instance.getLogger().clone(this.name, this.version);
608
- }
609
- return this.logger;
610
- }
611
- // Create a logger instance for msal-angular with the same options as msal-browser
612
- setLogger(logger) {
613
- this.logger = logger.clone(this.name, this.version);
614
- this.instance.setLogger(logger);
615
- }
616
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: MsalServiceb2c, deps: [{ token: MSAL_INSTANCE }, { token: i1$1.Location }], target: i0.ɵɵFactoryTarget.Injectable });
617
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: MsalServiceb2c });
618
- }
619
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: MsalServiceb2c, decorators: [{
620
- type: Injectable
621
- }], ctorParameters: () => [{ type: undefined, decorators: [{
622
- type: Inject,
623
- args: [MSAL_INSTANCE]
624
- }] }, { type: i1$1.Location }] });
625
-
626
- /*
627
- * Copyright (c) Microsoft Corporation. All rights reserved.
628
- * Licensed under the MIT License.
629
- */
630
- class MsalBroadcastServiceb2c {
631
- msalInstance;
632
- authService;
633
- _msalSubject;
634
- msalSubject$;
635
- _inProgress;
636
- inProgress$;
637
- constructor(msalInstance, authService) {
638
- this.msalInstance = msalInstance;
639
- this.authService = authService;
640
- this._msalSubject = new Subject();
641
- this.msalSubject$ = this._msalSubject.asObservable();
642
- // InProgress as BehaviorSubject so most recent inProgress state will be available upon subscription
643
- this._inProgress = new BehaviorSubject(InteractionStatus.Startup);
644
- this.inProgress$ = this._inProgress.asObservable();
645
- this.msalInstance.addEventCallback((message) => {
646
- this._msalSubject.next(message);
647
- const status = EventMessageUtils.getInteractionStatusFromEvent(message);
648
- if (status !== null) {
649
- this.authService
650
- .getLogger()
651
- .verbose(`BroadcastService - ${message.eventType} results in setting inProgress to ${status}`);
652
- this._inProgress.next(status);
653
- }
654
- });
655
- }
656
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: MsalBroadcastServiceb2c, deps: [{ token: MSAL_INSTANCE }, { token: MsalServiceb2c }], target: i0.ɵɵFactoryTarget.Injectable });
657
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: MsalBroadcastServiceb2c });
658
- }
659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: MsalBroadcastServiceb2c, decorators: [{
660
- type: Injectable
661
- }], ctorParameters: () => [{ type: undefined, decorators: [{
662
- type: Inject,
663
- args: [MSAL_INSTANCE]
664
- }] }, { type: MsalServiceb2c }] });
665
-
666
- class AuthMicrosoftb2cComponent {
667
- authService;
668
- config;
669
- appRef;
670
- msalService;
671
- msalGuardConfig;
672
- options;
673
- _destroying$ = new Subject();
674
- login = new EventEmitter();
675
- broadcastService;
676
- constructor(authService, config, appRef, msalService, msalGuardConfig) {
677
- this.authService = authService;
678
- this.config = config;
679
- this.appRef = appRef;
680
- this.msalService = msalService;
681
- this.msalGuardConfig = msalGuardConfig;
682
- this.options = this.config.getConfig('auth.microsoftb2c') || {};
683
- this.msalService.instance = new PublicClientApplication({
684
- auth: this.options.browserAuthOptions,
685
- cache: {
686
- cacheLocation: 'sessionStorage'
687
- }
688
- });
689
- this.broadcastService = new MsalBroadcastServiceb2c(this.msalService.instance, this.msalService);
690
- if (this.options.browserAuthOptions.clientId) {
691
- this.broadcastService.inProgress$
692
- .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
693
- .subscribe(() => {
694
- this.checkAccount();
695
- });
696
- }
697
- else {
698
- console.warn('Microsoft authentification needs "clientId" option');
699
- }
700
- }
701
- loginMicrosoftb2c() {
702
- this.msalService
703
- .loginPopup({ ...this.getConf().authRequest })
704
- .subscribe((response) => {
705
- this.msalService.instance.setActiveAccount(response.account);
706
- this.checkAccount();
707
- });
708
- }
709
- checkAccount() {
710
- this.msalService.instance
711
- .acquireTokenSilent(this.getConf().authRequest)
712
- .then((response) => {
713
- const token = response.idToken;
714
- this.authService.loginWithToken(token, 'microsoftb2c').subscribe(() => {
715
- this.appRef.tick();
716
- this.login.emit(true);
717
- });
718
- })
719
- .catch(async (error) => {
720
- if (error instanceof InteractionRequiredAuthError) {
721
- // fallback to interaction when silent call fails
722
- return this.msalService.acquireTokenPopup(this.getConf().authRequest);
723
- }
724
- })
725
- .catch((error) => {
726
- console.log('Silent token fails');
727
- });
728
- }
729
- getConf() {
730
- return this.msalGuardConfig.filter((conf) => conf.type === 'b2c')[0];
731
- }
732
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthMicrosoftb2cComponent, deps: [{ token: AuthService }, { token: i2.ConfigService }, { token: i0.ApplicationRef }, { token: MsalServiceb2c }, { token: MSAL_GUARD_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
733
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: AuthMicrosoftb2cComponent, isStandalone: true, selector: "igo-auth-microsoftb2c", outputs: { login: "login" }, ngImport: i0, template: "<button\r\n class=\"microsoft-login-button\"\r\n mat-raised-button\r\n (click)=\"loginMicrosoftb2c()\"\r\n>\r\n <mat-icon svgIcon=\"microsoft\"></mat-icon>\r\n {{ 'igo.auth.microsoftb2c.login' | translate }}\r\n</button>\r\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}:host>button{font-size:15px;height:40px;width:265px}mat-icon{margin-right:10px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
734
- }
735
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthMicrosoftb2cComponent, decorators: [{
736
- type: Component,
737
- args: [{ selector: 'igo-auth-microsoftb2c', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [MatButtonModule, MatIconModule, TranslateModule], template: "<button\r\n class=\"microsoft-login-button\"\r\n mat-raised-button\r\n (click)=\"loginMicrosoftb2c()\"\r\n>\r\n <mat-icon svgIcon=\"microsoft\"></mat-icon>\r\n {{ 'igo.auth.microsoftb2c.login' | translate }}\r\n</button>\r\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}:host>button{font-size:15px;height:40px;width:265px}mat-icon{margin-right:10px}\n"] }]
738
- }], ctorParameters: () => [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: MsalServiceb2c }, { type: undefined, decorators: [{
739
- type: Inject,
740
- args: [MSAL_GUARD_CONFIG]
741
- }] }], propDecorators: { login: [{
742
- type: Output
743
- }] } });
744
-
745
- class AuthFormComponent {
746
- auth;
747
- config;
748
- router;
749
- get backgroundDisable() {
750
- if (this.isLogoutRoute || this.isLogoutRoute) {
751
- return false;
752
- }
753
- return this._backgroundDisable;
754
- }
755
- set backgroundDisable(value) {
756
- this._backgroundDisable = value.toString() === 'true';
757
- }
758
- _backgroundDisable = true;
759
- get hasAlreadyConnectedDiv() {
760
- return this._hasAlreadyConnectedDiv;
761
- }
762
- set hasAlreadyConnectedDiv(value) {
763
- this._hasAlreadyConnectedDiv = value.toString() === 'true';
764
- }
765
- _hasAlreadyConnectedDiv = true;
766
- get hasLogoutDiv() {
767
- return this._hasLogoutDiv;
768
- }
769
- set hasLogoutDiv(value) {
770
- this._hasLogoutDiv = value.toString() === 'true';
771
- }
772
- _hasLogoutDiv = true;
773
- get showAlreadyConnectedDiv() {
774
- if (this.isLogoutRoute) {
775
- return this.hasAlreadyConnectedDiv;
776
- }
777
- return this._showAlreadyConnectedDiv;
778
- }
779
- set showAlreadyConnectedDiv(value) {
780
- this._showAlreadyConnectedDiv = value.toString() === 'true';
781
- }
782
- _showAlreadyConnectedDiv = false;
783
- get showLogoutDiv() {
784
- if (this.isLogoutRoute) {
785
- return this.hasLogoutDiv;
786
- }
787
- return this._showLogoutDiv;
788
- }
789
- set showLogoutDiv(value) {
790
- this._showLogoutDiv = value.toString() === 'true';
791
- }
792
- _showLogoutDiv = false;
793
- get showLoginDiv() {
794
- if (!this.isLogoutRoute) {
795
- return true;
796
- }
797
- }
798
- login = new EventEmitter();
799
- options;
800
- user;
801
- visible = true;
802
- isLoginRoute;
803
- isLogoutRoute;
804
- constructor(auth, config, router) {
805
- this.auth = auth;
806
- this.config = config;
807
- this.router = router;
808
- this.options = this.config.getConfig('auth');
809
- this.visible = Object.getOwnPropertyNames(this.options).length !== 0;
810
- }
811
- ngOnInit() {
812
- this.analyzeRoute();
813
- this.getName();
814
- }
815
- onLogin() {
816
- this.auth.goToRedirectUrl();
817
- this.getName();
818
- this.login.emit(true);
819
- }
820
- logout() {
821
- this.auth.logout().subscribe(() => {
822
- this.user = undefined;
823
- if (this.router) {
824
- if (this.options?.logoutRoute) {
825
- this.router.navigate([this.options?.logoutRoute]);
826
- }
827
- else if (this.options?.homeRoute) {
828
- this.router.navigate([this.options?.homeRoute]);
829
- }
830
- }
831
- });
832
- }
833
- home() {
834
- if (this.router && this.options?.homeRoute) {
835
- this.router.navigate([this.options?.homeRoute]);
836
- }
837
- }
838
- getName() {
839
- const tokenDecoded = this.auth.decodeToken();
840
- if (tokenDecoded) {
841
- this.user = {
842
- name: tokenDecoded.user.firstName || tokenDecoded.user.sourceId
843
- };
844
- }
845
- }
846
- analyzeRoute() {
847
- if (!this.router) {
848
- return;
849
- }
850
- this.router.events
851
- .pipe(filter((event) => event instanceof NavigationStart))
852
- .subscribe((changeEvent) => {
853
- if (changeEvent.url) {
854
- const currentRoute = changeEvent.url;
855
- const logoutRoute = this.options?.logoutRoute;
856
- const loginRoute = this.options?.loginRoute;
857
- this.isLogoutRoute = currentRoute === logoutRoute;
858
- this.isLoginRoute = currentRoute === loginRoute;
859
- if (this.isLogoutRoute) {
860
- this.auth.logout();
861
- }
862
- }
863
- });
864
- }
865
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthFormComponent, deps: [{ token: AuthService }, { token: i2.ConfigService }, { token: i3.Router, optional: true }], target: i0.ɵɵFactoryTarget.Component });
866
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: AuthFormComponent, isStandalone: true, selector: "igo-auth-form", inputs: { backgroundDisable: "backgroundDisable", hasAlreadyConnectedDiv: "hasAlreadyConnectedDiv", hasLogoutDiv: "hasLogoutDiv", showAlreadyConnectedDiv: "showAlreadyConnectedDiv", showLogoutDiv: "showLogoutDiv" }, outputs: { login: "login" }, ngImport: i0, template: "<div *ngIf=\"visible\">\r\n <div\r\n *ngIf=\"!auth.logged && backgroundDisable\"\r\n class=\"backgroundDisable\"\r\n ></div>\r\n\r\n <div *ngIf=\"!auth.logged && showLoginDiv\" class=\"login center-block\">\r\n <h1>{{ 'igo.auth.connection' | translate }}</h1>\r\n\r\n <igo-auth-google\r\n *ngIf=\"options.google && options.google.enabled !== false\"\r\n (login)=\"onLogin()\"\r\n >\r\n </igo-auth-google>\r\n <igo-auth-microsoft\r\n *ngIf=\"options.microsoft && options.microsoft.enabled !== false\"\r\n (login)=\"onLogin()\"\r\n >\r\n </igo-auth-microsoft>\r\n <igo-auth-microsoftb2c\r\n *ngIf=\"options.microsoftb2c && options.microsoftb2c.enabled !== false\"\r\n (login)=\"onLogin()\"\r\n >\r\n </igo-auth-microsoftb2c>\r\n <igo-auth-facebook\r\n *ngIf=\"options.facebook && options.facebook.enabled !== false\"\r\n (login)=\"onLogin()\"\r\n >\r\n </igo-auth-facebook>\r\n <igo-auth-intern\r\n *ngIf=\"!options.intern || options.intern.enabled !== false\"\r\n [allowAnonymous]=\"options.allowAnonymous\"\r\n (login)=\"onLogin()\"\r\n >\r\n </igo-auth-intern>\r\n </div>\r\n\r\n <div\r\n *ngIf=\"auth.logged && showAlreadyConnectedDiv\"\r\n class=\"login center-block\"\r\n >\r\n <p>{{ 'igo.auth.welcome' | translate: user }}</p>\r\n <button mat-raised-button type=\"button\" (click)=\"logout()\">\r\n {{ 'igo.auth.signOut' | translate }}\r\n </button>\r\n </div>\r\n\r\n <div *ngIf=\"showLogoutDiv\" class=\"login center-block\">\r\n <p>{{ 'igo.auth.deconnection' | translate }}</p>\r\n <button\r\n *ngIf=\"options.homeRoute\"\r\n mat-raised-button\r\n type=\"button\"\r\n (click)=\"home()\"\r\n >\r\n {{ 'igo.auth.home' | translate }}\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [":host{z-index:999}div.login{z-index:200;width:90%;min-width:360px;max-width:600px;padding:25px 50px;border:1px solid;background-color:#fff;border-color:#888}.center-block{position:fixed;top:20%;left:50%;transform:translate(-50%)}.backgroundDisable{position:fixed;top:0;left:0;background:#000;opacity:.8;z-index:100;height:100%;width:100%}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: AuthGoogleComponent, selector: "igo-auth-google", outputs: ["login"] }, { kind: "component", type: AuthMicrosoftComponent, selector: "igo-auth-microsoft", outputs: ["login"] }, { kind: "component", type: AuthMicrosoftb2cComponent, selector: "igo-auth-microsoftb2c", outputs: ["login"] }, { kind: "component", type: AuthFacebookComponent, selector: "igo-auth-facebook", outputs: ["login"] }, { kind: "component", type: AuthInternComponent, selector: "igo-auth-intern", inputs: ["allowAnonymous"], outputs: ["login"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Default });
867
- }
868
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthFormComponent, decorators: [{
869
- type: Component,
870
- args: [{ selector: 'igo-auth-form', changeDetection: ChangeDetectionStrategy.Default, standalone: true, imports: [
871
- NgIf,
872
- AuthGoogleComponent,
873
- AuthMicrosoftComponent,
874
- AuthMicrosoftb2cComponent,
875
- AuthFacebookComponent,
876
- AuthInternComponent,
877
- MatButtonModule,
878
- TranslateModule
879
- ], template: "<div *ngIf=\"visible\">\r\n <div\r\n *ngIf=\"!auth.logged && backgroundDisable\"\r\n class=\"backgroundDisable\"\r\n ></div>\r\n\r\n <div *ngIf=\"!auth.logged && showLoginDiv\" class=\"login center-block\">\r\n <h1>{{ 'igo.auth.connection' | translate }}</h1>\r\n\r\n <igo-auth-google\r\n *ngIf=\"options.google && options.google.enabled !== false\"\r\n (login)=\"onLogin()\"\r\n >\r\n </igo-auth-google>\r\n <igo-auth-microsoft\r\n *ngIf=\"options.microsoft && options.microsoft.enabled !== false\"\r\n (login)=\"onLogin()\"\r\n >\r\n </igo-auth-microsoft>\r\n <igo-auth-microsoftb2c\r\n *ngIf=\"options.microsoftb2c && options.microsoftb2c.enabled !== false\"\r\n (login)=\"onLogin()\"\r\n >\r\n </igo-auth-microsoftb2c>\r\n <igo-auth-facebook\r\n *ngIf=\"options.facebook && options.facebook.enabled !== false\"\r\n (login)=\"onLogin()\"\r\n >\r\n </igo-auth-facebook>\r\n <igo-auth-intern\r\n *ngIf=\"!options.intern || options.intern.enabled !== false\"\r\n [allowAnonymous]=\"options.allowAnonymous\"\r\n (login)=\"onLogin()\"\r\n >\r\n </igo-auth-intern>\r\n </div>\r\n\r\n <div\r\n *ngIf=\"auth.logged && showAlreadyConnectedDiv\"\r\n class=\"login center-block\"\r\n >\r\n <p>{{ 'igo.auth.welcome' | translate: user }}</p>\r\n <button mat-raised-button type=\"button\" (click)=\"logout()\">\r\n {{ 'igo.auth.signOut' | translate }}\r\n </button>\r\n </div>\r\n\r\n <div *ngIf=\"showLogoutDiv\" class=\"login center-block\">\r\n <p>{{ 'igo.auth.deconnection' | translate }}</p>\r\n <button\r\n *ngIf=\"options.homeRoute\"\r\n mat-raised-button\r\n type=\"button\"\r\n (click)=\"home()\"\r\n >\r\n {{ 'igo.auth.home' | translate }}\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [":host{z-index:999}div.login{z-index:200;width:90%;min-width:360px;max-width:600px;padding:25px 50px;border:1px solid;background-color:#fff;border-color:#888}.center-block{position:fixed;top:20%;left:50%;transform:translate(-50%)}.backgroundDisable{position:fixed;top:0;left:0;background:#000;opacity:.8;z-index:100;height:100%;width:100%}\n"] }]
880
- }], ctorParameters: () => [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router, decorators: [{
881
- type: Optional
882
- }] }], propDecorators: { backgroundDisable: [{
883
- type: Input
884
- }], hasAlreadyConnectedDiv: [{
885
- type: Input
886
- }], hasLogoutDiv: [{
887
- type: Input
888
- }], showAlreadyConnectedDiv: [{
889
- type: Input
890
- }], showLogoutDiv: [{
891
- type: Input
892
- }], login: [{
893
- type: Output
894
- }] } });
895
-
896
- const AUTH_FORM_DIRECTIVES = [
897
- AuthFormComponent,
898
- AuthGoogleComponent,
899
- AuthInternComponent,
900
- AuthFacebookComponent,
901
- AuthMicrosoftComponent,
902
- AuthMicrosoftb2cComponent
903
- ];
904
-
905
219
  class LoggedGuard {
906
220
  authService;
907
221
  config;
@@ -1179,194 +493,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImpor
1179
493
  }]
1180
494
  }], ctorParameters: () => [{ type: i2.ConfigService }, { type: TokenService }, { type: i1.HttpClient }] });
1181
495
 
1182
- function MSALConfigFactory(config) {
1183
- const msConf = config.getConfig('auth.microsoft');
1184
- msConf.redirectUri = msConf?.redirectUri || window.location.href;
1185
- msConf.authority =
1186
- msConf?.authority || 'https://login.microsoftonline.com/organizations';
1187
- const myMsalObj = new PublicClientApplication({
1188
- auth: msConf,
1189
- cache: {
1190
- cacheLocation: 'sessionStorage'
1191
- }
1192
- });
1193
- return myMsalObj;
1194
- }
1195
- function MSALConfigFactoryb2c(config) {
1196
- const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions');
1197
- msConf.redirectUri = msConf?.redirectUri || window.location.href;
1198
- msConf.authority =
1199
- msConf?.authority || 'https://login.microsoftonline.com/organizations';
1200
- const myMsalObj = new PublicClientApplication({
1201
- auth: msConf,
1202
- cache: {
1203
- cacheLocation: 'sessionStorage'
1204
- }
1205
- });
1206
- return myMsalObj;
1207
- }
1208
- function MSALAngularConfigFactory(config) {
1209
- const msConf = config.getConfig('auth.microsoft');
1210
- return {
1211
- interactionType: InteractionType.Popup,
1212
- authRequest: {
1213
- scopes: ['user.read'],
1214
- loginHint: 'todo'
1215
- },
1216
- type: 'add'
1217
- };
1218
- }
1219
- function MSALAngularConfigFactoryb2c(config) {
1220
- const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions');
1221
- return {
1222
- interactionType: InteractionType.Popup,
1223
- authRequest: {
1224
- scopes: [msConf?.clientId]
1225
- },
1226
- type: 'b2c'
1227
- };
1228
- }
1229
- function provideAuthMicrosoft(type) {
1230
- if (type === 'b2c') {
1231
- return [
1232
- {
1233
- provide: MSAL_INSTANCE,
1234
- useFactory: MSALConfigFactoryb2c,
1235
- deps: [ConfigService]
1236
- },
1237
- {
1238
- provide: MSAL_GUARD_CONFIG,
1239
- useFactory: MSALAngularConfigFactoryb2c,
1240
- deps: [ConfigService],
1241
- multi: true
1242
- },
1243
- MsalServiceb2c
1244
- ];
1245
- }
1246
- else {
1247
- return [
1248
- {
1249
- provide: MSAL_INSTANCE,
1250
- useFactory: MSALConfigFactory,
1251
- deps: [ConfigService]
1252
- },
1253
- {
1254
- provide: MSAL_GUARD_CONFIG,
1255
- useFactory: MSALAngularConfigFactory,
1256
- deps: [ConfigService],
1257
- multi: true
1258
- },
1259
- MsalService
1260
- ];
1261
- }
1262
- }
1263
-
1264
- class ProtectedDirective {
1265
- constructor(authentication, el) {
1266
- if (!authentication.isAuthenticated()) {
1267
- el.nativeElement.parentNode.removeChild(el.nativeElement);
1268
- }
1269
- }
1270
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ProtectedDirective, deps: [{ token: AuthService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1271
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.4", type: ProtectedDirective, isStandalone: true, selector: "[igoProtected]", ngImport: i0 });
1272
- }
1273
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ProtectedDirective, decorators: [{
1274
- type: Directive,
1275
- args: [{
1276
- selector: '[igoProtected]',
1277
- standalone: true
1278
- }]
1279
- }], ctorParameters: () => [{ type: AuthService }, { type: i0.ElementRef }] });
1280
-
1281
- class AuthStorageService extends BaseStorage {
1282
- http;
1283
- authService;
1284
- tokenService;
1285
- constructor(config, http, authService, tokenService) {
1286
- super(config);
1287
- this.http = http;
1288
- this.authService = authService;
1289
- this.tokenService = tokenService;
1290
- this.authService.authenticate$.subscribe((isAuthenticated) => {
1291
- if (isAuthenticated && this.options.url) {
1292
- this.http
1293
- .get(this.options.url)
1294
- .subscribe((userIgo) => {
1295
- if (userIgo && userIgo.preference) {
1296
- for (const key of Object.keys(userIgo.preference)) {
1297
- const value = userIgo.preference[key];
1298
- super.set(key, value);
1299
- }
1300
- }
1301
- });
1302
- }
1303
- });
1304
- }
1305
- set(key, value, scope = StorageScope.LOCAL) {
1306
- if (scope === StorageScope.LOCAL &&
1307
- this.authService.authenticated &&
1308
- this.options.url) {
1309
- const preference = {};
1310
- preference[key] = value;
1311
- this.http.patch(this.options.url, { preference }).subscribe();
1312
- }
1313
- super.set(key, value, scope);
1314
- }
1315
- remove(key, scope = StorageScope.LOCAL) {
1316
- if (scope === StorageScope.LOCAL &&
1317
- this.authService.authenticated &&
1318
- this.options.url) {
1319
- const preference = {};
1320
- preference[key] = undefined;
1321
- this.http.patch(this.options.url, { preference }).subscribe();
1322
- }
1323
- super.remove(key, scope);
1324
- }
1325
- clear(scope = StorageScope.LOCAL) {
1326
- if (scope === StorageScope.LOCAL &&
1327
- this.authService.authenticated &&
1328
- this.options.url) {
1329
- this.http
1330
- .patch(this.options.url, { preference: {} }, {
1331
- params: {
1332
- mergePreference: 'false'
1333
- }
1334
- })
1335
- .subscribe();
1336
- }
1337
- let token;
1338
- if (scope === StorageScope.LOCAL) {
1339
- token = this.tokenService.get();
1340
- }
1341
- super.clear(scope);
1342
- if (token) {
1343
- this.tokenService.set(token);
1344
- }
1345
- if (scope === StorageScope.LOCAL &&
1346
- this.authService.authenticated &&
1347
- this.options.url) {
1348
- this.http
1349
- .get(this.options.url)
1350
- .subscribe((userIgo) => {
1351
- if (userIgo && userIgo.preference) {
1352
- for (const key of Object.keys(userIgo.preference)) {
1353
- const value = userIgo.preference[key];
1354
- super.set(key, value);
1355
- }
1356
- }
1357
- });
1358
- }
1359
- }
1360
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthStorageService, deps: [{ token: i2.ConfigService }, { token: i1.HttpClient }, { token: AuthService }, { token: TokenService }], target: i0.ɵɵFactoryTarget.Injectable });
1361
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthStorageService, providedIn: 'root' });
1362
- }
1363
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AuthStorageService, decorators: [{
1364
- type: Injectable,
1365
- args: [{
1366
- providedIn: 'root'
1367
- }]
1368
- }], ctorParameters: () => [{ type: i2.ConfigService }, { type: i1.HttpClient }, { type: AuthService }, { type: TokenService }] });
1369
-
1370
496
  class AuthMonitoringService {
1371
497
  configService;
1372
498
  monitoringOptions;
@@ -1434,81 +560,6 @@ function provideAuthUserMonitoring(options) {
1434
560
  ];
1435
561
  }
1436
562
 
1437
- class IgoAuthModule {
1438
- static forRoot() {
1439
- return {
1440
- ngModule: IgoAuthModule,
1441
- providers: [
1442
- {
1443
- provide: HTTP_INTERCEPTORS,
1444
- useClass: AuthInterceptor,
1445
- multi: true
1446
- },
1447
- {
1448
- provide: StorageService,
1449
- useClass: AuthStorageService
1450
- },
1451
- ...provideAuthMicrosoft('add'),
1452
- ...provideAuthMicrosoft('b2c')
1453
- ]
1454
- };
1455
- }
1456
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: IgoAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1457
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.4", ngImport: i0, type: IgoAuthModule, imports: [CommonModule,
1458
- ReactiveFormsModule,
1459
- MatFormFieldModule,
1460
- MatInputModule,
1461
- MatIconModule,
1462
- MatProgressSpinnerModule,
1463
- MatButtonModule,
1464
- IgoLanguageModule,
1465
- MsalModule,
1466
- AuthFormComponent,
1467
- AuthGoogleComponent,
1468
- AuthInternComponent,
1469
- AuthFacebookComponent,
1470
- AuthMicrosoftComponent,
1471
- AuthMicrosoftb2cComponent,
1472
- ProtectedDirective], exports: [AuthFormComponent, ProtectedDirective] });
1473
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: IgoAuthModule, imports: [CommonModule,
1474
- ReactiveFormsModule,
1475
- MatFormFieldModule,
1476
- MatInputModule,
1477
- MatIconModule,
1478
- MatProgressSpinnerModule,
1479
- MatButtonModule,
1480
- IgoLanguageModule,
1481
- MsalModule,
1482
- AuthFormComponent,
1483
- AuthInternComponent,
1484
- AuthMicrosoftComponent,
1485
- AuthMicrosoftb2cComponent] });
1486
- }
1487
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: IgoAuthModule, decorators: [{
1488
- type: NgModule,
1489
- args: [{
1490
- imports: [
1491
- CommonModule,
1492
- ReactiveFormsModule,
1493
- MatFormFieldModule,
1494
- MatInputModule,
1495
- MatIconModule,
1496
- MatProgressSpinnerModule,
1497
- MatButtonModule,
1498
- IgoLanguageModule,
1499
- MsalModule,
1500
- AuthFormComponent,
1501
- AuthGoogleComponent,
1502
- AuthInternComponent,
1503
- AuthFacebookComponent,
1504
- AuthMicrosoftComponent,
1505
- AuthMicrosoftb2cComponent,
1506
- ProtectedDirective
1507
- ],
1508
- exports: [AuthFormComponent, ProtectedDirective]
1509
- }]
1510
- }] });
1511
-
1512
563
  /*
1513
564
  * Public API Surface of auth
1514
565
  */
@@ -1517,5 +568,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImpor
1517
568
  * Generated bundle index. Do not edit.
1518
569
  */
1519
570
 
1520
- export { AdminGuard, AuthFormComponent, AuthGuard, AuthInterceptor, AuthMonitoringService, AuthService, AuthStorageService, IgoAuthModule, LoggedGuard, MSALAngularConfigFactory, MSALAngularConfigFactoryb2c, MSALConfigFactory, MSALConfigFactoryb2c, ProfilsGuard, ProtectedDirective, TokenService, provideAuthMicrosoft, provideAuthUserMonitoring };
571
+ export { AdminGuard, AuthGuard, AuthInterceptor, AuthMonitoringService, AuthService, LoggedGuard, ProfilsGuard, TokenService, provideAuthUserMonitoring };
1521
572
  //# sourceMappingURL=igo2-auth.mjs.map