@igo2/auth 17.0.0-next.0 → 17.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.
Files changed (138) 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 +73 -0
  13. package/esm2022/form/igo2-auth-form.mjs +5 -0
  14. package/esm2022/form/public_api.mjs +7 -0
  15. package/esm2022/form/shared/auth-form.interface.mjs +2 -0
  16. package/esm2022/form/shared/index.mjs +2 -0
  17. package/esm2022/google/auth-google/auth-google.component.mjs +108 -0
  18. package/esm2022/google/igo2-auth-google.mjs +5 -0
  19. package/esm2022/google/public_api.mjs +3 -0
  20. package/esm2022/google/shared/auth-google.interface.mjs +2 -0
  21. package/esm2022/google/shared/index.mjs +2 -0
  22. package/esm2022/internal/auth-intern/auth-intern.component.mjs +84 -0
  23. package/esm2022/internal/igo2-auth-internal.mjs +5 -0
  24. package/esm2022/internal/public_api.mjs +2 -0
  25. package/esm2022/lib/auth.provider.mjs +22 -0
  26. package/esm2022/lib/shared/admin.guard.mjs +6 -6
  27. package/esm2022/lib/shared/auth-storage.interface.mjs +1 -1
  28. package/esm2022/lib/shared/auth-storage.service.mjs +7 -6
  29. package/esm2022/lib/shared/auth.guard.mjs +6 -6
  30. package/esm2022/lib/shared/auth.interceptor.mjs +6 -6
  31. package/esm2022/lib/shared/auth.interface.mjs +5 -2
  32. package/esm2022/lib/shared/auth.service.mjs +12 -8
  33. package/esm2022/lib/shared/index.mjs +3 -5
  34. package/esm2022/lib/shared/logged.guard.mjs +6 -6
  35. package/esm2022/lib/shared/profils.guard.mjs +6 -6
  36. package/esm2022/lib/shared/token.service.mjs +5 -5
  37. package/esm2022/microsoft/auth-microsoft/auth-microsoft.component.mjs +100 -0
  38. package/esm2022/microsoft/auth-microsoft.provider.mjs +105 -0
  39. package/esm2022/microsoft/auth-microsoftb2c/auth-microsoftb2c.component.mjs +98 -0
  40. package/esm2022/microsoft/auth-microsoftb2c/auth-msalBroadcastServiceb2c.service.mjs +47 -0
  41. package/esm2022/microsoft/auth-microsoftb2c/auth-msalServiceb2c.service.mjs +85 -0
  42. package/esm2022/microsoft/igo2-auth-microsoft.mjs +5 -0
  43. package/esm2022/microsoft/public_api.mjs +5 -0
  44. package/esm2022/microsoft/shared/auth-microsoft.interface.mjs +2 -0
  45. package/esm2022/microsoft/shared/index.mjs +2 -0
  46. package/esm2022/monitoring/auth-monitoring/auth-monitoring.provider.mjs +24 -0
  47. package/esm2022/monitoring/auth-monitoring/auth-monitoring.service.mjs +54 -0
  48. package/esm2022/monitoring/igo2-auth-monitoring.mjs +5 -0
  49. package/esm2022/monitoring/public_api.mjs +3 -0
  50. package/esm2022/public_api.mjs +3 -19
  51. package/{lib/auth-form → facebook/auth-facebook}/auth-facebook.component.d.ts +2 -2
  52. package/facebook/index.d.ts +5 -0
  53. package/facebook/public_api.d.ts +2 -0
  54. package/facebook/shared/auth-facebook.interface.d.ts +4 -0
  55. package/facebook/shared/index.d.ts +1 -0
  56. package/fesm2022/igo2-auth-environment.mjs +4 -0
  57. package/fesm2022/igo2-auth-environment.mjs.map +1 -0
  58. package/fesm2022/igo2-auth-facebook.mjs +70 -0
  59. package/fesm2022/igo2-auth-facebook.mjs.map +1 -0
  60. package/fesm2022/igo2-auth-form.mjs +238 -0
  61. package/fesm2022/igo2-auth-form.mjs.map +1 -0
  62. package/fesm2022/igo2-auth-google.mjs +112 -0
  63. package/fesm2022/igo2-auth-google.mjs.map +1 -0
  64. package/fesm2022/igo2-auth-internal.mjs +89 -0
  65. package/fesm2022/igo2-auth-internal.mjs.map +1 -0
  66. package/fesm2022/igo2-auth-microsoft.mjs +404 -0
  67. package/fesm2022/igo2-auth-microsoft.mjs.map +1 -0
  68. package/fesm2022/igo2-auth-monitoring.mjs +81 -0
  69. package/fesm2022/igo2-auth-monitoring.mjs.map +1 -0
  70. package/fesm2022/igo2-auth.mjs +244 -1143
  71. package/fesm2022/igo2-auth.mjs.map +1 -1
  72. package/{lib → form}/auth-form/auth-form.component.d.ts +4 -5
  73. package/form/auth-form.module.d.ts +20 -0
  74. package/form/index.d.ts +5 -0
  75. package/form/public_api.d.ts +3 -0
  76. package/form/shared/auth-form.interface.d.ts +9 -0
  77. package/form/shared/index.d.ts +1 -0
  78. package/{src/lib → form/src}/auth-form/auth-intern.theme.scss +19 -19
  79. package/form/src/auth-form.theme.scss +9 -0
  80. package/{lib/auth-form → google/auth-google}/auth-google.component.d.ts +3 -2
  81. package/google/index.d.ts +5 -0
  82. package/google/public_api.d.ts +2 -0
  83. package/google/shared/auth-google.interface.d.ts +5 -0
  84. package/google/shared/index.d.ts +1 -0
  85. package/{lib/auth-form → internal/auth-intern}/auth-intern.component.d.ts +2 -2
  86. package/internal/index.d.ts +5 -0
  87. package/internal/public_api.d.ts +1 -0
  88. package/lib/auth.provider.d.ts +3 -0
  89. package/lib/shared/admin.guard.d.ts +1 -1
  90. package/lib/shared/auth-storage.interface.d.ts +1 -1
  91. package/lib/shared/auth-storage.service.d.ts +2 -1
  92. package/lib/shared/auth.guard.d.ts +1 -1
  93. package/lib/shared/auth.interceptor.d.ts +1 -1
  94. package/lib/shared/auth.interface.d.ts +21 -70
  95. package/lib/shared/auth.service.d.ts +3 -1
  96. package/lib/shared/index.d.ts +2 -4
  97. package/lib/shared/logged.guard.d.ts +1 -1
  98. package/lib/shared/profils.guard.d.ts +1 -1
  99. package/locale/en.auth.json +29 -29
  100. package/locale/fr.auth.json +33 -33
  101. package/{lib/auth-form → microsoft/auth-microsoft}/auth-microsoft.component.d.ts +5 -3
  102. package/microsoft/auth-microsoft.provider.d.ts +12 -0
  103. package/{lib/auth-form → microsoft/auth-microsoftb2c}/auth-microsoftb2c.component.d.ts +6 -4
  104. package/{lib/shared → microsoft/auth-microsoftb2c}/auth-msalBroadcastServiceb2c.service.d.ts +1 -1
  105. package/microsoft/index.d.ts +5 -0
  106. package/microsoft/public_api.d.ts +4 -0
  107. package/microsoft/shared/auth-microsoft.interface.d.ts +32 -0
  108. package/microsoft/shared/index.d.ts +1 -0
  109. package/{lib → monitoring}/auth-monitoring/auth-monitoring.provider.d.ts +1 -1
  110. package/{lib → monitoring}/auth-monitoring/auth-monitoring.service.d.ts +3 -2
  111. package/monitoring/index.d.ts +5 -0
  112. package/monitoring/public_api.d.ts +2 -0
  113. package/package.json +46 -3
  114. package/public_api.d.ts +2 -18
  115. package/src/auth.theme.scss +9 -9
  116. package/esm2022/lib/auth-form/auth-facebook.component.mjs +0 -65
  117. package/esm2022/lib/auth-form/auth-form.component.mjs +0 -170
  118. package/esm2022/lib/auth-form/auth-google.component.mjs +0 -106
  119. package/esm2022/lib/auth-form/auth-intern.component.mjs +0 -84
  120. package/esm2022/lib/auth-form/auth-microsoft.component.mjs +0 -100
  121. package/esm2022/lib/auth-form/auth-microsoftb2c.component.mjs +0 -98
  122. package/esm2022/lib/auth-form/index.mjs +0 -19
  123. package/esm2022/lib/auth-monitoring/auth-monitoring.provider.mjs +0 -23
  124. package/esm2022/lib/auth-monitoring/auth-monitoring.service.mjs +0 -53
  125. package/esm2022/lib/auth.module.mjs +0 -97
  126. package/esm2022/lib/environment/environment.interface.mjs +0 -2
  127. package/esm2022/lib/environment/index.mjs +0 -2
  128. package/esm2022/lib/shared/auth-microsoft.provider.mjs +0 -86
  129. package/esm2022/lib/shared/auth-msalBroadcastServiceb2c.service.mjs +0 -47
  130. package/esm2022/lib/shared/auth-msalServiceb2c.service..mjs +0 -85
  131. package/esm2022/lib/shared/protected.directive.mjs +0 -21
  132. package/lib/auth-form/index.d.ts +0 -11
  133. package/lib/auth.module.d.ts +0 -24
  134. package/lib/environment/environment.interface.d.ts +0 -5
  135. package/lib/shared/auth-microsoft.provider.d.ts +0 -30
  136. package/lib/shared/protected.directive.d.ts +0 -8
  137. /package/{lib/environment/index.d.ts → environment/public_api.d.ts} +0 -0
  138. /package/{lib/shared/auth-msalServiceb2c.service..d.ts → microsoft/auth-microsoftb2c/auth-msalServiceb2c.service.d.ts} +0 -0
@@ -0,0 +1,404 @@
1
+ import * as i1 from '@igo2/auth';
2
+ import { AuthFeatureKind } from '@igo2/auth';
3
+ import * as i2 from '@igo2/core/config';
4
+ import { ConfigService } from '@igo2/core/config';
5
+ import * as i3 from '@azure/msal-angular';
6
+ import { MsalBroadcastService, MSAL_GUARD_CONFIG, MSAL_INSTANCE, MsalService } from '@azure/msal-angular';
7
+ import { PublicClientApplication, InteractionStatus, InteractionRequiredAuthError, WrapperSKU, EventMessageUtils, InteractionType } from '@azure/msal-browser';
8
+ import * as i0 from '@angular/core';
9
+ import { EventEmitter, Component, ChangeDetectionStrategy, Inject, Output, Injectable } from '@angular/core';
10
+ import * as i4 from '@angular/material/button';
11
+ import { MatButtonModule } from '@angular/material/button';
12
+ import { MICROSOFT_ICON, IgoIconComponent } from '@igo2/common/icon';
13
+ import { IgoLanguageModule } from '@igo2/core/language';
14
+ import { Subject, from, BehaviorSubject } from 'rxjs';
15
+ import { filter, takeUntil } from 'rxjs/operators';
16
+ import * as i5 from '@ngx-translate/core';
17
+ import * as i1$1 from '@angular/common';
18
+
19
+ class AuthMicrosoftComponent {
20
+ authService;
21
+ config;
22
+ appRef;
23
+ msalService;
24
+ msalGuardConfig;
25
+ options;
26
+ _destroying$ = new Subject();
27
+ login = new EventEmitter();
28
+ broadcastService;
29
+ svgIcon = MICROSOFT_ICON;
30
+ constructor(authService, config, appRef, msalService, msalGuardConfig) {
31
+ this.authService = authService;
32
+ this.config = config;
33
+ this.appRef = appRef;
34
+ this.msalService = msalService;
35
+ this.msalGuardConfig = msalGuardConfig;
36
+ this.options = this.config.getConfig('auth.microsoft');
37
+ this.msalService.instance = new PublicClientApplication({
38
+ auth: this.options,
39
+ cache: {
40
+ cacheLocation: 'sessionStorage'
41
+ }
42
+ });
43
+ this.broadcastService = new MsalBroadcastService(this.msalService.instance, this.msalService);
44
+ if (this.options?.clientId) {
45
+ this.broadcastService.inProgress$
46
+ .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
47
+ .subscribe(() => {
48
+ this.checkAccount();
49
+ });
50
+ }
51
+ else {
52
+ console.warn('Microsoft authentification needs "clientId" option');
53
+ }
54
+ }
55
+ loginMicrosoft() {
56
+ this.msalService
57
+ .loginPopup({ ...this.getConf().authRequest })
58
+ .subscribe((response) => {
59
+ this.msalService.instance.setActiveAccount(response.account);
60
+ this.checkAccount();
61
+ });
62
+ }
63
+ checkAccount() {
64
+ this.msalService.instance
65
+ .acquireTokenSilent(this.getConf().authRequest)
66
+ .then((response) => {
67
+ const tokenAccess = response.accessToken;
68
+ const tokenId = response.idToken;
69
+ this.authService
70
+ .loginWithToken(tokenAccess, 'microsoft', { tokenId })
71
+ .subscribe(() => {
72
+ this.appRef.tick();
73
+ this.login.emit(true);
74
+ });
75
+ })
76
+ .catch(async (error) => {
77
+ if (error instanceof InteractionRequiredAuthError) {
78
+ // fallback to interaction when silent call fails
79
+ return this.msalService.acquireTokenPopup(this.getConf().authRequest);
80
+ }
81
+ console.log(error);
82
+ })
83
+ .catch((error) => {
84
+ console.log('Silent token fails');
85
+ });
86
+ }
87
+ getConf() {
88
+ return this.msalGuardConfig.filter((conf) => conf.type === 'add')[0];
89
+ }
90
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: AuthMicrosoftComponent, deps: [{ token: i1.AuthService }, { token: i2.ConfigService }, { token: i0.ApplicationRef }, { token: i3.MsalService }, { token: MSAL_GUARD_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
91
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: AuthMicrosoftComponent, isStandalone: true, selector: "igo-auth-microsoft", outputs: { login: "login" }, ngImport: i0, template: "<button\n class=\"microsoft-login-button\"\n mat-raised-button\n (click)=\"loginMicrosoft()\"\n>\n <igo-icon [icon]=\"svgIcon\"></igo-icon>\n {{ 'igo.auth.microsoft.login' | translate }}\n</button>\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.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: IgoLanguageModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "component", type: IgoIconComponent, selector: "igo-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
92
+ }
93
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: AuthMicrosoftComponent, decorators: [{
94
+ type: Component,
95
+ args: [{ selector: 'igo-auth-microsoft', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [MatButtonModule, IgoLanguageModule, IgoIconComponent], template: "<button\n class=\"microsoft-login-button\"\n mat-raised-button\n (click)=\"loginMicrosoft()\"\n>\n <igo-icon [icon]=\"svgIcon\"></igo-icon>\n {{ 'igo.auth.microsoft.login' | translate }}\n</button>\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"] }]
96
+ }], ctorParameters: () => [{ type: i1.AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: i3.MsalService }, { type: undefined, decorators: [{
97
+ type: Inject,
98
+ args: [MSAL_GUARD_CONFIG]
99
+ }] }], propDecorators: { login: [{
100
+ type: Output
101
+ }] } });
102
+
103
+ /*
104
+ * Copyright (c) Microsoft Corporation. All rights reserved.
105
+ * Licensed under the MIT License.
106
+ */
107
+ class MsalServiceb2c {
108
+ instance;
109
+ location;
110
+ redirectHash;
111
+ logger;
112
+ name = '@azure/msal-angular';
113
+ version = '2.0.0-beta.2';
114
+ constructor(instance, location) {
115
+ this.instance = instance;
116
+ this.location = location;
117
+ const hash = this.location.path(true).split('#').pop();
118
+ if (hash) {
119
+ this.redirectHash = `#${hash}`;
120
+ }
121
+ this.instance.initializeWrapperLibrary(WrapperSKU.Angular, this.version);
122
+ }
123
+ initialize() {
124
+ return from(this.instance.initialize());
125
+ }
126
+ acquireTokenPopup(request) {
127
+ return from(this.instance.acquireTokenPopup(request));
128
+ }
129
+ acquireTokenRedirect(request) {
130
+ return from(this.instance.acquireTokenRedirect(request));
131
+ }
132
+ acquireTokenSilent(silentRequest) {
133
+ return from(this.instance.acquireTokenSilent(silentRequest));
134
+ }
135
+ handleRedirectObservable(hash) {
136
+ return from(this.instance.handleRedirectPromise(hash || this.redirectHash));
137
+ }
138
+ loginPopup(request) {
139
+ return from(this.instance.loginPopup(request));
140
+ }
141
+ loginRedirect(request) {
142
+ return from(this.instance.loginRedirect(request));
143
+ }
144
+ logout(logoutRequest) {
145
+ return from(this.instance.logout(logoutRequest));
146
+ }
147
+ logoutRedirect(logoutRequest) {
148
+ return from(this.instance.logoutRedirect(logoutRequest));
149
+ }
150
+ logoutPopup(logoutRequest) {
151
+ return from(this.instance.logoutPopup(logoutRequest));
152
+ }
153
+ ssoSilent(request) {
154
+ return from(this.instance.ssoSilent(request));
155
+ }
156
+ /**
157
+ * Gets logger for msal-angular.
158
+ * If no logger set, returns logger instance created with same options as msal-browser
159
+ */
160
+ getLogger() {
161
+ if (!this.logger) {
162
+ this.logger = this.instance.getLogger().clone(this.name, this.version);
163
+ }
164
+ return this.logger;
165
+ }
166
+ // Create a logger instance for msal-angular with the same options as msal-browser
167
+ setLogger(logger) {
168
+ this.logger = logger.clone(this.name, this.version);
169
+ this.instance.setLogger(logger);
170
+ }
171
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: MsalServiceb2c, deps: [{ token: MSAL_INSTANCE }, { token: i1$1.Location }], target: i0.ɵɵFactoryTarget.Injectable });
172
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: MsalServiceb2c });
173
+ }
174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: MsalServiceb2c, decorators: [{
175
+ type: Injectable
176
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
177
+ type: Inject,
178
+ args: [MSAL_INSTANCE]
179
+ }] }, { type: i1$1.Location }] });
180
+
181
+ /*
182
+ * Copyright (c) Microsoft Corporation. All rights reserved.
183
+ * Licensed under the MIT License.
184
+ */
185
+ class MsalBroadcastServiceb2c {
186
+ msalInstance;
187
+ authService;
188
+ _msalSubject;
189
+ msalSubject$;
190
+ _inProgress;
191
+ inProgress$;
192
+ constructor(msalInstance, authService) {
193
+ this.msalInstance = msalInstance;
194
+ this.authService = authService;
195
+ this._msalSubject = new Subject();
196
+ this.msalSubject$ = this._msalSubject.asObservable();
197
+ // InProgress as BehaviorSubject so most recent inProgress state will be available upon subscription
198
+ this._inProgress = new BehaviorSubject(InteractionStatus.Startup);
199
+ this.inProgress$ = this._inProgress.asObservable();
200
+ this.msalInstance.addEventCallback((message) => {
201
+ this._msalSubject.next(message);
202
+ const status = EventMessageUtils.getInteractionStatusFromEvent(message);
203
+ if (status !== null) {
204
+ this.authService
205
+ .getLogger()
206
+ .verbose(`BroadcastService - ${message.eventType} results in setting inProgress to ${status}`);
207
+ this._inProgress.next(status);
208
+ }
209
+ });
210
+ }
211
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: MsalBroadcastServiceb2c, deps: [{ token: MSAL_INSTANCE }, { token: MsalServiceb2c }], target: i0.ɵɵFactoryTarget.Injectable });
212
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: MsalBroadcastServiceb2c });
213
+ }
214
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: MsalBroadcastServiceb2c, decorators: [{
215
+ type: Injectable
216
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
217
+ type: Inject,
218
+ args: [MSAL_INSTANCE]
219
+ }] }, { type: MsalServiceb2c }] });
220
+
221
+ class AuthMicrosoftb2cComponent {
222
+ authService;
223
+ config;
224
+ appRef;
225
+ msalService;
226
+ msalGuardConfig;
227
+ options;
228
+ _destroying$ = new Subject();
229
+ login = new EventEmitter();
230
+ broadcastService;
231
+ svgIcon = MICROSOFT_ICON;
232
+ constructor(authService, config, appRef, msalService, msalGuardConfig) {
233
+ this.authService = authService;
234
+ this.config = config;
235
+ this.appRef = appRef;
236
+ this.msalService = msalService;
237
+ this.msalGuardConfig = msalGuardConfig;
238
+ this.options = this.config.getConfig('auth.microsoftb2c') || {};
239
+ this.msalService.instance = new PublicClientApplication({
240
+ auth: this.options.browserAuthOptions,
241
+ cache: {
242
+ cacheLocation: 'sessionStorage'
243
+ }
244
+ });
245
+ this.broadcastService = new MsalBroadcastServiceb2c(this.msalService.instance, this.msalService);
246
+ if (this.options.browserAuthOptions.clientId) {
247
+ this.broadcastService.inProgress$
248
+ .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
249
+ .subscribe(() => {
250
+ this.checkAccount();
251
+ });
252
+ }
253
+ else {
254
+ console.warn('Microsoft authentification needs "clientId" option');
255
+ }
256
+ }
257
+ loginMicrosoftb2c() {
258
+ this.msalService
259
+ .loginPopup({ ...this.getConf().authRequest })
260
+ .subscribe((response) => {
261
+ this.msalService.instance.setActiveAccount(response.account);
262
+ this.checkAccount();
263
+ });
264
+ }
265
+ checkAccount() {
266
+ this.msalService.instance
267
+ .acquireTokenSilent(this.getConf().authRequest)
268
+ .then((response) => {
269
+ const token = response.idToken;
270
+ this.authService.loginWithToken(token, 'microsoftb2c').subscribe(() => {
271
+ this.appRef.tick();
272
+ this.login.emit(true);
273
+ });
274
+ })
275
+ .catch(async (error) => {
276
+ if (error instanceof InteractionRequiredAuthError) {
277
+ // fallback to interaction when silent call fails
278
+ return this.msalService.acquireTokenPopup(this.getConf().authRequest);
279
+ }
280
+ })
281
+ .catch((error) => {
282
+ console.log('Silent token fails');
283
+ });
284
+ }
285
+ getConf() {
286
+ return this.msalGuardConfig.filter((conf) => conf.type === 'b2c')[0];
287
+ }
288
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: AuthMicrosoftb2cComponent, deps: [{ token: i1.AuthService }, { token: i2.ConfigService }, { token: i0.ApplicationRef }, { token: MsalServiceb2c }, { token: MSAL_GUARD_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
289
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: AuthMicrosoftb2cComponent, isStandalone: true, selector: "igo-auth-microsoftb2c", outputs: { login: "login" }, providers: [MsalServiceb2c], ngImport: i0, template: "<button\n class=\"microsoft-login-button\"\n mat-raised-button\n (click)=\"loginMicrosoftb2c()\"\n>\n <igo-icon [icon]=\"svgIcon\"></igo-icon>\n {{ 'igo.auth.microsoftb2c.login' | translate }}\n</button>\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.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: IgoLanguageModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "component", type: IgoIconComponent, selector: "igo-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
290
+ }
291
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: AuthMicrosoftb2cComponent, decorators: [{
292
+ type: Component,
293
+ args: [{ selector: 'igo-auth-microsoftb2c', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [MatButtonModule, IgoLanguageModule, IgoIconComponent], providers: [MsalServiceb2c], template: "<button\n class=\"microsoft-login-button\"\n mat-raised-button\n (click)=\"loginMicrosoftb2c()\"\n>\n <igo-icon [icon]=\"svgIcon\"></igo-icon>\n {{ 'igo.auth.microsoftb2c.login' | translate }}\n</button>\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"] }]
294
+ }], ctorParameters: () => [{ type: i1.AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: MsalServiceb2c }, { type: undefined, decorators: [{
295
+ type: Inject,
296
+ args: [MSAL_GUARD_CONFIG]
297
+ }] }], propDecorators: { login: [{
298
+ type: Output
299
+ }] } });
300
+
301
+ const AUTH_MICROSOFT_DIRECTIVES = [
302
+ AuthMicrosoftComponent,
303
+ AuthMicrosoftb2cComponent
304
+ ];
305
+ function MSALConfigFactory(config) {
306
+ const msConf = config.getConfig('auth.microsoft');
307
+ if (!msConf) {
308
+ return;
309
+ }
310
+ msConf.redirectUri = msConf?.redirectUri || window.location.href;
311
+ msConf.authority =
312
+ msConf?.authority || 'https://login.microsoftonline.com/organizations';
313
+ const myMsalObj = new PublicClientApplication({
314
+ auth: msConf,
315
+ cache: {
316
+ cacheLocation: 'sessionStorage'
317
+ }
318
+ });
319
+ return myMsalObj;
320
+ }
321
+ function MSALConfigFactoryb2c(config) {
322
+ const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions');
323
+ if (!msConf) {
324
+ return;
325
+ }
326
+ msConf.redirectUri = msConf?.redirectUri || window.location.href;
327
+ msConf.authority =
328
+ msConf?.authority || 'https://login.microsoftonline.com/organizations';
329
+ const myMsalObj = new PublicClientApplication({
330
+ auth: msConf,
331
+ cache: {
332
+ cacheLocation: 'sessionStorage'
333
+ }
334
+ });
335
+ return myMsalObj;
336
+ }
337
+ function MSALAngularConfigFactory(config) {
338
+ const msConf = config.getConfig('auth.microsoft');
339
+ return {
340
+ interactionType: InteractionType.Popup,
341
+ authRequest: {
342
+ scopes: ['user.read'],
343
+ loginHint: 'todo'
344
+ },
345
+ type: 'add'
346
+ };
347
+ }
348
+ function MSALAngularConfigFactoryb2c(config) {
349
+ const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions');
350
+ return {
351
+ interactionType: InteractionType.Popup,
352
+ authRequest: {
353
+ scopes: [msConf?.clientId]
354
+ },
355
+ type: 'b2c'
356
+ };
357
+ }
358
+ function withMicrosoftSupport(type) {
359
+ if (type === 'b2c') {
360
+ return {
361
+ kind: AuthFeatureKind.Microsoft,
362
+ providers: [
363
+ {
364
+ provide: MSAL_INSTANCE,
365
+ useFactory: MSALConfigFactoryb2c,
366
+ deps: [ConfigService]
367
+ },
368
+ {
369
+ provide: MSAL_GUARD_CONFIG,
370
+ useFactory: MSALAngularConfigFactoryb2c,
371
+ deps: [ConfigService],
372
+ multi: true
373
+ },
374
+ MsalServiceb2c
375
+ ]
376
+ };
377
+ }
378
+ else {
379
+ return {
380
+ kind: AuthFeatureKind.Microsoft,
381
+ providers: [
382
+ {
383
+ provide: MSAL_INSTANCE,
384
+ useFactory: MSALConfigFactory,
385
+ deps: [ConfigService]
386
+ },
387
+ {
388
+ provide: MSAL_GUARD_CONFIG,
389
+ useFactory: MSALAngularConfigFactory,
390
+ deps: [ConfigService],
391
+ multi: true
392
+ },
393
+ MsalService
394
+ ]
395
+ };
396
+ }
397
+ }
398
+
399
+ /**
400
+ * Generated bundle index. Do not edit.
401
+ */
402
+
403
+ export { AUTH_MICROSOFT_DIRECTIVES, AuthMicrosoftComponent, AuthMicrosoftb2cComponent, MSALAngularConfigFactory, MSALAngularConfigFactoryb2c, MSALConfigFactory, MSALConfigFactoryb2c, withMicrosoftSupport };
404
+ //# sourceMappingURL=igo2-auth-microsoft.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"igo2-auth-microsoft.mjs","sources":["../../../packages/auth/microsoft/src/auth-microsoft/auth-microsoft.component.ts","../../../packages/auth/microsoft/src/auth-microsoft/auth-microsoft.component.html","../../../packages/auth/microsoft/src/auth-microsoftb2c/auth-msalServiceb2c.service.ts","../../../packages/auth/microsoft/src/auth-microsoftb2c/auth-msalBroadcastServiceb2c.service.ts","../../../packages/auth/microsoft/src/auth-microsoftb2c/auth-microsoftb2c.component.ts","../../../packages/auth/microsoft/src/auth-microsoftb2c/auth-microsoftb2c.component.html","../../../packages/auth/microsoft/src/auth-microsoft.provider.ts","../../../packages/auth/microsoft/src/igo2-auth-microsoft.ts"],"sourcesContent":["import {\n ApplicationRef,\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Inject,\n Output\n} from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\n\nimport { AuthService } from '@igo2/auth';\nimport { IconSvg, IgoIconComponent, MICROSOFT_ICON } from '@igo2/common/icon';\nimport { ConfigService } from '@igo2/core/config';\nimport { IgoLanguageModule } from '@igo2/core/language';\n\nimport {\n MSAL_GUARD_CONFIG,\n MsalBroadcastService,\n MsalService\n} from '@azure/msal-angular';\nimport {\n AuthenticationResult,\n InteractionRequiredAuthError,\n InteractionStatus,\n PopupRequest,\n PublicClientApplication,\n SilentRequest\n} from '@azure/msal-browser';\nimport { Subject } from 'rxjs';\nimport { filter, takeUntil } from 'rxjs/operators';\n\nimport {\n AuthMicrosoftOptions,\n MSPMsalGuardConfiguration\n} from '../shared/auth-microsoft.interface';\n\n@Component({\n selector: 'igo-auth-microsoft',\n templateUrl: './auth-microsoft.component.html',\n styleUrls: ['./auth-microsoft.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [MatButtonModule, IgoLanguageModule, IgoIconComponent]\n})\nexport class AuthMicrosoftComponent {\n private options?: AuthMicrosoftOptions;\n private readonly _destroying$ = new Subject<void>();\n @Output() login: EventEmitter<boolean> = new EventEmitter<boolean>();\n private broadcastService: MsalBroadcastService;\n\n svgIcon: IconSvg = MICROSOFT_ICON;\n\n constructor(\n private authService: AuthService,\n private config: ConfigService,\n private appRef: ApplicationRef,\n private msalService: MsalService,\n @Inject(MSAL_GUARD_CONFIG)\n private msalGuardConfig: MSPMsalGuardConfiguration[]\n ) {\n this.options = this.config.getConfig('auth.microsoft');\n\n this.msalService.instance = new PublicClientApplication({\n auth: this.options,\n cache: {\n cacheLocation: 'sessionStorage'\n }\n });\n\n this.broadcastService = new MsalBroadcastService(\n this.msalService.instance,\n this.msalService\n );\n\n if (this.options?.clientId) {\n this.broadcastService.inProgress$\n .pipe(\n filter(\n (status: InteractionStatus) => status === InteractionStatus.None\n ),\n takeUntil(this._destroying$)\n )\n .subscribe(() => {\n this.checkAccount();\n });\n } else {\n console.warn('Microsoft authentification needs \"clientId\" option');\n }\n }\n\n public loginMicrosoft() {\n this.msalService\n .loginPopup({ ...this.getConf().authRequest } as PopupRequest)\n .subscribe((response: AuthenticationResult) => {\n this.msalService.instance.setActiveAccount(response.account);\n this.checkAccount();\n });\n }\n\n private checkAccount() {\n this.msalService.instance\n .acquireTokenSilent(this.getConf().authRequest as SilentRequest)\n .then((response: AuthenticationResult) => {\n const tokenAccess = response.accessToken;\n const tokenId = response.idToken;\n this.authService\n .loginWithToken(tokenAccess, 'microsoft', { tokenId })\n .subscribe(() => {\n this.appRef.tick();\n this.login.emit(true);\n });\n })\n .catch(async (error) => {\n if (error instanceof InteractionRequiredAuthError) {\n // fallback to interaction when silent call fails\n return this.msalService.acquireTokenPopup(\n this.getConf().authRequest as SilentRequest\n );\n }\n console.log(error);\n })\n .catch((error) => {\n console.log('Silent token fails');\n });\n }\n\n private getConf(): MSPMsalGuardConfiguration {\n return this.msalGuardConfig.filter((conf) => conf.type === 'add')[0];\n }\n}\n","<button\n class=\"microsoft-login-button\"\n mat-raised-button\n (click)=\"loginMicrosoft()\"\n>\n <igo-icon [icon]=\"svgIcon\"></igo-icon>\n {{ 'igo.auth.microsoft.login' | translate }}\n</button>\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { Location } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\n\nimport { MSAL_INSTANCE } from '@azure/msal-angular';\nimport { IMsalService } from '@azure/msal-angular';\nimport {\n AuthenticationResult,\n EndSessionPopupRequest,\n EndSessionRequest,\n IPublicClientApplication,\n Logger,\n PopupRequest,\n RedirectRequest,\n SilentRequest,\n SsoSilentRequest,\n WrapperSKU\n} from '@azure/msal-browser';\nimport { Observable, from } from 'rxjs';\n\n@Injectable()\nexport class MsalServiceb2c implements IMsalService {\n private redirectHash: string;\n private logger: Logger;\n private name = '@azure/msal-angular';\n private version = '2.0.0-beta.2';\n constructor(\n @Inject(MSAL_INSTANCE) public instance: IPublicClientApplication,\n private location: Location\n ) {\n const hash = this.location.path(true).split('#').pop();\n if (hash) {\n this.redirectHash = `#${hash}`;\n }\n this.instance.initializeWrapperLibrary(WrapperSKU.Angular, this.version);\n }\n\n initialize(): Observable<void> {\n return from(this.instance.initialize());\n }\n\n acquireTokenPopup(request: PopupRequest): Observable<AuthenticationResult> {\n return from(this.instance.acquireTokenPopup(request));\n }\n acquireTokenRedirect(request: RedirectRequest): Observable<void> {\n return from(this.instance.acquireTokenRedirect(request));\n }\n acquireTokenSilent(\n silentRequest: SilentRequest\n ): Observable<AuthenticationResult> {\n return from(this.instance.acquireTokenSilent(silentRequest));\n }\n handleRedirectObservable(hash?: string): Observable<AuthenticationResult> {\n return from(this.instance.handleRedirectPromise(hash || this.redirectHash));\n }\n loginPopup(request?: PopupRequest): Observable<AuthenticationResult> {\n return from(this.instance.loginPopup(request));\n }\n loginRedirect(request?: RedirectRequest): Observable<void> {\n return from(this.instance.loginRedirect(request));\n }\n logout(logoutRequest?: EndSessionRequest): Observable<void> {\n return from(this.instance.logout(logoutRequest));\n }\n logoutRedirect(logoutRequest?: EndSessionRequest): Observable<void> {\n return from(this.instance.logoutRedirect(logoutRequest));\n }\n logoutPopup(logoutRequest?: EndSessionPopupRequest): Observable<void> {\n return from(this.instance.logoutPopup(logoutRequest));\n }\n ssoSilent(request: SsoSilentRequest): Observable<AuthenticationResult> {\n return from(this.instance.ssoSilent(request));\n }\n /**\n * Gets logger for msal-angular.\n * If no logger set, returns logger instance created with same options as msal-browser\n */\n getLogger(): Logger {\n if (!this.logger) {\n this.logger = this.instance.getLogger().clone(this.name, this.version);\n }\n return this.logger;\n }\n // Create a logger instance for msal-angular with the same options as msal-browser\n setLogger(logger: Logger): void {\n this.logger = logger.clone(this.name, this.version);\n this.instance.setLogger(logger);\n }\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { Inject, Injectable } from '@angular/core';\n\nimport { MSAL_INSTANCE } from '@azure/msal-angular';\nimport {\n EventMessage,\n EventMessageUtils,\n IPublicClientApplication,\n InteractionStatus\n} from '@azure/msal-browser';\nimport { BehaviorSubject, Observable, Subject } from 'rxjs';\n\nimport { MsalServiceb2c } from './auth-msalServiceb2c.service';\n\n@Injectable()\nexport class MsalBroadcastServiceb2c {\n private _msalSubject: Subject<EventMessage>;\n public msalSubject$: Observable<EventMessage>;\n private _inProgress: BehaviorSubject<InteractionStatus>;\n public inProgress$: Observable<InteractionStatus>;\n\n constructor(\n @Inject(MSAL_INSTANCE) private msalInstance: IPublicClientApplication,\n private authService: MsalServiceb2c\n ) {\n this._msalSubject = new Subject<EventMessage>();\n this.msalSubject$ = this._msalSubject.asObservable();\n\n // InProgress as BehaviorSubject so most recent inProgress state will be available upon subscription\n this._inProgress = new BehaviorSubject<InteractionStatus>(\n InteractionStatus.Startup\n );\n this.inProgress$ = this._inProgress.asObservable();\n\n this.msalInstance.addEventCallback((message: EventMessage) => {\n this._msalSubject.next(message);\n const status = EventMessageUtils.getInteractionStatusFromEvent(message);\n if (status !== null) {\n this.authService\n .getLogger()\n .verbose(\n `BroadcastService - ${message.eventType} results in setting inProgress to ${status}`\n );\n this._inProgress.next(status);\n }\n });\n }\n}\n","import {\n ApplicationRef,\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Inject,\n Output\n} from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\n\nimport { AuthService } from '@igo2/auth';\nimport { IconSvg, IgoIconComponent, MICROSOFT_ICON } from '@igo2/common/icon';\nimport { ConfigService } from '@igo2/core/config';\nimport { IgoLanguageModule } from '@igo2/core/language';\n\nimport { MSAL_GUARD_CONFIG } from '@azure/msal-angular';\nimport {\n AuthenticationResult,\n InteractionRequiredAuthError,\n InteractionStatus,\n PopupRequest,\n PublicClientApplication,\n SilentRequest\n} from '@azure/msal-browser';\nimport { Subject } from 'rxjs';\nimport { filter, takeUntil } from 'rxjs/operators';\n\nimport {\n AuthMicrosoftb2cOptions,\n MSPMsalGuardConfiguration\n} from '../shared/auth-microsoft.interface';\nimport { MsalBroadcastServiceb2c } from './auth-msalBroadcastServiceb2c.service';\nimport { MsalServiceb2c } from './auth-msalServiceb2c.service';\n\n@Component({\n selector: 'igo-auth-microsoftb2c',\n templateUrl: './auth-microsoftb2c.component.html',\n styleUrls: ['./auth-microsoftb2c.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [MatButtonModule, IgoLanguageModule, IgoIconComponent],\n providers: [MsalServiceb2c]\n})\nexport class AuthMicrosoftb2cComponent {\n private options: AuthMicrosoftb2cOptions;\n private readonly _destroying$ = new Subject<void>();\n @Output() login: EventEmitter<boolean> = new EventEmitter<boolean>();\n private broadcastService: MsalBroadcastServiceb2c;\n\n svgIcon: IconSvg = MICROSOFT_ICON;\n\n constructor(\n private authService: AuthService,\n private config: ConfigService,\n private appRef: ApplicationRef,\n private msalService: MsalServiceb2c,\n @Inject(MSAL_GUARD_CONFIG)\n private msalGuardConfig: MSPMsalGuardConfiguration[]\n ) {\n this.options = this.config.getConfig('auth.microsoftb2c') || {};\n\n this.msalService.instance = new PublicClientApplication({\n auth: this.options.browserAuthOptions,\n cache: {\n cacheLocation: 'sessionStorage'\n }\n });\n\n this.broadcastService = new MsalBroadcastServiceb2c(\n this.msalService.instance,\n this.msalService\n );\n\n if (this.options.browserAuthOptions.clientId) {\n this.broadcastService.inProgress$\n .pipe(\n filter(\n (status: InteractionStatus) => status === InteractionStatus.None\n ),\n takeUntil(this._destroying$)\n )\n .subscribe(() => {\n this.checkAccount();\n });\n } else {\n console.warn('Microsoft authentification needs \"clientId\" option');\n }\n }\n\n public loginMicrosoftb2c() {\n this.msalService\n .loginPopup({ ...this.getConf().authRequest } as PopupRequest)\n .subscribe((response: AuthenticationResult) => {\n this.msalService.instance.setActiveAccount(response.account);\n this.checkAccount();\n });\n }\n\n private checkAccount() {\n this.msalService.instance\n .acquireTokenSilent(this.getConf().authRequest as SilentRequest)\n .then((response: AuthenticationResult) => {\n const token = response.idToken;\n this.authService.loginWithToken(token, 'microsoftb2c').subscribe(() => {\n this.appRef.tick();\n this.login.emit(true);\n });\n })\n .catch(async (error) => {\n if (error instanceof InteractionRequiredAuthError) {\n // fallback to interaction when silent call fails\n return this.msalService.acquireTokenPopup(\n this.getConf().authRequest as SilentRequest\n );\n }\n })\n .catch((error) => {\n console.log('Silent token fails');\n });\n }\n\n private getConf(): MSPMsalGuardConfiguration {\n return this.msalGuardConfig.filter((conf) => conf.type === 'b2c')[0];\n }\n}\n","<button\n class=\"microsoft-login-button\"\n mat-raised-button\n (click)=\"loginMicrosoftb2c()\"\n>\n <igo-icon [icon]=\"svgIcon\"></igo-icon>\n {{ 'igo.auth.microsoftb2c.login' | translate }}\n</button>\n","import { AuthFeature, AuthFeatureKind } from '@igo2/auth';\nimport { ConfigService } from '@igo2/core/config';\n\nimport {\n MSAL_GUARD_CONFIG,\n MSAL_INSTANCE,\n MsalService\n} from '@azure/msal-angular';\nimport { InteractionType, PublicClientApplication } from '@azure/msal-browser';\nimport { BrowserAuthOptions } from '@azure/msal-browser';\n\nimport { AuthMicrosoftComponent } from './auth-microsoft/auth-microsoft.component';\nimport { AuthMicrosoftb2cComponent } from './auth-microsoftb2c/auth-microsoftb2c.component';\nimport { MsalServiceb2c } from './auth-microsoftb2c/auth-msalServiceb2c.service';\nimport {\n AuthMicrosoftOptions,\n MSPMsalGuardConfiguration\n} from './shared/auth-microsoft.interface';\n\nexport const AUTH_MICROSOFT_DIRECTIVES = [\n AuthMicrosoftComponent,\n AuthMicrosoftb2cComponent\n] as const;\n\nexport function MSALConfigFactory(\n config: ConfigService\n): PublicClientApplication {\n const msConf = config.getConfig('auth.microsoft') as AuthMicrosoftOptions;\n if (!msConf) {\n return;\n }\n\n msConf.redirectUri = msConf?.redirectUri || window.location.href;\n msConf.authority =\n msConf?.authority || 'https://login.microsoftonline.com/organizations';\n\n const myMsalObj = new PublicClientApplication({\n auth: msConf,\n cache: {\n cacheLocation: 'sessionStorage'\n }\n });\n\n return myMsalObj;\n}\n\nexport function MSALConfigFactoryb2c(\n config: ConfigService\n): PublicClientApplication {\n const msConf = config.getConfig(\n 'auth.microsoftb2c.browserAuthOptions'\n ) as BrowserAuthOptions;\n if (!msConf) {\n return;\n }\n msConf.redirectUri = msConf?.redirectUri || window.location.href;\n msConf.authority =\n msConf?.authority || 'https://login.microsoftonline.com/organizations';\n\n const myMsalObj = new PublicClientApplication({\n auth: msConf,\n cache: {\n cacheLocation: 'sessionStorage'\n }\n });\n\n return myMsalObj;\n}\n\nexport function MSALAngularConfigFactory(\n config: ConfigService\n): MSPMsalGuardConfiguration {\n const msConf = config.getConfig('auth.microsoft') as AuthMicrosoftOptions;\n\n return {\n interactionType: InteractionType.Popup,\n authRequest: {\n scopes: ['user.read'],\n loginHint: 'todo'\n },\n type: 'add'\n };\n}\n\nexport function MSALAngularConfigFactoryb2c(\n config: ConfigService\n): MSPMsalGuardConfiguration {\n const msConf = config.getConfig(\n 'auth.microsoftb2c.browserAuthOptions'\n ) as BrowserAuthOptions;\n\n return {\n interactionType: InteractionType.Popup,\n authRequest: {\n scopes: [msConf?.clientId]\n },\n type: 'b2c'\n };\n}\n\nexport function withMicrosoftSupport(\n type?: string\n): AuthFeature<AuthFeatureKind.Microsoft> {\n if (type === 'b2c') {\n return {\n kind: AuthFeatureKind.Microsoft,\n providers: [\n {\n provide: MSAL_INSTANCE,\n useFactory: MSALConfigFactoryb2c,\n deps: [ConfigService]\n },\n {\n provide: MSAL_GUARD_CONFIG,\n useFactory: MSALAngularConfigFactoryb2c,\n deps: [ConfigService],\n multi: true\n },\n MsalServiceb2c\n ]\n };\n } else {\n return {\n kind: AuthFeatureKind.Microsoft,\n providers: [\n {\n provide: MSAL_INSTANCE,\n useFactory: MSALConfigFactory,\n deps: [ConfigService]\n },\n {\n provide: MSAL_GUARD_CONFIG,\n useFactory: MSALAngularConfigFactory,\n deps: [ConfigService],\n multi: true\n },\n MsalService\n ]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i1.MsalServiceb2c"],"mappings":";;;;;;;;;;;;;;;;;;MA4Ca,sBAAsB,CAAA;AASvB,IAAA,WAAA,CAAA;AACA,IAAA,MAAA,CAAA;AACA,IAAA,MAAA,CAAA;AACA,IAAA,WAAA,CAAA;AAEA,IAAA,eAAA,CAAA;AAbF,IAAA,OAAO,CAAwB;AACtB,IAAA,YAAY,GAAG,IAAI,OAAO,EAAQ,CAAC;AAC1C,IAAA,KAAK,GAA0B,IAAI,YAAY,EAAW,CAAC;AAC7D,IAAA,gBAAgB,CAAuB;IAE/C,OAAO,GAAY,cAAc,CAAC;IAElC,WACU,CA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;AACf,aAAA;SACF,CAAC;KACH;SAAM;QACL,OAAO;YACL,IAAI,EAAE,eAAe,CAAC,SAAS;AAC/B,YAAA,SAAS,EAAE;AACT,gBAAA;AACE,oBAAA,OAAO,EAAE,aAAa;AACtB,oBAAA,UAAU,EAAE,iBAAiB;oBAC7B,IAAI,EAAE,CAAC,aAAa,CAAC;AACtB,iBAAA;AACD,gBAAA;AACE,oBAAA,OAAO,EAAE,iBAAiB;AAC1B,oBAAA,UAAU,EAAE,wBAAwB;oBACpC,IAAI,EAAE,CAAC,aAAa,CAAC;AACrB,oBAAA,KAAK,EAAE,IAAI;AACZ,iBAAA;gBACD,WAAW;AACZ,aAAA;SACF,CAAC;KACH;AACH;;AC5IA;;AAEG;;;;"}
@@ -0,0 +1,81 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Optional, Inject, Injector, APP_INITIALIZER } from '@angular/core';
3
+ import * as i1 from '@igo2/core/config';
4
+ import { ConfigService } from '@igo2/core/config';
5
+ import { identifySentryUser, MONITORING_OPTIONS } from '@igo2/core/monitoring';
6
+ import { AuthService } from '@igo2/auth';
7
+ import { first, switchMap } from 'rxjs';
8
+
9
+ class AuthMonitoringService {
10
+ configService;
11
+ monitoringOptions;
12
+ injector;
13
+ // The AuthService need to be lazy provided because this service is provided in the APP_INITIALIZER
14
+ authService;
15
+ constructor(configService, monitoringOptions, injector) {
16
+ this.configService = configService;
17
+ this.monitoringOptions = monitoringOptions;
18
+ this.injector = injector;
19
+ if (!this.monitoringOptions?.identifyUser) {
20
+ return;
21
+ }
22
+ this.configService.isLoaded$
23
+ .pipe(first((isLoaded) => isLoaded), switchMap(() => {
24
+ this.authService = this.injector.get(AuthService);
25
+ return this.authService?.authenticate$;
26
+ }))
27
+ .subscribe((isAuthenticated) => {
28
+ const user = isAuthenticated ? this.authService.user : null;
29
+ this._identifyUser(user);
30
+ });
31
+ }
32
+ _identifyUser(user) {
33
+ switch (this.monitoringOptions.provider) {
34
+ case 'sentry':
35
+ identifySentryUser(user);
36
+ break;
37
+ default:
38
+ break;
39
+ }
40
+ }
41
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: AuthMonitoringService, deps: [{ token: i1.ConfigService }, { token: MONITORING_OPTIONS, optional: true }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
42
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: AuthMonitoringService, providedIn: 'root' });
43
+ }
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: AuthMonitoringService, decorators: [{
45
+ type: Injectable,
46
+ args: [{
47
+ providedIn: 'root'
48
+ }]
49
+ }], ctorParameters: () => [{ type: i1.ConfigService }, { type: undefined, decorators: [{
50
+ type: Optional
51
+ }, {
52
+ type: Inject,
53
+ args: [MONITORING_OPTIONS]
54
+ }] }, { type: i0.Injector }] });
55
+
56
+ function provideAuthUserMonitoring(options) {
57
+ if (!options) {
58
+ return [];
59
+ }
60
+ return [
61
+ {
62
+ provide: AuthMonitoringService,
63
+ useClass: AuthMonitoringService,
64
+ deps: [ConfigService, MONITORING_OPTIONS, Injector]
65
+ },
66
+ // Force instantiate Tracing service to avoid require it in any constructor.
67
+ {
68
+ provide: APP_INITIALIZER,
69
+ useFactory: () => () => { },
70
+ deps: [AuthMonitoringService],
71
+ multi: true
72
+ }
73
+ ];
74
+ }
75
+
76
+ /**
77
+ * Generated bundle index. Do not edit.
78
+ */
79
+
80
+ export { AuthMonitoringService, provideAuthUserMonitoring };
81
+ //# sourceMappingURL=igo2-auth-monitoring.mjs.map
@@ -0,0 +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 { Inject, Injectable, Injector, Optional } from '@angular/core';\r\n\r\nimport { AuthService, User } from '@igo2/auth';\r\nimport { ConfigService } from '@igo2/core/config';\r\nimport {\r\n AnyMonitoringOptions,\r\n MONITORING_OPTIONS,\r\n identifySentryUser\r\n} from '@igo2/core/monitoring';\r\n\r\nimport { first, switchMap } from 'rxjs';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AuthMonitoringService {\r\n // The AuthService need to be lazy provided because this service is provided in the APP_INITIALIZER\r\n authService?: AuthService;\r\n\r\n constructor(\r\n private configService: ConfigService,\r\n @Optional()\r\n @Inject(MONITORING_OPTIONS)\r\n private monitoringOptions: AnyMonitoringOptions | null,\r\n private injector: Injector\r\n ) {\r\n if (!this.monitoringOptions?.identifyUser) {\r\n return;\r\n }\r\n\r\n this.configService.isLoaded$\r\n .pipe(\r\n first((isLoaded) => isLoaded),\r\n switchMap(() => {\r\n this.authService = this.injector.get(AuthService);\r\n return this.authService?.authenticate$;\r\n })\r\n )\r\n .subscribe((isAuthenticated) => {\r\n const user = isAuthenticated ? this.authService.user : null;\r\n this._identifyUser(user);\r\n });\r\n }\r\n\r\n private _identifyUser(user: User | null): void {\r\n switch (this.monitoringOptions.provider) {\r\n case 'sentry':\r\n identifySentryUser(user);\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n}\r\n","import { APP_INITIALIZER, Injector, Provider } from '@angular/core';\r\n\r\nimport { ConfigService } from '@igo2/core/config';\r\nimport {\r\n AnyMonitoringOptions,\r\n MONITORING_OPTIONS\r\n} from '@igo2/core/monitoring';\r\n\r\nimport { AuthMonitoringService } from './auth-monitoring.service';\r\n\r\nexport function provideAuthUserMonitoring(\r\n options: AnyMonitoringOptions | null\r\n): Provider[] {\r\n if (!options) {\r\n return [];\r\n }\r\n\r\n return [\r\n {\r\n provide: AuthMonitoringService,\r\n useClass: AuthMonitoringService,\r\n deps: [ConfigService, MONITORING_OPTIONS, Injector]\r\n },\r\n // Force instantiate Tracing service to avoid require it in any constructor.\r\n {\r\n provide: APP_INITIALIZER,\r\n useFactory: () => () => {},\r\n deps: [AuthMonitoringService],\r\n multi: true\r\n }\r\n ];\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;MAea,qBAAqB,CAAA;AAKtB,IAAA,aAAA,CAAA;AAGA,IAAA,iBAAA,CAAA;AACA,IAAA,QAAA,CAAA;;AAPV,IAAA,WAAW,CAAe;AAE1B,IAAA,WAAA,CACU,aAA4B,EAG5B,iBAA8C,EAC9C,QAAkB,EAAA;QAJlB,IAAa,CAAA,aAAA,GAAb,aAAa,CAAe;QAG5B,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB,CAA6B;QAC9C,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;AAE1B,QAAA,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,YAAY,EAAE;YACzC,OAAO;SACR;QAED,IAAI,CAAC,aAAa,CAAC,SAAS;AACzB,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,CAAC;AAClD,YAAA,OAAO,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;AACzC,SAAC,CAAC,CACH;AACA,aAAA,SAAS,CAAC,CAAC,eAAe,KAAI;AAC7B,YAAA,MAAM,IAAI,GAAG,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;AAC5D,YAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC3B,SAAC,CAAC,CAAC;KACN;AAEO,IAAA,aAAa,CAAC,IAAiB,EAAA;AACrC,QAAA,QAAQ,IAAI,CAAC,iBAAiB,CAAC,QAAQ;AACrC,YAAA,KAAK,QAAQ;gBACX,kBAAk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