@igo2/auth 1.15.3 → 1.15.5

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 (55) hide show
  1. package/esm2020/igo2-auth.mjs +4 -4
  2. package/esm2020/lib/auth-form/auth-facebook.component.mjs +61 -61
  3. package/esm2020/lib/auth-form/auth-form.component.mjs +277 -277
  4. package/esm2020/lib/auth-form/auth-google.component.mjs +99 -99
  5. package/esm2020/lib/auth-form/auth-intern.component.mjs +119 -119
  6. package/esm2020/lib/auth-form/auth-microsoft.component.mjs +94 -94
  7. package/esm2020/lib/auth-form/auth-microsoftb2c.component.mjs +93 -93
  8. package/esm2020/lib/auth-form/index.mjs +5 -5
  9. package/esm2020/lib/auth-routing.module.mjs +24 -24
  10. package/esm2020/lib/auth.module.mjs +91 -91
  11. package/esm2020/lib/shared/admin.guard.mjs +33 -33
  12. package/esm2020/lib/shared/auth-microsoft.provider.mjs +84 -84
  13. package/esm2020/lib/shared/auth-msalBroadcastServiceb2c.service.mjs +38 -38
  14. package/esm2020/lib/shared/auth-msalServiceb2c.service..mjs +80 -80
  15. package/esm2020/lib/shared/auth.guard.mjs +32 -32
  16. package/esm2020/lib/shared/auth.interceptor.mjs +155 -155
  17. package/esm2020/lib/shared/auth.interface.mjs +2 -2
  18. package/esm2020/lib/shared/auth.service.mjs +158 -158
  19. package/esm2020/lib/shared/logged.guard.mjs +32 -32
  20. package/esm2020/lib/shared/profils.guard.mjs +37 -37
  21. package/esm2020/lib/shared/protected.directive.mjs +19 -19
  22. package/esm2020/lib/shared/storage.interface.mjs +2 -2
  23. package/esm2020/lib/shared/storage.service.mjs +91 -91
  24. package/esm2020/lib/shared/token.service.mjs +47 -47
  25. package/esm2020/public_api.mjs +19 -19
  26. package/fesm2015/igo2-auth.mjs +1577 -1577
  27. package/fesm2015/igo2-auth.mjs.map +1 -1
  28. package/fesm2020/igo2-auth.mjs +1475 -1475
  29. package/fesm2020/igo2-auth.mjs.map +1 -1
  30. package/index.d.ts +5 -5
  31. package/lib/auth-form/auth-facebook.component.d.ts +18 -18
  32. package/lib/auth-form/auth-form.component.d.ts +42 -42
  33. package/lib/auth-form/auth-google.component.d.ts +24 -24
  34. package/lib/auth-form/auth-intern.component.d.ts +21 -21
  35. package/lib/auth-form/auth-microsoft.component.d.ts +23 -23
  36. package/lib/auth-form/auth-microsoftb2c.component.d.ts +23 -23
  37. package/lib/auth-form/index.d.ts +4 -4
  38. package/lib/auth-routing.module.d.ts +7 -7
  39. package/lib/auth.module.d.ts +23 -23
  40. package/lib/shared/admin.guard.d.ts +13 -13
  41. package/lib/shared/auth-microsoft.provider.d.ts +30 -30
  42. package/lib/shared/auth-msalBroadcastServiceb2c.service.d.ts +15 -15
  43. package/lib/shared/auth-msalServiceb2c.service..d.ts +33 -33
  44. package/lib/shared/auth.guard.d.ts +13 -13
  45. package/lib/shared/auth.interceptor.d.ts +24 -24
  46. package/lib/shared/auth.interface.d.ts +99 -99
  47. package/lib/shared/auth.service.d.ts +44 -44
  48. package/lib/shared/logged.guard.d.ts +13 -13
  49. package/lib/shared/profils.guard.d.ts +13 -13
  50. package/lib/shared/protected.directive.d.ts +8 -8
  51. package/lib/shared/storage.interface.d.ts +4 -4
  52. package/lib/shared/storage.service.d.ts +18 -18
  53. package/lib/shared/token.service.d.ts +15 -15
  54. package/package.json +3 -3
  55. package/public_api.d.ts +15 -15
@@ -29,1523 +29,1523 @@ import * as i4 from '@angular/material/icon';
29
29
  import { MatIconModule } from '@angular/material/icon';
30
30
  import { Md5 } from 'ts-md5';
31
31
 
32
- class TokenService {
33
- constructor(injector) {
34
- this.injector = injector;
35
- }
36
- set(token) {
37
- localStorage.setItem(this.tokenKey, token);
38
- }
39
- remove() {
40
- localStorage.removeItem(this.tokenKey);
41
- }
42
- get() {
43
- return localStorage.getItem(this.tokenKey);
44
- }
45
- decode() {
46
- const token = this.get();
47
- if (!token) {
48
- return;
49
- }
50
- return jwtDecode(token);
51
- }
52
- isExpired() {
53
- const jwt = this.decode();
54
- const currentTime = new Date().getTime() / 1000;
55
- if (jwt && currentTime < jwt.exp) {
56
- return false;
57
- }
58
- return true;
59
- }
60
- get tokenKey() {
61
- const config = this.injector.get(ConfigService);
62
- this.options = config.getConfig('auth') || {};
63
- return this.options.tokenKey;
64
- }
65
- }
66
- TokenService.ɵfac = function TokenService_Factory(t) { return new (t || TokenService)(i0.ɵɵinject(i0.Injector)); };
67
- TokenService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TokenService, factory: TokenService.ɵfac, providedIn: 'root' });
68
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TokenService, [{
69
- type: Injectable,
70
- args: [{
71
- providedIn: 'root'
72
- }]
32
+ class TokenService {
33
+ constructor(injector) {
34
+ this.injector = injector;
35
+ }
36
+ set(token) {
37
+ localStorage.setItem(this.tokenKey, token);
38
+ }
39
+ remove() {
40
+ localStorage.removeItem(this.tokenKey);
41
+ }
42
+ get() {
43
+ return localStorage.getItem(this.tokenKey);
44
+ }
45
+ decode() {
46
+ const token = this.get();
47
+ if (!token) {
48
+ return;
49
+ }
50
+ return jwtDecode(token);
51
+ }
52
+ isExpired() {
53
+ const jwt = this.decode();
54
+ const currentTime = new Date().getTime() / 1000;
55
+ if (jwt && currentTime < jwt.exp) {
56
+ return false;
57
+ }
58
+ return true;
59
+ }
60
+ get tokenKey() {
61
+ const config = this.injector.get(ConfigService);
62
+ this.options = config.getConfig('auth') || {};
63
+ return this.options.tokenKey;
64
+ }
65
+ }
66
+ TokenService.ɵfac = function TokenService_Factory(t) { return new (t || TokenService)(i0.ɵɵinject(i0.Injector)); };
67
+ TokenService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TokenService, factory: TokenService.ɵfac, providedIn: 'root' });
68
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TokenService, [{
69
+ type: Injectable,
70
+ args: [{
71
+ providedIn: 'root'
72
+ }]
73
73
  }], function () { return [{ type: i0.Injector }]; }, null); })();
74
74
 
75
- class AuthService {
76
- constructor(http, tokenService, config, languageService, messageService, router) {
77
- this.http = http;
78
- this.tokenService = tokenService;
79
- this.config = config;
80
- this.languageService = languageService;
81
- this.messageService = messageService;
82
- this.router = router;
83
- this.authenticate$ = new BehaviorSubject(undefined);
84
- this.logged$ = new BehaviorSubject(undefined);
85
- this.languageForce = false;
86
- this.anonymous = false;
87
- this.authenticate$.next(this.authenticated);
88
- this.authenticate$.subscribe((authenticated) => {
89
- this.logged$.next(authenticated);
90
- globalCacheBusterNotifier.next();
91
- });
92
- }
93
- get hasAuthService() {
94
- return this.config.getConfig('auth.url') !== undefined;
95
- }
96
- login(username, password) {
97
- const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });
98
- const body = {
99
- username,
100
- password: this.encodePassword(password)
101
- };
102
- return this.loginCall(body, myHeader);
103
- }
104
- loginWithToken(token, type, infosUser) {
105
- const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });
106
- const body = {
107
- token,
108
- typeConnection: type,
109
- infosUser
110
- };
111
- return this.loginCall(body, myHeader);
112
- }
113
- loginAnonymous() {
114
- this.anonymous = true;
115
- this.logged$.next(true);
116
- return of(true);
117
- }
118
- refresh() {
119
- const url = this.config.getConfig('auth.url');
120
- return this.http.post(`${url}/refresh`, {}).pipe(tap((data) => {
121
- this.tokenService.set(data.token);
122
- }), catchError((err) => {
123
- err.error.caught = true;
124
- throw err;
125
- }));
126
- }
127
- logout() {
128
- this.anonymous = false;
129
- this.tokenService.remove();
130
- this.authenticate$.next(false);
131
- return of(true);
132
- }
133
- isAuthenticated() {
134
- return !this.tokenService.isExpired();
135
- }
136
- getToken() {
137
- return this.tokenService.get();
138
- }
139
- decodeToken() {
140
- if (this.isAuthenticated()) {
141
- return this.tokenService.decode();
142
- }
143
- return false;
144
- }
145
- goToRedirectUrl() {
146
- if (!this.router) {
147
- return;
148
- }
149
- const redirectUrl = this.redirectUrl || this.router.url;
150
- const options = this.config.getConfig('auth') || {};
151
- if (redirectUrl === options.loginRoute) {
152
- const homeRoute = options.homeRoute || '/';
153
- this.router.navigateByUrl(homeRoute);
154
- }
155
- else if (redirectUrl) {
156
- this.router.navigateByUrl(redirectUrl);
157
- }
158
- }
159
- getUserInfo() {
160
- const url = this.config.getConfig('auth.url') + '/info';
161
- return this.http.get(url);
162
- }
163
- getProfils() {
164
- const url = this.config.getConfig('auth.url');
165
- return this.http.get(`${url}/profils`);
166
- }
167
- updateUser(user) {
168
- const url = this.config.getConfig('auth.url');
169
- return this.http.patch(url, user);
170
- }
171
- encodePassword(password) {
172
- return Base64.encode(password);
173
- }
174
- // authenticated or anonymous
175
- get logged() {
176
- return this.authenticated || this.isAnonymous;
177
- }
178
- get isAnonymous() {
179
- return this.anonymous;
180
- }
181
- get authenticated() {
182
- return this.isAuthenticated();
183
- }
184
- get isAdmin() {
185
- const token = this.decodeToken();
186
- if (token && token.user && token.user.isAdmin) {
187
- return true;
188
- }
189
- return false;
190
- }
191
- loginCall(body, headers) {
192
- const url = this.config.getConfig('auth.url');
193
- return this.http.post(`${url}/login`, body, { headers }).pipe(tap((data) => {
194
- this.tokenService.set(data.token);
195
- const tokenDecoded = this.decodeToken();
196
- if (tokenDecoded && tokenDecoded.user) {
197
- if (tokenDecoded.user.locale && !this.languageForce) {
198
- this.languageService.setLanguage(tokenDecoded.user.locale);
199
- }
200
- if (tokenDecoded.user.isExpired) {
201
- this.messageService.alert('igo.auth.error.Password expired');
202
- }
203
- }
204
- this.authenticate$.next(true);
205
- }), catchError((err) => {
206
- err.error.caught = true;
207
- throw err;
208
- }));
209
- }
210
- }
211
- AuthService.ɵfac = function AuthService_Factory(t) { return new (t || AuthService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(TokenService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i2.LanguageService), i0.ɵɵinject(i2.MessageService), i0.ɵɵinject(i3.Router, 8)); };
212
- AuthService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthService, factory: AuthService.ɵfac, providedIn: 'root' });
213
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthService, [{
214
- type: Injectable,
215
- args: [{
216
- providedIn: 'root'
217
- }]
218
- }], function () { return [{ type: i1.HttpClient }, { type: TokenService }, { type: i2.ConfigService }, { type: i2.LanguageService }, { type: i2.MessageService }, { type: i3.Router, decorators: [{
219
- type: Optional
75
+ class AuthService {
76
+ constructor(http, tokenService, config, languageService, messageService, router) {
77
+ this.http = http;
78
+ this.tokenService = tokenService;
79
+ this.config = config;
80
+ this.languageService = languageService;
81
+ this.messageService = messageService;
82
+ this.router = router;
83
+ this.authenticate$ = new BehaviorSubject(undefined);
84
+ this.logged$ = new BehaviorSubject(undefined);
85
+ this.languageForce = false;
86
+ this.anonymous = false;
87
+ this.authenticate$.next(this.authenticated);
88
+ this.authenticate$.subscribe((authenticated) => {
89
+ this.logged$.next(authenticated);
90
+ globalCacheBusterNotifier.next();
91
+ });
92
+ }
93
+ get hasAuthService() {
94
+ return this.config.getConfig('auth.url') !== undefined;
95
+ }
96
+ login(username, password) {
97
+ const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });
98
+ const body = {
99
+ username,
100
+ password: this.encodePassword(password)
101
+ };
102
+ return this.loginCall(body, myHeader);
103
+ }
104
+ loginWithToken(token, type, infosUser) {
105
+ const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });
106
+ const body = {
107
+ token,
108
+ typeConnection: type,
109
+ infosUser
110
+ };
111
+ return this.loginCall(body, myHeader);
112
+ }
113
+ loginAnonymous() {
114
+ this.anonymous = true;
115
+ this.logged$.next(true);
116
+ return of(true);
117
+ }
118
+ refresh() {
119
+ const url = this.config.getConfig('auth.url');
120
+ return this.http.post(`${url}/refresh`, {}).pipe(tap((data) => {
121
+ this.tokenService.set(data.token);
122
+ }), catchError((err) => {
123
+ err.error.caught = true;
124
+ throw err;
125
+ }));
126
+ }
127
+ logout() {
128
+ this.anonymous = false;
129
+ this.tokenService.remove();
130
+ this.authenticate$.next(false);
131
+ return of(true);
132
+ }
133
+ isAuthenticated() {
134
+ return !this.tokenService.isExpired();
135
+ }
136
+ getToken() {
137
+ return this.tokenService.get();
138
+ }
139
+ decodeToken() {
140
+ if (this.isAuthenticated()) {
141
+ return this.tokenService.decode();
142
+ }
143
+ return false;
144
+ }
145
+ goToRedirectUrl() {
146
+ if (!this.router) {
147
+ return;
148
+ }
149
+ const redirectUrl = this.redirectUrl || this.router.url;
150
+ const options = this.config.getConfig('auth') || {};
151
+ if (redirectUrl === options.loginRoute) {
152
+ const homeRoute = options.homeRoute || '/';
153
+ this.router.navigateByUrl(homeRoute);
154
+ }
155
+ else if (redirectUrl) {
156
+ this.router.navigateByUrl(redirectUrl);
157
+ }
158
+ }
159
+ getUserInfo() {
160
+ const url = this.config.getConfig('auth.url') + '/info';
161
+ return this.http.get(url);
162
+ }
163
+ getProfils() {
164
+ const url = this.config.getConfig('auth.url');
165
+ return this.http.get(`${url}/profils`);
166
+ }
167
+ updateUser(user) {
168
+ const url = this.config.getConfig('auth.url');
169
+ return this.http.patch(url, user);
170
+ }
171
+ encodePassword(password) {
172
+ return Base64.encode(password);
173
+ }
174
+ // authenticated or anonymous
175
+ get logged() {
176
+ return this.authenticated || this.isAnonymous;
177
+ }
178
+ get isAnonymous() {
179
+ return this.anonymous;
180
+ }
181
+ get authenticated() {
182
+ return this.isAuthenticated();
183
+ }
184
+ get isAdmin() {
185
+ const token = this.decodeToken();
186
+ if (token && token.user && token.user.isAdmin) {
187
+ return true;
188
+ }
189
+ return false;
190
+ }
191
+ loginCall(body, headers) {
192
+ const url = this.config.getConfig('auth.url');
193
+ return this.http.post(`${url}/login`, body, { headers }).pipe(tap((data) => {
194
+ this.tokenService.set(data.token);
195
+ const tokenDecoded = this.decodeToken();
196
+ if (tokenDecoded && tokenDecoded.user) {
197
+ if (tokenDecoded.user.locale && !this.languageForce) {
198
+ this.languageService.setLanguage(tokenDecoded.user.locale);
199
+ }
200
+ if (tokenDecoded.user.isExpired) {
201
+ this.messageService.alert('igo.auth.error.Password expired');
202
+ }
203
+ }
204
+ this.authenticate$.next(true);
205
+ }), catchError((err) => {
206
+ err.error.caught = true;
207
+ throw err;
208
+ }));
209
+ }
210
+ }
211
+ AuthService.ɵfac = function AuthService_Factory(t) { return new (t || AuthService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(TokenService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i2.LanguageService), i0.ɵɵinject(i2.MessageService), i0.ɵɵinject(i3.Router, 8)); };
212
+ AuthService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthService, factory: AuthService.ɵfac, providedIn: 'root' });
213
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthService, [{
214
+ type: Injectable,
215
+ args: [{
216
+ providedIn: 'root'
217
+ }]
218
+ }], function () { return [{ type: i1.HttpClient }, { type: TokenService }, { type: i2.ConfigService }, { type: i2.LanguageService }, { type: i2.MessageService }, { type: i3.Router, decorators: [{
219
+ type: Optional
220
220
  }] }]; }, null); })();
221
221
 
222
- class AuthGoogleComponent {
223
- constructor(authService, config, languageService, appRef) {
224
- this.authService = authService;
225
- this.config = config;
226
- this.languageService = languageService;
227
- this.appRef = appRef;
228
- this.login = new EventEmitter();
229
- this.options = this.config.getConfig('auth.google') || {};
230
- if (this.options.apiKey && this.options.clientId) {
231
- this.loadSDKGoogle();
232
- this.loadPlatform();
233
- }
234
- else {
235
- console.warn('Google authentification needs "apiKey" and "clientId" options');
236
- }
237
- }
238
- handleSignInClick() {
239
- window.gapi.auth2.getAuthInstance().signIn();
240
- }
241
- handleSignOutClick() {
242
- window.gapi.auth2.getAuthInstance().signOut();
243
- }
244
- handleClientLoad() {
245
- window.gapi.load('client:auth2', () => this.initClient());
246
- }
247
- initClient() {
248
- window.gapi.client
249
- .init({
250
- apiKey: this.options.apiKey,
251
- clientId: this.options.clientId,
252
- discoveryDocs: [
253
- 'https://people.googleapis.com/$discovery/rest?version=v1'
254
- ],
255
- scope: 'profile'
256
- })
257
- .then(() => {
258
- this.handleSignOutClick();
259
- this.updateTextButton();
260
- window.gapi.auth2.getAuthInstance().isSignedIn.listen(rep => {
261
- this.updateSigninStatus(rep);
262
- });
263
- });
264
- }
265
- updateSigninStatus(isSignedIn) {
266
- this.updateTextButton();
267
- if (isSignedIn) {
268
- this.loginGoogle(window.gapi.client.getToken().access_token);
269
- }
270
- }
271
- updateTextButton() {
272
- const btn = document.querySelector('span[id^="not_signed_"]');
273
- if (btn && this.languageService.getLanguage() !== 'en') {
274
- if (btn.innerHTML === 'Sign in with Google') {
275
- btn.innerHTML = this.languageService.translate.instant('igo.auth.google.login');
276
- }
277
- else if (btn.innerHTML === 'Signed in with Google') {
278
- btn.innerHTML = this.languageService.translate.instant('igo.auth.google.logged');
279
- }
280
- }
281
- }
282
- loginGoogle(token) {
283
- this.authService.loginWithToken(token, 'google').subscribe(() => {
284
- this.appRef.tick();
285
- this.login.emit(true);
286
- });
287
- }
288
- loadSDKGoogle() {
289
- const fjs = document.getElementsByTagName('script')[0];
290
- const js = document.createElement('script');
291
- js.id = 'google-jssdk';
292
- js.src = 'https://apis.google.com/js/api.js';
293
- js.onload = () => {
294
- this.handleClientLoad();
295
- };
296
- fjs.parentNode.insertBefore(js, fjs);
297
- }
298
- loadPlatform() {
299
- const fjs = document.getElementsByTagName('script')[0];
300
- const js = document.createElement('script');
301
- js.id = 'google-platform';
302
- js.src = 'https://apis.google.com/js/platform.js';
303
- fjs.parentNode.insertBefore(js, fjs);
304
- }
305
- }
306
- AuthGoogleComponent.ɵfac = function AuthGoogleComponent_Factory(t) { return new (t || AuthGoogleComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i2.LanguageService), i0.ɵɵdirectiveInject(i0.ApplicationRef)); };
307
- AuthGoogleComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthGoogleComponent, selectors: [["igo-auth-google"]], outputs: { login: "login" }, decls: 1, vars: 0, consts: [["data-height", "40", "data-width", "265", "data-longtitle", "true", 1, "g-signin2", "google-login-button"]], template: function AuthGoogleComponent_Template(rf, ctx) { if (rf & 1) {
308
- i0.ɵɵelement(0, "div", 0);
309
- } }, styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block}.google-login-button[_ngcontent-%COMP%] .abcRioButton{color:#000000de}"], changeDetection: 0 });
310
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthGoogleComponent, [{
311
- type: Component,
312
- args: [{ selector: 'igo-auth-google', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"g-signin2 google-login-button\" data-height=\"40\" data-width=\"265\" data-longtitle=\"true\">\r\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block}.google-login-button ::ng-deep .abcRioButton{color:#000000de}\n"] }]
313
- }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i2.LanguageService }, { type: i0.ApplicationRef }]; }, { login: [{
314
- type: Output
222
+ class AuthGoogleComponent {
223
+ constructor(authService, config, languageService, appRef) {
224
+ this.authService = authService;
225
+ this.config = config;
226
+ this.languageService = languageService;
227
+ this.appRef = appRef;
228
+ this.login = new EventEmitter();
229
+ this.options = this.config.getConfig('auth.google') || {};
230
+ if (this.options.apiKey && this.options.clientId) {
231
+ this.loadSDKGoogle();
232
+ this.loadPlatform();
233
+ }
234
+ else {
235
+ console.warn('Google authentification needs "apiKey" and "clientId" options');
236
+ }
237
+ }
238
+ handleSignInClick() {
239
+ window.gapi.auth2.getAuthInstance().signIn();
240
+ }
241
+ handleSignOutClick() {
242
+ window.gapi.auth2.getAuthInstance().signOut();
243
+ }
244
+ handleClientLoad() {
245
+ window.gapi.load('client:auth2', () => this.initClient());
246
+ }
247
+ initClient() {
248
+ window.gapi.client
249
+ .init({
250
+ apiKey: this.options.apiKey,
251
+ clientId: this.options.clientId,
252
+ discoveryDocs: [
253
+ 'https://people.googleapis.com/$discovery/rest?version=v1'
254
+ ],
255
+ scope: 'profile'
256
+ })
257
+ .then(() => {
258
+ this.handleSignOutClick();
259
+ this.updateTextButton();
260
+ window.gapi.auth2.getAuthInstance().isSignedIn.listen(rep => {
261
+ this.updateSigninStatus(rep);
262
+ });
263
+ });
264
+ }
265
+ updateSigninStatus(isSignedIn) {
266
+ this.updateTextButton();
267
+ if (isSignedIn) {
268
+ this.loginGoogle(window.gapi.client.getToken().access_token);
269
+ }
270
+ }
271
+ updateTextButton() {
272
+ const btn = document.querySelector('span[id^="not_signed_"]');
273
+ if (btn && this.languageService.getLanguage() !== 'en') {
274
+ if (btn.innerHTML === 'Sign in with Google') {
275
+ btn.innerHTML = this.languageService.translate.instant('igo.auth.google.login');
276
+ }
277
+ else if (btn.innerHTML === 'Signed in with Google') {
278
+ btn.innerHTML = this.languageService.translate.instant('igo.auth.google.logged');
279
+ }
280
+ }
281
+ }
282
+ loginGoogle(token) {
283
+ this.authService.loginWithToken(token, 'google').subscribe(() => {
284
+ this.appRef.tick();
285
+ this.login.emit(true);
286
+ });
287
+ }
288
+ loadSDKGoogle() {
289
+ const fjs = document.getElementsByTagName('script')[0];
290
+ const js = document.createElement('script');
291
+ js.id = 'google-jssdk';
292
+ js.src = 'https://apis.google.com/js/api.js';
293
+ js.onload = () => {
294
+ this.handleClientLoad();
295
+ };
296
+ fjs.parentNode.insertBefore(js, fjs);
297
+ }
298
+ loadPlatform() {
299
+ const fjs = document.getElementsByTagName('script')[0];
300
+ const js = document.createElement('script');
301
+ js.id = 'google-platform';
302
+ js.src = 'https://apis.google.com/js/platform.js';
303
+ fjs.parentNode.insertBefore(js, fjs);
304
+ }
305
+ }
306
+ AuthGoogleComponent.ɵfac = function AuthGoogleComponent_Factory(t) { return new (t || AuthGoogleComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i2.LanguageService), i0.ɵɵdirectiveInject(i0.ApplicationRef)); };
307
+ AuthGoogleComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthGoogleComponent, selectors: [["igo-auth-google"]], outputs: { login: "login" }, decls: 1, vars: 0, consts: [["data-height", "40", "data-width", "265", "data-longtitle", "true", 1, "g-signin2", "google-login-button"]], template: function AuthGoogleComponent_Template(rf, ctx) { if (rf & 1) {
308
+ i0.ɵɵelement(0, "div", 0);
309
+ } }, styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block}.google-login-button[_ngcontent-%COMP%] .abcRioButton{color:#000000de}"], changeDetection: 0 });
310
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthGoogleComponent, [{
311
+ type: Component,
312
+ args: [{ selector: 'igo-auth-google', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"g-signin2 google-login-button\" data-height=\"40\" data-width=\"265\" data-longtitle=\"true\">\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block}.google-login-button ::ng-deep .abcRioButton{color:#000000de}\n"] }]
313
+ }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i2.LanguageService }, { type: i0.ApplicationRef }]; }, { login: [{
314
+ type: Output
315
315
  }] }); })();
316
316
 
317
- function AuthInternComponent_button_12_Template(rf, ctx) { if (rf & 1) {
318
- const _r3 = i0.ɵɵgetCurrentView();
319
- i0.ɵɵelementStart(0, "button", 7);
320
- i0.ɵɵlistener("click", function AuthInternComponent_button_12_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.loginAnonymous()); });
321
- i0.ɵɵtext(1);
322
- i0.ɵɵpipe(2, "translate");
323
- i0.ɵɵelementEnd();
324
- } if (rf & 2) {
325
- const ctx_r0 = i0.ɵɵnextContext();
326
- i0.ɵɵproperty("disabled", ctx_r0.loading);
327
- i0.ɵɵadvance(1);
328
- i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2, "igo.auth.accessAnonymous"), " ");
329
- } }
330
- function AuthInternComponent_div_13_Template(rf, ctx) { if (rf & 1) {
331
- i0.ɵɵelementStart(0, "div");
332
- i0.ɵɵelement(1, "br");
333
- i0.ɵɵelementStart(2, "font", 8);
334
- i0.ɵɵtext(3);
335
- i0.ɵɵelementEnd()();
336
- } if (rf & 2) {
337
- const ctx_r1 = i0.ɵɵnextContext();
338
- i0.ɵɵadvance(3);
339
- i0.ɵɵtextInterpolate(ctx_r1.error);
340
- } }
341
- class AuthInternComponent {
342
- constructor(auth, languageService, fb) {
343
- this.auth = auth;
344
- this.languageService = languageService;
345
- this._allowAnonymous = true;
346
- this.error = '';
347
- this.loading = false;
348
- this.login = new EventEmitter();
349
- this.form = fb.group({
350
- username: ['', Validators.required],
351
- password: ['', Validators.required]
352
- });
353
- }
354
- get allowAnonymous() {
355
- return this._allowAnonymous;
356
- }
357
- set allowAnonymous(value) {
358
- this._allowAnonymous = value;
359
- }
360
- loginUser(values) {
361
- this.loading = true;
362
- this.auth.login(values.username, values.password).subscribe(() => {
363
- this.login.emit(true);
364
- this.loading = false;
365
- }, (error) => {
366
- try {
367
- this.languageService.translate
368
- .get('igo.auth.error.' + error.error.message)
369
- .subscribe(errorMsg => (this.error = errorMsg));
370
- }
371
- catch (e) {
372
- this.error = error.error.message;
373
- }
374
- this.loading = false;
375
- });
376
- return false;
377
- }
378
- loginAnonymous() {
379
- this.auth.loginAnonymous().subscribe(() => {
380
- this.login.emit(true);
381
- });
382
- }
383
- }
384
- AuthInternComponent.ɵfac = function AuthInternComponent_Factory(t) { return new (t || AuthInternComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.LanguageService), i0.ɵɵdirectiveInject(i3$1.UntypedFormBuilder)); };
385
- AuthInternComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthInternComponent, selectors: [["igo-auth-intern"]], inputs: { allowAnonymous: "allowAnonymous" }, outputs: { login: "login" }, decls: 14, vars: 12, consts: [["role", "form", 3, "formGroup", "ngSubmit"], [1, "full-width"], ["matInput", "", "required", "", "formControlName", "username", 3, "placeholder"], ["matInput", "", "required", "", "type", "password", "formControlName", "password", 3, "placeholder"], ["mat-raised-button", "", "type", "submit"], ["mat-raised-button", "", "class", "anonymous", "type", "button", 3, "disabled", "click", 4, "ngIf"], [4, "ngIf"], ["mat-raised-button", "", "type", "button", 1, "anonymous", 3, "disabled", "click"], ["size", "3", "color", "red"]], template: function AuthInternComponent_Template(rf, ctx) { if (rf & 1) {
386
- i0.ɵɵelementStart(0, "form", 0);
387
- i0.ɵɵlistener("ngSubmit", function AuthInternComponent_Template_form_ngSubmit_0_listener() { return ctx.loginUser(ctx.form.value); });
388
- i0.ɵɵelementStart(1, "div")(2, "mat-form-field", 1);
389
- i0.ɵɵelement(3, "input", 2);
390
- i0.ɵɵpipe(4, "translate");
391
- i0.ɵɵelementEnd()();
392
- i0.ɵɵelementStart(5, "div")(6, "mat-form-field", 1);
393
- i0.ɵɵelement(7, "input", 3);
394
- i0.ɵɵpipe(8, "translate");
395
- i0.ɵɵelementEnd()();
396
- i0.ɵɵelementStart(9, "button", 4);
397
- i0.ɵɵtext(10);
398
- i0.ɵɵpipe(11, "translate");
399
- i0.ɵɵelementEnd();
400
- i0.ɵɵtemplate(12, AuthInternComponent_button_12_Template, 3, 4, "button", 5);
401
- i0.ɵɵtemplate(13, AuthInternComponent_div_13_Template, 4, 1, "div", 6);
402
- i0.ɵɵelementEnd();
403
- } if (rf & 2) {
404
- i0.ɵɵproperty("formGroup", ctx.form);
405
- i0.ɵɵadvance(3);
406
- i0.ɵɵpropertyInterpolate("placeholder", i0.ɵɵpipeBind1(4, 6, "igo.auth.user"));
407
- i0.ɵɵadvance(4);
408
- i0.ɵɵpropertyInterpolate("placeholder", i0.ɵɵpipeBind1(8, 8, "igo.auth.password"));
409
- i0.ɵɵadvance(3);
410
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(11, 10, "igo.auth.login"));
411
- i0.ɵɵadvance(2);
412
- i0.ɵɵproperty("ngIf", ctx.allowAnonymous);
413
- i0.ɵɵadvance(1);
414
- i0.ɵɵproperty("ngIf", ctx.error);
415
- } }, dependencies: [i1$1.NgIf, i3$1.ɵNgNoValidate, i3$1.DefaultValueAccessor, i3$1.NgControlStatus, i3$1.NgControlStatusGroup, i3$1.RequiredValidator, i3$1.FormGroupDirective, i3$1.FormControlName, i5.MatFormField, i6.MatInput, i5$1.MatButton, i6$1.TranslatePipe], styles: [".full-width[_ngcontent-%COMP%]{width:100%}.anonymous[_ngcontent-%COMP%]{margin-left:10px}"] });
416
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthInternComponent, [{
417
- type: Component,
418
- args: [{ selector: 'igo-auth-intern', changeDetection: ChangeDetectionStrategy.Default, template: "<form [formGroup]=\"form\" role=\"form\" (ngSubmit)=\"loginUser(form.value)\">\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <input matInput required placeholder=\"{{'igo.auth.user' | translate}}\" formControlName=\"username\">\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <input matInput required type=\"password\" placeholder=\"{{'igo.auth.password' | translate}}\" formControlName=\"password\">\r\n </mat-form-field>\r\n </div>\r\n\r\n <button mat-raised-button type=\"submit\">{{'igo.auth.login' | translate}}</button>\r\n <button *ngIf=\"allowAnonymous\" mat-raised-button class=\"anonymous\" type=\"button\" [disabled]=\"loading\" (click)=\"loginAnonymous()\">\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<!--\r\nThis part was removed from the below line to fix Angular issue 30616 : [disabled]=\"!form.valid || loading\r\n <button mat-raised-button type=\"submit\" [disabled]=\"!form.valid || loading\">{{'igo.auth.login' | translate}}</button>*/\r\n-->\r\n", styles: [".full-width{width:100%}.anonymous{margin-left:10px}\n"] }]
419
- }], function () { return [{ type: AuthService }, { type: i2.LanguageService }, { type: i3$1.UntypedFormBuilder }]; }, { allowAnonymous: [{
420
- type: Input
421
- }], login: [{
422
- type: Output
317
+ function AuthInternComponent_button_12_Template(rf, ctx) { if (rf & 1) {
318
+ const _r3 = i0.ɵɵgetCurrentView();
319
+ i0.ɵɵelementStart(0, "button", 7);
320
+ i0.ɵɵlistener("click", function AuthInternComponent_button_12_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.loginAnonymous()); });
321
+ i0.ɵɵtext(1);
322
+ i0.ɵɵpipe(2, "translate");
323
+ i0.ɵɵelementEnd();
324
+ } if (rf & 2) {
325
+ const ctx_r0 = i0.ɵɵnextContext();
326
+ i0.ɵɵproperty("disabled", ctx_r0.loading);
327
+ i0.ɵɵadvance(1);
328
+ i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2, "igo.auth.accessAnonymous"), " ");
329
+ } }
330
+ function AuthInternComponent_div_13_Template(rf, ctx) { if (rf & 1) {
331
+ i0.ɵɵelementStart(0, "div");
332
+ i0.ɵɵelement(1, "br");
333
+ i0.ɵɵelementStart(2, "font", 8);
334
+ i0.ɵɵtext(3);
335
+ i0.ɵɵelementEnd()();
336
+ } if (rf & 2) {
337
+ const ctx_r1 = i0.ɵɵnextContext();
338
+ i0.ɵɵadvance(3);
339
+ i0.ɵɵtextInterpolate(ctx_r1.error);
340
+ } }
341
+ class AuthInternComponent {
342
+ constructor(auth, languageService, fb) {
343
+ this.auth = auth;
344
+ this.languageService = languageService;
345
+ this._allowAnonymous = true;
346
+ this.error = '';
347
+ this.loading = false;
348
+ this.login = new EventEmitter();
349
+ this.form = fb.group({
350
+ username: ['', Validators.required],
351
+ password: ['', Validators.required]
352
+ });
353
+ }
354
+ get allowAnonymous() {
355
+ return this._allowAnonymous;
356
+ }
357
+ set allowAnonymous(value) {
358
+ this._allowAnonymous = value;
359
+ }
360
+ loginUser(values) {
361
+ this.loading = true;
362
+ this.auth.login(values.username, values.password).subscribe(() => {
363
+ this.login.emit(true);
364
+ this.loading = false;
365
+ }, (error) => {
366
+ try {
367
+ this.languageService.translate
368
+ .get('igo.auth.error.' + error.error.message)
369
+ .subscribe(errorMsg => (this.error = errorMsg));
370
+ }
371
+ catch (e) {
372
+ this.error = error.error.message;
373
+ }
374
+ this.loading = false;
375
+ });
376
+ return false;
377
+ }
378
+ loginAnonymous() {
379
+ this.auth.loginAnonymous().subscribe(() => {
380
+ this.login.emit(true);
381
+ });
382
+ }
383
+ }
384
+ AuthInternComponent.ɵfac = function AuthInternComponent_Factory(t) { return new (t || AuthInternComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.LanguageService), i0.ɵɵdirectiveInject(i3$1.UntypedFormBuilder)); };
385
+ AuthInternComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthInternComponent, selectors: [["igo-auth-intern"]], inputs: { allowAnonymous: "allowAnonymous" }, outputs: { login: "login" }, decls: 14, vars: 12, consts: [["role", "form", 3, "formGroup", "ngSubmit"], [1, "full-width"], ["matInput", "", "required", "", "formControlName", "username", 3, "placeholder"], ["matInput", "", "required", "", "type", "password", "formControlName", "password", 3, "placeholder"], ["mat-raised-button", "", "type", "submit"], ["mat-raised-button", "", "class", "anonymous", "type", "button", 3, "disabled", "click", 4, "ngIf"], [4, "ngIf"], ["mat-raised-button", "", "type", "button", 1, "anonymous", 3, "disabled", "click"], ["size", "3", "color", "red"]], template: function AuthInternComponent_Template(rf, ctx) { if (rf & 1) {
386
+ i0.ɵɵelementStart(0, "form", 0);
387
+ i0.ɵɵlistener("ngSubmit", function AuthInternComponent_Template_form_ngSubmit_0_listener() { return ctx.loginUser(ctx.form.value); });
388
+ i0.ɵɵelementStart(1, "div")(2, "mat-form-field", 1);
389
+ i0.ɵɵelement(3, "input", 2);
390
+ i0.ɵɵpipe(4, "translate");
391
+ i0.ɵɵelementEnd()();
392
+ i0.ɵɵelementStart(5, "div")(6, "mat-form-field", 1);
393
+ i0.ɵɵelement(7, "input", 3);
394
+ i0.ɵɵpipe(8, "translate");
395
+ i0.ɵɵelementEnd()();
396
+ i0.ɵɵelementStart(9, "button", 4);
397
+ i0.ɵɵtext(10);
398
+ i0.ɵɵpipe(11, "translate");
399
+ i0.ɵɵelementEnd();
400
+ i0.ɵɵtemplate(12, AuthInternComponent_button_12_Template, 3, 4, "button", 5);
401
+ i0.ɵɵtemplate(13, AuthInternComponent_div_13_Template, 4, 1, "div", 6);
402
+ i0.ɵɵelementEnd();
403
+ } if (rf & 2) {
404
+ i0.ɵɵproperty("formGroup", ctx.form);
405
+ i0.ɵɵadvance(3);
406
+ i0.ɵɵpropertyInterpolate("placeholder", i0.ɵɵpipeBind1(4, 6, "igo.auth.user"));
407
+ i0.ɵɵadvance(4);
408
+ i0.ɵɵpropertyInterpolate("placeholder", i0.ɵɵpipeBind1(8, 8, "igo.auth.password"));
409
+ i0.ɵɵadvance(3);
410
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(11, 10, "igo.auth.login"));
411
+ i0.ɵɵadvance(2);
412
+ i0.ɵɵproperty("ngIf", ctx.allowAnonymous);
413
+ i0.ɵɵadvance(1);
414
+ i0.ɵɵproperty("ngIf", ctx.error);
415
+ } }, dependencies: [i1$1.NgIf, i3$1.ɵNgNoValidate, i3$1.DefaultValueAccessor, i3$1.NgControlStatus, i3$1.NgControlStatusGroup, i3$1.RequiredValidator, i3$1.FormGroupDirective, i3$1.FormControlName, i5.MatFormField, i6.MatInput, i5$1.MatButton, i6$1.TranslatePipe], styles: [".full-width[_ngcontent-%COMP%]{width:100%}.anonymous[_ngcontent-%COMP%]{margin-left:10px}"] });
416
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthInternComponent, [{
417
+ type: Component,
418
+ args: [{ selector: 'igo-auth-intern', changeDetection: ChangeDetectionStrategy.Default, template: "<form [formGroup]=\"form\" role=\"form\" (ngSubmit)=\"loginUser(form.value)\">\n <div>\n <mat-form-field class=\"full-width\">\n <input matInput required placeholder=\"{{'igo.auth.user' | translate}}\" formControlName=\"username\">\n </mat-form-field>\n </div>\n\n <div>\n <mat-form-field class=\"full-width\">\n <input matInput required type=\"password\" placeholder=\"{{'igo.auth.password' | translate}}\" formControlName=\"password\">\n </mat-form-field>\n </div>\n\n <button mat-raised-button type=\"submit\">{{'igo.auth.login' | translate}}</button>\n <button *ngIf=\"allowAnonymous\" mat-raised-button class=\"anonymous\" type=\"button\" [disabled]=\"loading\" (click)=\"loginAnonymous()\">\n {{'igo.auth.accessAnonymous' | translate }}\n </button>\n <div *ngIf=\"error\">\n <br/>\n <font size=\"3\" color=\"red\">{{error}}</font>\n </div>\n</form>\n\n<!--\nThis part was removed from the below line to fix Angular issue 30616 : [disabled]=\"!form.valid || loading\n <button mat-raised-button type=\"submit\" [disabled]=\"!form.valid || loading\">{{'igo.auth.login' | translate}}</button>*/\n-->\n", styles: [".full-width{width:100%}.anonymous{margin-left:10px}\n"] }]
419
+ }], function () { return [{ type: AuthService }, { type: i2.LanguageService }, { type: i3$1.UntypedFormBuilder }]; }, { allowAnonymous: [{
420
+ type: Input
421
+ }], login: [{
422
+ type: Output
423
423
  }] }); })();
424
424
 
425
- class AuthFacebookComponent {
426
- constructor(authService, config, appRef) {
427
- this.authService = authService;
428
- this.config = config;
429
- this.appRef = appRef;
430
- this.login = new EventEmitter();
431
- this.options = this.config.getConfig('auth.facebook') || {};
432
- if (this.options.appId) {
433
- this.loadSDKFacebook();
434
- }
435
- else {
436
- console.warn('Facebook authentification needs "appId" option');
437
- }
438
- }
439
- subscribeEvents() {
440
- window.FB.Event.subscribe('auth.statusChange', rep => {
441
- this.statusChangeCallback(rep);
442
- });
443
- }
444
- statusChangeCallback(response) {
445
- if (response.status === 'connected') {
446
- const accessToken = response.authResponse.accessToken;
447
- this.loginFacebook(accessToken);
448
- }
449
- }
450
- loginFacebook(token) {
451
- this.authService.loginWithToken(token, 'facebook').subscribe(() => {
452
- this.appRef.tick();
453
- this.login.emit(true);
454
- });
455
- }
456
- loadSDKFacebook() {
457
- if (document.getElementById('facebook-jssdk')) {
458
- return;
459
- }
460
- const urlSDK = 'https://connect.facebook.net/fr_CA/sdk.js#xfbml=1&version=v2.9';
461
- const fjs = document.getElementsByTagName('script')[0];
462
- const js = document.createElement('script');
463
- js.id = 'facebook-jssdk';
464
- js.src = `${urlSDK}&appId=${this.options.appId}`;
465
- js.onload = () => {
466
- this.subscribeEvents();
467
- };
468
- fjs.parentNode.insertBefore(js, fjs);
469
- }
470
- }
471
- AuthFacebookComponent.ɵfac = function AuthFacebookComponent_Factory(t) { return new (t || AuthFacebookComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef)); };
472
- AuthFacebookComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthFacebookComponent, selectors: [["igo-auth-facebook"]], outputs: { login: "login" }, decls: 1, vars: 0, consts: [["scope", "public_profile,email", "data-max-rows", "1", "data-size", "large", "data-button-type", "login_with", "data-show-faces", "false", "data-auto-logout-link", "false", "data-use-continue-as", "false", 1, "fb-login-button"]], template: function AuthFacebookComponent_Template(rf, ctx) { if (rf & 1) {
473
- i0.ɵɵelement(0, "div", 0);
474
- } }, styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}"], changeDetection: 0 });
475
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthFacebookComponent, [{
476
- type: Component,
477
- args: [{ selector: 'igo-auth-facebook', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div scope=\"public_profile,email\"\r\n class=\"fb-login-button\" data-max-rows=\"1\" data-size=\"large\"\r\n data-button-type=\"login_with\" data-show-faces=\"false\"\r\n data-auto-logout-link=\"false\" 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"] }]
478
- }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }]; }, { login: [{
479
- type: Output
425
+ class AuthFacebookComponent {
426
+ constructor(authService, config, appRef) {
427
+ this.authService = authService;
428
+ this.config = config;
429
+ this.appRef = appRef;
430
+ this.login = new EventEmitter();
431
+ this.options = this.config.getConfig('auth.facebook') || {};
432
+ if (this.options.appId) {
433
+ this.loadSDKFacebook();
434
+ }
435
+ else {
436
+ console.warn('Facebook authentification needs "appId" option');
437
+ }
438
+ }
439
+ subscribeEvents() {
440
+ window.FB.Event.subscribe('auth.statusChange', rep => {
441
+ this.statusChangeCallback(rep);
442
+ });
443
+ }
444
+ statusChangeCallback(response) {
445
+ if (response.status === 'connected') {
446
+ const accessToken = response.authResponse.accessToken;
447
+ this.loginFacebook(accessToken);
448
+ }
449
+ }
450
+ loginFacebook(token) {
451
+ this.authService.loginWithToken(token, 'facebook').subscribe(() => {
452
+ this.appRef.tick();
453
+ this.login.emit(true);
454
+ });
455
+ }
456
+ loadSDKFacebook() {
457
+ if (document.getElementById('facebook-jssdk')) {
458
+ return;
459
+ }
460
+ const urlSDK = 'https://connect.facebook.net/fr_CA/sdk.js#xfbml=1&version=v2.9';
461
+ const fjs = document.getElementsByTagName('script')[0];
462
+ const js = document.createElement('script');
463
+ js.id = 'facebook-jssdk';
464
+ js.src = `${urlSDK}&appId=${this.options.appId}`;
465
+ js.onload = () => {
466
+ this.subscribeEvents();
467
+ };
468
+ fjs.parentNode.insertBefore(js, fjs);
469
+ }
470
+ }
471
+ AuthFacebookComponent.ɵfac = function AuthFacebookComponent_Factory(t) { return new (t || AuthFacebookComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef)); };
472
+ AuthFacebookComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthFacebookComponent, selectors: [["igo-auth-facebook"]], outputs: { login: "login" }, decls: 1, vars: 0, consts: [["scope", "public_profile,email", "data-max-rows", "1", "data-size", "large", "data-button-type", "login_with", "data-show-faces", "false", "data-auto-logout-link", "false", "data-use-continue-as", "false", 1, "fb-login-button"]], template: function AuthFacebookComponent_Template(rf, ctx) { if (rf & 1) {
473
+ i0.ɵɵelement(0, "div", 0);
474
+ } }, styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}"], changeDetection: 0 });
475
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthFacebookComponent, [{
476
+ type: Component,
477
+ args: [{ selector: 'igo-auth-facebook', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div scope=\"public_profile,email\"\n class=\"fb-login-button\" data-max-rows=\"1\" data-size=\"large\"\n data-button-type=\"login_with\" data-show-faces=\"false\"\n data-auto-logout-link=\"false\" data-use-continue-as=\"false\">\n</div>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}\n"] }]
478
+ }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }]; }, { login: [{
479
+ type: Output
480
480
  }] }); })();
481
481
 
482
- class AuthMicrosoftComponent {
483
- constructor(authService, config, appRef, msalService, msalGuardConfig) {
484
- this.authService = authService;
485
- this.config = config;
486
- this.appRef = appRef;
487
- this.msalService = msalService;
488
- this.msalGuardConfig = msalGuardConfig;
489
- this._destroying$ = new Subject();
490
- this.login = new EventEmitter();
491
- this.options = this.config.getConfig('auth.microsoft') || {};
492
- this.msalService.instance = new PublicClientApplication({
493
- auth: this.options,
494
- cache: {
495
- cacheLocation: 'sessionStorage'
496
- }
497
- });
498
- this.broadcastService = new MsalBroadcastService(this.msalService.instance, this.msalService);
499
- if (this.options.clientId) {
500
- this.broadcastService.inProgress$
501
- .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
502
- .subscribe(() => {
503
- this.checkAccount();
504
- });
505
- }
506
- else {
507
- console.warn('Microsoft authentification needs "clientId" option');
508
- }
509
- }
510
- loginMicrosoft() {
511
- this.msalService.loginPopup({ ...this.getConf().authRequest })
512
- .subscribe((response) => {
513
- this.msalService.instance.setActiveAccount(response.account);
514
- this.checkAccount();
515
- });
516
- }
517
- checkAccount() {
518
- this.msalService.instance
519
- .acquireTokenSilent(this.getConf().authRequest)
520
- .then((response) => {
521
- const tokenAccess = response.accessToken;
522
- const tokenId = response.idToken;
523
- this.authService.loginWithToken(tokenAccess, 'microsoft', { tokenId }).subscribe(() => {
524
- this.appRef.tick();
525
- this.login.emit(true);
526
- });
527
- })
528
- .catch(async (error) => {
529
- if (error instanceof InteractionRequiredAuthError) {
530
- // fallback to interaction when silent call fails
531
- return this.msalService.acquireTokenPopup(this.getConf().authRequest);
532
- }
533
- console.log(error);
534
- }).catch(error => {
535
- console.log('Silent token fails');
536
- });
537
- }
538
- getConf() {
539
- return this.msalGuardConfig.filter(conf => conf.type === 'add')[0];
540
- }
541
- }
542
- AuthMicrosoftComponent.ɵfac = function AuthMicrosoftComponent_Factory(t) { return new (t || AuthMicrosoftComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef), i0.ɵɵdirectiveInject(i3$2.MsalService), i0.ɵɵdirectiveInject(MSAL_GUARD_CONFIG)); };
543
- AuthMicrosoftComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthMicrosoftComponent, selectors: [["igo-auth-microsoft"]], outputs: { login: "login" }, decls: 4, vars: 3, consts: [["mat-raised-button", "", 1, "microsoft-login-button", 3, "click"], ["svgIcon", "microsoft"]], template: function AuthMicrosoftComponent_Template(rf, ctx) { if (rf & 1) {
544
- i0.ɵɵelementStart(0, "button", 0);
545
- i0.ɵɵlistener("click", function AuthMicrosoftComponent_Template_button_click_0_listener() { return ctx.loginMicrosoft(); });
546
- i0.ɵɵelement(1, "mat-icon", 1);
547
- i0.ɵɵtext(2);
548
- i0.ɵɵpipe(3, "translate");
549
- i0.ɵɵelementEnd();
550
- } if (rf & 2) {
551
- i0.ɵɵadvance(2);
552
- i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "igo.auth.microsoft.login"), "\n");
553
- } }, dependencies: [i4.MatIcon, i5$1.MatButton, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}[_nghost-%COMP%] > button[_ngcontent-%COMP%]{font-size:15px;height:40px;width:265px}mat-icon[_ngcontent-%COMP%]{margin-right:10px}"], changeDetection: 0 });
554
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthMicrosoftComponent, [{
555
- type: Component,
556
- args: [{ selector: 'igo-auth-microsoft', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button class=\"microsoft-login-button\" mat-raised-button (click)=\"loginMicrosoft()\">\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"] }]
557
- }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: i3$2.MsalService }, { type: undefined, decorators: [{
558
- type: Inject,
559
- args: [MSAL_GUARD_CONFIG]
560
- }] }]; }, { login: [{
561
- type: Output
482
+ class AuthMicrosoftComponent {
483
+ constructor(authService, config, appRef, msalService, msalGuardConfig) {
484
+ this.authService = authService;
485
+ this.config = config;
486
+ this.appRef = appRef;
487
+ this.msalService = msalService;
488
+ this.msalGuardConfig = msalGuardConfig;
489
+ this._destroying$ = new Subject();
490
+ this.login = new EventEmitter();
491
+ this.options = this.config.getConfig('auth.microsoft') || {};
492
+ this.msalService.instance = new PublicClientApplication({
493
+ auth: this.options,
494
+ cache: {
495
+ cacheLocation: 'sessionStorage'
496
+ }
497
+ });
498
+ this.broadcastService = new MsalBroadcastService(this.msalService.instance, this.msalService);
499
+ if (this.options.clientId) {
500
+ this.broadcastService.inProgress$
501
+ .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
502
+ .subscribe(() => {
503
+ this.checkAccount();
504
+ });
505
+ }
506
+ else {
507
+ console.warn('Microsoft authentification needs "clientId" option');
508
+ }
509
+ }
510
+ loginMicrosoft() {
511
+ this.msalService.loginPopup({ ...this.getConf().authRequest })
512
+ .subscribe((response) => {
513
+ this.msalService.instance.setActiveAccount(response.account);
514
+ this.checkAccount();
515
+ });
516
+ }
517
+ checkAccount() {
518
+ this.msalService.instance
519
+ .acquireTokenSilent(this.getConf().authRequest)
520
+ .then((response) => {
521
+ const tokenAccess = response.accessToken;
522
+ const tokenId = response.idToken;
523
+ this.authService.loginWithToken(tokenAccess, 'microsoft', { tokenId }).subscribe(() => {
524
+ this.appRef.tick();
525
+ this.login.emit(true);
526
+ });
527
+ })
528
+ .catch(async (error) => {
529
+ if (error instanceof InteractionRequiredAuthError) {
530
+ // fallback to interaction when silent call fails
531
+ return this.msalService.acquireTokenPopup(this.getConf().authRequest);
532
+ }
533
+ console.log(error);
534
+ }).catch(error => {
535
+ console.log('Silent token fails');
536
+ });
537
+ }
538
+ getConf() {
539
+ return this.msalGuardConfig.filter(conf => conf.type === 'add')[0];
540
+ }
541
+ }
542
+ AuthMicrosoftComponent.ɵfac = function AuthMicrosoftComponent_Factory(t) { return new (t || AuthMicrosoftComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef), i0.ɵɵdirectiveInject(i3$2.MsalService), i0.ɵɵdirectiveInject(MSAL_GUARD_CONFIG)); };
543
+ AuthMicrosoftComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthMicrosoftComponent, selectors: [["igo-auth-microsoft"]], outputs: { login: "login" }, decls: 4, vars: 3, consts: [["mat-raised-button", "", 1, "microsoft-login-button", 3, "click"], ["svgIcon", "microsoft"]], template: function AuthMicrosoftComponent_Template(rf, ctx) { if (rf & 1) {
544
+ i0.ɵɵelementStart(0, "button", 0);
545
+ i0.ɵɵlistener("click", function AuthMicrosoftComponent_Template_button_click_0_listener() { return ctx.loginMicrosoft(); });
546
+ i0.ɵɵelement(1, "mat-icon", 1);
547
+ i0.ɵɵtext(2);
548
+ i0.ɵɵpipe(3, "translate");
549
+ i0.ɵɵelementEnd();
550
+ } if (rf & 2) {
551
+ i0.ɵɵadvance(2);
552
+ i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "igo.auth.microsoft.login"), "\n");
553
+ } }, dependencies: [i4.MatIcon, i5$1.MatButton, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}[_nghost-%COMP%] > button[_ngcontent-%COMP%]{font-size:15px;height:40px;width:265px}mat-icon[_ngcontent-%COMP%]{margin-right:10px}"], changeDetection: 0 });
554
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthMicrosoftComponent, [{
555
+ type: Component,
556
+ args: [{ selector: 'igo-auth-microsoft', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button class=\"microsoft-login-button\" mat-raised-button (click)=\"loginMicrosoft()\">\n <mat-icon svgIcon=\"microsoft\"></mat-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"] }]
557
+ }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: i3$2.MsalService }, { type: undefined, decorators: [{
558
+ type: Inject,
559
+ args: [MSAL_GUARD_CONFIG]
560
+ }] }]; }, { login: [{
561
+ type: Output
562
562
  }] }); })();
563
563
 
564
- /*
565
- * Copyright (c) Microsoft Corporation. All rights reserved.
566
- * Licensed under the MIT License.
567
- */
568
- class MsalServiceb2c {
569
- constructor(instance, location) {
570
- this.instance = instance;
571
- this.location = location;
572
- this.name = '@azure/msal-angular';
573
- this.version = '2.0.0-beta.2';
574
- const hash = this.location.path(true).split('#').pop();
575
- if (hash) {
576
- this.redirectHash = `#${hash}`;
577
- }
578
- this.instance.initializeWrapperLibrary(WrapperSKU.Angular, this.version);
579
- }
580
- initialize() {
581
- return from(this.instance.initialize());
582
- }
583
- acquireTokenPopup(request) {
584
- return from(this.instance.acquireTokenPopup(request));
585
- }
586
- acquireTokenRedirect(request) {
587
- return from(this.instance.acquireTokenRedirect(request));
588
- }
589
- acquireTokenSilent(silentRequest) {
590
- return from(this.instance.acquireTokenSilent(silentRequest));
591
- }
592
- handleRedirectObservable(hash) {
593
- return from(this.instance.handleRedirectPromise(hash || this.redirectHash));
594
- }
595
- loginPopup(request) {
596
- return from(this.instance.loginPopup(request));
597
- }
598
- loginRedirect(request) {
599
- return from(this.instance.loginRedirect(request));
600
- }
601
- logout(logoutRequest) {
602
- return from(this.instance.logout(logoutRequest));
603
- }
604
- logoutRedirect(logoutRequest) {
605
- return from(this.instance.logoutRedirect(logoutRequest));
606
- }
607
- logoutPopup(logoutRequest) {
608
- return from(this.instance.logoutPopup(logoutRequest));
609
- }
610
- ssoSilent(request) {
611
- return from(this.instance.ssoSilent(request));
612
- }
613
- /**
614
- * Gets logger for msal-angular.
615
- * If no logger set, returns logger instance created with same options as msal-browser
616
- */
617
- getLogger() {
618
- if (!this.logger) {
619
- this.logger = this.instance.getLogger().clone(this.name, this.version);
620
- }
621
- return this.logger;
622
- }
623
- // Create a logger instance for msal-angular with the same options as msal-browser
624
- setLogger(logger) {
625
- this.logger = logger.clone(this.name, this.version);
626
- this.instance.setLogger(logger);
627
- }
628
- }
629
- MsalServiceb2c.ɵfac = function MsalServiceb2c_Factory(t) { return new (t || MsalServiceb2c)(i0.ɵɵinject(MSAL_INSTANCE), i0.ɵɵinject(i1$1.Location)); };
630
- MsalServiceb2c.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MsalServiceb2c, factory: MsalServiceb2c.ɵfac });
631
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MsalServiceb2c, [{
632
- type: Injectable
633
- }], function () { return [{ type: undefined, decorators: [{
634
- type: Inject,
635
- args: [MSAL_INSTANCE]
564
+ /*
565
+ * Copyright (c) Microsoft Corporation. All rights reserved.
566
+ * Licensed under the MIT License.
567
+ */
568
+ class MsalServiceb2c {
569
+ constructor(instance, location) {
570
+ this.instance = instance;
571
+ this.location = location;
572
+ this.name = '@azure/msal-angular';
573
+ this.version = '2.0.0-beta.2';
574
+ const hash = this.location.path(true).split('#').pop();
575
+ if (hash) {
576
+ this.redirectHash = `#${hash}`;
577
+ }
578
+ this.instance.initializeWrapperLibrary(WrapperSKU.Angular, this.version);
579
+ }
580
+ initialize() {
581
+ return from(this.instance.initialize());
582
+ }
583
+ acquireTokenPopup(request) {
584
+ return from(this.instance.acquireTokenPopup(request));
585
+ }
586
+ acquireTokenRedirect(request) {
587
+ return from(this.instance.acquireTokenRedirect(request));
588
+ }
589
+ acquireTokenSilent(silentRequest) {
590
+ return from(this.instance.acquireTokenSilent(silentRequest));
591
+ }
592
+ handleRedirectObservable(hash) {
593
+ return from(this.instance.handleRedirectPromise(hash || this.redirectHash));
594
+ }
595
+ loginPopup(request) {
596
+ return from(this.instance.loginPopup(request));
597
+ }
598
+ loginRedirect(request) {
599
+ return from(this.instance.loginRedirect(request));
600
+ }
601
+ logout(logoutRequest) {
602
+ return from(this.instance.logout(logoutRequest));
603
+ }
604
+ logoutRedirect(logoutRequest) {
605
+ return from(this.instance.logoutRedirect(logoutRequest));
606
+ }
607
+ logoutPopup(logoutRequest) {
608
+ return from(this.instance.logoutPopup(logoutRequest));
609
+ }
610
+ ssoSilent(request) {
611
+ return from(this.instance.ssoSilent(request));
612
+ }
613
+ /**
614
+ * Gets logger for msal-angular.
615
+ * If no logger set, returns logger instance created with same options as msal-browser
616
+ */
617
+ getLogger() {
618
+ if (!this.logger) {
619
+ this.logger = this.instance.getLogger().clone(this.name, this.version);
620
+ }
621
+ return this.logger;
622
+ }
623
+ // Create a logger instance for msal-angular with the same options as msal-browser
624
+ setLogger(logger) {
625
+ this.logger = logger.clone(this.name, this.version);
626
+ this.instance.setLogger(logger);
627
+ }
628
+ }
629
+ MsalServiceb2c.ɵfac = function MsalServiceb2c_Factory(t) { return new (t || MsalServiceb2c)(i0.ɵɵinject(MSAL_INSTANCE), i0.ɵɵinject(i1$1.Location)); };
630
+ MsalServiceb2c.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MsalServiceb2c, factory: MsalServiceb2c.ɵfac });
631
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MsalServiceb2c, [{
632
+ type: Injectable
633
+ }], function () { return [{ type: undefined, decorators: [{
634
+ type: Inject,
635
+ args: [MSAL_INSTANCE]
636
636
  }] }, { type: i1$1.Location }]; }, null); })();
637
637
 
638
- /*
639
- * Copyright (c) Microsoft Corporation. All rights reserved.
640
- * Licensed under the MIT License.
641
- */
642
- class MsalBroadcastServiceb2c {
643
- constructor(msalInstance, authService) {
644
- this.msalInstance = msalInstance;
645
- this.authService = authService;
646
- this._msalSubject = new Subject();
647
- this.msalSubject$ = this._msalSubject.asObservable();
648
- // InProgress as BehaviorSubject so most recent inProgress state will be available upon subscription
649
- this._inProgress = new BehaviorSubject(InteractionStatus.Startup);
650
- this.inProgress$ = this._inProgress.asObservable();
651
- this.msalInstance.addEventCallback((message) => {
652
- this._msalSubject.next(message);
653
- const status = EventMessageUtils.getInteractionStatusFromEvent(message);
654
- if (status !== null) {
655
- this.authService.getLogger().verbose(`BroadcastService - ${message.eventType} results in setting inProgress to ${status}`);
656
- this._inProgress.next(status);
657
- }
658
- });
659
- }
660
- }
661
- MsalBroadcastServiceb2c.ɵfac = function MsalBroadcastServiceb2c_Factory(t) { return new (t || MsalBroadcastServiceb2c)(i0.ɵɵinject(MSAL_INSTANCE), i0.ɵɵinject(MsalServiceb2c)); };
662
- MsalBroadcastServiceb2c.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MsalBroadcastServiceb2c, factory: MsalBroadcastServiceb2c.ɵfac });
663
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MsalBroadcastServiceb2c, [{
664
- type: Injectable
665
- }], function () { return [{ type: undefined, decorators: [{
666
- type: Inject,
667
- args: [MSAL_INSTANCE]
638
+ /*
639
+ * Copyright (c) Microsoft Corporation. All rights reserved.
640
+ * Licensed under the MIT License.
641
+ */
642
+ class MsalBroadcastServiceb2c {
643
+ constructor(msalInstance, authService) {
644
+ this.msalInstance = msalInstance;
645
+ this.authService = authService;
646
+ this._msalSubject = new Subject();
647
+ this.msalSubject$ = this._msalSubject.asObservable();
648
+ // InProgress as BehaviorSubject so most recent inProgress state will be available upon subscription
649
+ this._inProgress = new BehaviorSubject(InteractionStatus.Startup);
650
+ this.inProgress$ = this._inProgress.asObservable();
651
+ this.msalInstance.addEventCallback((message) => {
652
+ this._msalSubject.next(message);
653
+ const status = EventMessageUtils.getInteractionStatusFromEvent(message);
654
+ if (status !== null) {
655
+ this.authService.getLogger().verbose(`BroadcastService - ${message.eventType} results in setting inProgress to ${status}`);
656
+ this._inProgress.next(status);
657
+ }
658
+ });
659
+ }
660
+ }
661
+ MsalBroadcastServiceb2c.ɵfac = function MsalBroadcastServiceb2c_Factory(t) { return new (t || MsalBroadcastServiceb2c)(i0.ɵɵinject(MSAL_INSTANCE), i0.ɵɵinject(MsalServiceb2c)); };
662
+ MsalBroadcastServiceb2c.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MsalBroadcastServiceb2c, factory: MsalBroadcastServiceb2c.ɵfac });
663
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MsalBroadcastServiceb2c, [{
664
+ type: Injectable
665
+ }], function () { return [{ type: undefined, decorators: [{
666
+ type: Inject,
667
+ args: [MSAL_INSTANCE]
668
668
  }] }, { type: MsalServiceb2c }]; }, null); })();
669
669
 
670
- class AuthMicrosoftb2cComponent {
671
- constructor(authService, config, appRef, msalService, msalGuardConfig) {
672
- this.authService = authService;
673
- this.config = config;
674
- this.appRef = appRef;
675
- this.msalService = msalService;
676
- this.msalGuardConfig = msalGuardConfig;
677
- this._destroying$ = new Subject();
678
- this.login = new EventEmitter();
679
- this.options = this.config.getConfig('auth.microsoftb2c') || {};
680
- this.msalService.instance = new PublicClientApplication({
681
- auth: this.options.browserAuthOptions,
682
- cache: {
683
- cacheLocation: 'sessionStorage'
684
- }
685
- });
686
- this.broadcastService = new MsalBroadcastServiceb2c(this.msalService.instance, this.msalService);
687
- if (this.options.browserAuthOptions.clientId) {
688
- this.broadcastService.inProgress$
689
- .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
690
- .subscribe(() => {
691
- this.checkAccount();
692
- });
693
- }
694
- else {
695
- console.warn('Microsoft authentification needs "clientId" option');
696
- }
697
- }
698
- loginMicrosoftb2c() {
699
- this.msalService.loginPopup({ ...this.getConf().authRequest })
700
- .subscribe((response) => {
701
- this.msalService.instance.setActiveAccount(response.account);
702
- this.checkAccount();
703
- });
704
- }
705
- checkAccount() {
706
- this.msalService.instance
707
- .acquireTokenSilent(this.getConf().authRequest)
708
- .then((response) => {
709
- const token = response.idToken;
710
- this.authService.loginWithToken(token, 'microsoftb2c').subscribe(() => {
711
- this.appRef.tick();
712
- this.login.emit(true);
713
- });
714
- })
715
- .catch(async (error) => {
716
- if (error instanceof InteractionRequiredAuthError) {
717
- // fallback to interaction when silent call fails
718
- return this.msalService.acquireTokenPopup(this.getConf().authRequest);
719
- }
720
- }).catch(error => {
721
- console.log('Silent token fails');
722
- });
723
- }
724
- getConf() {
725
- return this.msalGuardConfig.filter(conf => conf.type === 'b2c')[0];
726
- }
727
- }
728
- AuthMicrosoftb2cComponent.ɵfac = function AuthMicrosoftb2cComponent_Factory(t) { return new (t || AuthMicrosoftb2cComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef), i0.ɵɵdirectiveInject(MsalServiceb2c), i0.ɵɵdirectiveInject(MSAL_GUARD_CONFIG)); };
729
- AuthMicrosoftb2cComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthMicrosoftb2cComponent, selectors: [["igo-auth-microsoftb2c"]], outputs: { login: "login" }, decls: 4, vars: 3, consts: [["mat-raised-button", "", 1, "microsoft-login-button", 3, "click"], ["svgIcon", "microsoft"]], template: function AuthMicrosoftb2cComponent_Template(rf, ctx) { if (rf & 1) {
730
- i0.ɵɵelementStart(0, "button", 0);
731
- i0.ɵɵlistener("click", function AuthMicrosoftb2cComponent_Template_button_click_0_listener() { return ctx.loginMicrosoftb2c(); });
732
- i0.ɵɵelement(1, "mat-icon", 1);
733
- i0.ɵɵtext(2);
734
- i0.ɵɵpipe(3, "translate");
735
- i0.ɵɵelementEnd();
736
- } if (rf & 2) {
737
- i0.ɵɵadvance(2);
738
- i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "igo.auth.microsoftb2c.login"), "\n");
739
- } }, dependencies: [i4.MatIcon, i5$1.MatButton, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}[_nghost-%COMP%] > button[_ngcontent-%COMP%]{font-size:15px;height:40px;width:265px}mat-icon[_ngcontent-%COMP%]{margin-right:10px}"], changeDetection: 0 });
740
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthMicrosoftb2cComponent, [{
741
- type: Component,
742
- args: [{ selector: 'igo-auth-microsoftb2c', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button class=\"microsoft-login-button\" mat-raised-button (click)=\"loginMicrosoftb2c()\">\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"] }]
743
- }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: MsalServiceb2c }, { type: undefined, decorators: [{
744
- type: Inject,
745
- args: [MSAL_GUARD_CONFIG]
746
- }] }]; }, { login: [{
747
- type: Output
670
+ class AuthMicrosoftb2cComponent {
671
+ constructor(authService, config, appRef, msalService, msalGuardConfig) {
672
+ this.authService = authService;
673
+ this.config = config;
674
+ this.appRef = appRef;
675
+ this.msalService = msalService;
676
+ this.msalGuardConfig = msalGuardConfig;
677
+ this._destroying$ = new Subject();
678
+ this.login = new EventEmitter();
679
+ this.options = this.config.getConfig('auth.microsoftb2c') || {};
680
+ this.msalService.instance = new PublicClientApplication({
681
+ auth: this.options.browserAuthOptions,
682
+ cache: {
683
+ cacheLocation: 'sessionStorage'
684
+ }
685
+ });
686
+ this.broadcastService = new MsalBroadcastServiceb2c(this.msalService.instance, this.msalService);
687
+ if (this.options.browserAuthOptions.clientId) {
688
+ this.broadcastService.inProgress$
689
+ .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
690
+ .subscribe(() => {
691
+ this.checkAccount();
692
+ });
693
+ }
694
+ else {
695
+ console.warn('Microsoft authentification needs "clientId" option');
696
+ }
697
+ }
698
+ loginMicrosoftb2c() {
699
+ this.msalService.loginPopup({ ...this.getConf().authRequest })
700
+ .subscribe((response) => {
701
+ this.msalService.instance.setActiveAccount(response.account);
702
+ this.checkAccount();
703
+ });
704
+ }
705
+ checkAccount() {
706
+ this.msalService.instance
707
+ .acquireTokenSilent(this.getConf().authRequest)
708
+ .then((response) => {
709
+ const token = response.idToken;
710
+ this.authService.loginWithToken(token, 'microsoftb2c').subscribe(() => {
711
+ this.appRef.tick();
712
+ this.login.emit(true);
713
+ });
714
+ })
715
+ .catch(async (error) => {
716
+ if (error instanceof InteractionRequiredAuthError) {
717
+ // fallback to interaction when silent call fails
718
+ return this.msalService.acquireTokenPopup(this.getConf().authRequest);
719
+ }
720
+ }).catch(error => {
721
+ console.log('Silent token fails');
722
+ });
723
+ }
724
+ getConf() {
725
+ return this.msalGuardConfig.filter(conf => conf.type === 'b2c')[0];
726
+ }
727
+ }
728
+ AuthMicrosoftb2cComponent.ɵfac = function AuthMicrosoftb2cComponent_Factory(t) { return new (t || AuthMicrosoftb2cComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef), i0.ɵɵdirectiveInject(MsalServiceb2c), i0.ɵɵdirectiveInject(MSAL_GUARD_CONFIG)); };
729
+ AuthMicrosoftb2cComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthMicrosoftb2cComponent, selectors: [["igo-auth-microsoftb2c"]], outputs: { login: "login" }, decls: 4, vars: 3, consts: [["mat-raised-button", "", 1, "microsoft-login-button", 3, "click"], ["svgIcon", "microsoft"]], template: function AuthMicrosoftb2cComponent_Template(rf, ctx) { if (rf & 1) {
730
+ i0.ɵɵelementStart(0, "button", 0);
731
+ i0.ɵɵlistener("click", function AuthMicrosoftb2cComponent_Template_button_click_0_listener() { return ctx.loginMicrosoftb2c(); });
732
+ i0.ɵɵelement(1, "mat-icon", 1);
733
+ i0.ɵɵtext(2);
734
+ i0.ɵɵpipe(3, "translate");
735
+ i0.ɵɵelementEnd();
736
+ } if (rf & 2) {
737
+ i0.ɵɵadvance(2);
738
+ i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "igo.auth.microsoftb2c.login"), "\n");
739
+ } }, dependencies: [i4.MatIcon, i5$1.MatButton, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}[_nghost-%COMP%] > button[_ngcontent-%COMP%]{font-size:15px;height:40px;width:265px}mat-icon[_ngcontent-%COMP%]{margin-right:10px}"], changeDetection: 0 });
740
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthMicrosoftb2cComponent, [{
741
+ type: Component,
742
+ args: [{ selector: 'igo-auth-microsoftb2c', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button class=\"microsoft-login-button\" mat-raised-button (click)=\"loginMicrosoftb2c()\">\n <mat-icon svgIcon=\"microsoft\"></mat-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"] }]
743
+ }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: MsalServiceb2c }, { type: undefined, decorators: [{
744
+ type: Inject,
745
+ args: [MSAL_GUARD_CONFIG]
746
+ }] }]; }, { login: [{
747
+ type: Output
748
748
  }] }); })();
749
749
 
750
- function AuthFormComponent_div_0_div_1_Template(rf, ctx) { if (rf & 1) {
751
- i0.ɵɵelement(0, "div", 3);
752
- } }
753
- function AuthFormComponent_div_0_div_2_igo_auth_google_4_Template(rf, ctx) { if (rf & 1) {
754
- const _r11 = i0.ɵɵgetCurrentView();
755
- i0.ɵɵelementStart(0, "igo-auth-google", 7);
756
- i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_google_4_Template_igo_auth_google_login_0_listener() { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r10.onLogin()); });
757
- i0.ɵɵelementEnd();
758
- } }
759
- function AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template(rf, ctx) { if (rf & 1) {
760
- const _r13 = i0.ɵɵgetCurrentView();
761
- i0.ɵɵelementStart(0, "igo-auth-microsoft", 7);
762
- i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template_igo_auth_microsoft_login_0_listener() { i0.ɵɵrestoreView(_r13); const ctx_r12 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r12.onLogin()); });
763
- i0.ɵɵelementEnd();
764
- } }
765
- function AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template(rf, ctx) { if (rf & 1) {
766
- const _r15 = i0.ɵɵgetCurrentView();
767
- i0.ɵɵelementStart(0, "igo-auth-microsoftb2c", 7);
768
- i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template_igo_auth_microsoftb2c_login_0_listener() { i0.ɵɵrestoreView(_r15); const ctx_r14 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r14.onLogin()); });
769
- i0.ɵɵelementEnd();
770
- } }
771
- function AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template(rf, ctx) { if (rf & 1) {
772
- const _r17 = i0.ɵɵgetCurrentView();
773
- i0.ɵɵelementStart(0, "igo-auth-facebook", 7);
774
- i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template_igo_auth_facebook_login_0_listener() { i0.ɵɵrestoreView(_r17); const ctx_r16 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r16.onLogin()); });
775
- i0.ɵɵelementEnd();
776
- } }
777
- function AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template(rf, ctx) { if (rf & 1) {
778
- const _r19 = i0.ɵɵgetCurrentView();
779
- i0.ɵɵelementStart(0, "igo-auth-intern", 8);
780
- i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template_igo_auth_intern_login_0_listener() { i0.ɵɵrestoreView(_r19); const ctx_r18 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r18.onLogin()); });
781
- i0.ɵɵelementEnd();
782
- } if (rf & 2) {
783
- const ctx_r9 = i0.ɵɵnextContext(3);
784
- i0.ɵɵproperty("allowAnonymous", ctx_r9.options.allowAnonymous);
785
- } }
786
- function AuthFormComponent_div_0_div_2_Template(rf, ctx) { if (rf & 1) {
787
- i0.ɵɵelementStart(0, "div", 4)(1, "h1");
788
- i0.ɵɵtext(2);
789
- i0.ɵɵpipe(3, "translate");
790
- i0.ɵɵelementEnd();
791
- i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_2_igo_auth_google_4_Template, 1, 0, "igo-auth-google", 5);
792
- i0.ɵɵtemplate(5, AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template, 1, 0, "igo-auth-microsoft", 5);
793
- i0.ɵɵtemplate(6, AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template, 1, 0, "igo-auth-microsoftb2c", 5);
794
- i0.ɵɵtemplate(7, AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template, 1, 0, "igo-auth-facebook", 5);
795
- i0.ɵɵtemplate(8, AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template, 1, 1, "igo-auth-intern", 6);
796
- i0.ɵɵelementEnd();
797
- } if (rf & 2) {
798
- const ctx_r2 = i0.ɵɵnextContext(2);
799
- i0.ɵɵadvance(2);
800
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 6, "igo.auth.connection"));
801
- i0.ɵɵadvance(2);
802
- i0.ɵɵproperty("ngIf", ctx_r2.options.google && ctx_r2.options.google.enabled !== false);
803
- i0.ɵɵadvance(1);
804
- i0.ɵɵproperty("ngIf", ctx_r2.options.microsoft && ctx_r2.options.microsoft.enabled !== false);
805
- i0.ɵɵadvance(1);
806
- i0.ɵɵproperty("ngIf", ctx_r2.options.microsoftb2c && ctx_r2.options.microsoftb2c.enabled !== false);
807
- i0.ɵɵadvance(1);
808
- i0.ɵɵproperty("ngIf", ctx_r2.options.facebook && ctx_r2.options.facebook.enabled !== false);
809
- i0.ɵɵadvance(1);
810
- i0.ɵɵproperty("ngIf", !ctx_r2.options.intern || ctx_r2.options.intern.enabled !== false);
811
- } }
812
- function AuthFormComponent_div_0_div_3_Template(rf, ctx) { if (rf & 1) {
813
- const _r21 = i0.ɵɵgetCurrentView();
814
- i0.ɵɵelementStart(0, "div", 4)(1, "p");
815
- i0.ɵɵtext(2);
816
- i0.ɵɵpipe(3, "translate");
817
- i0.ɵɵelementEnd();
818
- i0.ɵɵelementStart(4, "button", 9);
819
- i0.ɵɵlistener("click", function AuthFormComponent_div_0_div_3_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r21); const ctx_r20 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r20.logout()); });
820
- i0.ɵɵtext(5);
821
- i0.ɵɵpipe(6, "translate");
822
- i0.ɵɵelementEnd()();
823
- } if (rf & 2) {
824
- const ctx_r3 = i0.ɵɵnextContext(2);
825
- i0.ɵɵadvance(2);
826
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(3, 2, "igo.auth.welcome", ctx_r3.user));
827
- i0.ɵɵadvance(3);
828
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(6, 5, "igo.auth.signOut"));
829
- } }
830
- function AuthFormComponent_div_0_div_4_button_4_Template(rf, ctx) { if (rf & 1) {
831
- const _r24 = i0.ɵɵgetCurrentView();
832
- i0.ɵɵelementStart(0, "button", 9);
833
- i0.ɵɵlistener("click", function AuthFormComponent_div_0_div_4_button_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r24); const ctx_r23 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r23.home()); });
834
- i0.ɵɵtext(1);
835
- i0.ɵɵpipe(2, "translate");
836
- i0.ɵɵelementEnd();
837
- } if (rf & 2) {
838
- i0.ɵɵadvance(1);
839
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, "igo.auth.home"));
840
- } }
841
- function AuthFormComponent_div_0_div_4_Template(rf, ctx) { if (rf & 1) {
842
- i0.ɵɵelementStart(0, "div", 4)(1, "p");
843
- i0.ɵɵtext(2);
844
- i0.ɵɵpipe(3, "translate");
845
- i0.ɵɵelementEnd();
846
- i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_4_button_4_Template, 3, 3, "button", 10);
847
- i0.ɵɵelementEnd();
848
- } if (rf & 2) {
849
- const ctx_r4 = i0.ɵɵnextContext(2);
850
- i0.ɵɵadvance(2);
851
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 2, "igo.auth.deconnection"));
852
- i0.ɵɵadvance(2);
853
- i0.ɵɵproperty("ngIf", ctx_r4.options.homeRoute);
854
- } }
855
- function AuthFormComponent_div_0_Template(rf, ctx) { if (rf & 1) {
856
- i0.ɵɵelementStart(0, "div");
857
- i0.ɵɵtemplate(1, AuthFormComponent_div_0_div_1_Template, 1, 0, "div", 1);
858
- i0.ɵɵtemplate(2, AuthFormComponent_div_0_div_2_Template, 9, 8, "div", 2);
859
- i0.ɵɵtemplate(3, AuthFormComponent_div_0_div_3_Template, 7, 7, "div", 2);
860
- i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_4_Template, 5, 4, "div", 2);
861
- i0.ɵɵelementEnd();
862
- } if (rf & 2) {
863
- const ctx_r0 = i0.ɵɵnextContext();
864
- i0.ɵɵadvance(1);
865
- i0.ɵɵproperty("ngIf", !ctx_r0.auth.logged && ctx_r0.backgroundDisable);
866
- i0.ɵɵadvance(1);
867
- i0.ɵɵproperty("ngIf", !ctx_r0.auth.logged && ctx_r0.showLoginDiv);
868
- i0.ɵɵadvance(1);
869
- i0.ɵɵproperty("ngIf", ctx_r0.auth.logged && ctx_r0.showAlreadyConnectedDiv);
870
- i0.ɵɵadvance(1);
871
- i0.ɵɵproperty("ngIf", ctx_r0.showLogoutDiv);
872
- } }
873
- class AuthFormComponent {
874
- constructor(auth, config, router) {
875
- this.auth = auth;
876
- this.config = config;
877
- this.router = router;
878
- this._backgroundDisable = true;
879
- this._hasAlreadyConnectedDiv = true;
880
- this._hasLogoutDiv = true;
881
- this._showAlreadyConnectedDiv = false;
882
- this._showLogoutDiv = false;
883
- this.login = new EventEmitter();
884
- this.visible = true;
885
- this.options = this.config.getConfig('auth') || {};
886
- this.visible = Object.getOwnPropertyNames(this.options).length !== 0;
887
- }
888
- get backgroundDisable() {
889
- if (this.isLogoutRoute || this.isLogoutRoute) {
890
- return false;
891
- }
892
- return this._backgroundDisable;
893
- }
894
- set backgroundDisable(value) {
895
- this._backgroundDisable = value.toString() === 'true';
896
- }
897
- get hasAlreadyConnectedDiv() {
898
- return this._hasAlreadyConnectedDiv;
899
- }
900
- set hasAlreadyConnectedDiv(value) {
901
- this._hasAlreadyConnectedDiv = value.toString() === 'true';
902
- }
903
- get hasLogoutDiv() {
904
- return this._hasLogoutDiv;
905
- }
906
- set hasLogoutDiv(value) {
907
- this._hasLogoutDiv = value.toString() === 'true';
908
- }
909
- get showAlreadyConnectedDiv() {
910
- if (this.isLogoutRoute) {
911
- return this.hasAlreadyConnectedDiv;
912
- }
913
- return this._showAlreadyConnectedDiv;
914
- }
915
- set showAlreadyConnectedDiv(value) {
916
- this._showAlreadyConnectedDiv = value.toString() === 'true';
917
- }
918
- get showLogoutDiv() {
919
- if (this.isLogoutRoute) {
920
- return this.hasLogoutDiv;
921
- }
922
- return this._showLogoutDiv;
923
- }
924
- set showLogoutDiv(value) {
925
- this._showLogoutDiv = value.toString() === 'true';
926
- }
927
- get showLoginDiv() {
928
- if (!this.isLogoutRoute) {
929
- return true;
930
- }
931
- }
932
- ngOnInit() {
933
- this.analyzeRoute();
934
- this.getName();
935
- }
936
- onLogin() {
937
- this.auth.goToRedirectUrl();
938
- this.getName();
939
- this.login.emit(true);
940
- }
941
- logout() {
942
- this.auth.logout().subscribe(() => {
943
- this.user = undefined;
944
- if (this.router) {
945
- if (this.options.logoutRoute) {
946
- this.router.navigate([this.options.logoutRoute]);
947
- }
948
- else if (this.options.homeRoute) {
949
- this.router.navigate([this.options.homeRoute]);
950
- }
951
- }
952
- });
953
- }
954
- home() {
955
- if (this.router && this.options.homeRoute) {
956
- this.router.navigate([this.options.homeRoute]);
957
- }
958
- }
959
- getName() {
960
- const tokenDecoded = this.auth.decodeToken();
961
- if (tokenDecoded) {
962
- this.user = {
963
- name: tokenDecoded.user.firstName || tokenDecoded.user.sourceId
964
- };
965
- }
966
- }
967
- analyzeRoute() {
968
- if (!this.router) {
969
- return;
970
- }
971
- this.router.events
972
- .pipe(filter((event) => event instanceof NavigationStart))
973
- .subscribe((changeEvent) => {
974
- if (changeEvent.url) {
975
- const currentRoute = changeEvent.url;
976
- const logoutRoute = this.options.logoutRoute;
977
- const loginRoute = this.options.loginRoute;
978
- this.isLogoutRoute = currentRoute === logoutRoute;
979
- this.isLoginRoute = currentRoute === loginRoute;
980
- if (this.isLogoutRoute) {
981
- this.auth.logout();
982
- }
983
- }
984
- });
985
- }
986
- }
987
- AuthFormComponent.ɵfac = function AuthFormComponent_Factory(t) { return new (t || AuthFormComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i3.Router, 8)); };
988
- AuthFormComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthFormComponent, selectors: [["igo-auth-form"]], inputs: { backgroundDisable: "backgroundDisable", hasAlreadyConnectedDiv: "hasAlreadyConnectedDiv", hasLogoutDiv: "hasLogoutDiv", showAlreadyConnectedDiv: "showAlreadyConnectedDiv", showLogoutDiv: "showLogoutDiv" }, outputs: { login: "login" }, decls: 1, vars: 1, consts: [[4, "ngIf"], ["class", "backgroundDisable", 4, "ngIf"], ["class", "login center-block", 4, "ngIf"], [1, "backgroundDisable"], [1, "login", "center-block"], [3, "login", 4, "ngIf"], [3, "allowAnonymous", "login", 4, "ngIf"], [3, "login"], [3, "allowAnonymous", "login"], ["mat-raised-button", "", "type", "button", 3, "click"], ["mat-raised-button", "", "type", "button", 3, "click", 4, "ngIf"]], template: function AuthFormComponent_Template(rf, ctx) { if (rf & 1) {
989
- i0.ɵɵtemplate(0, AuthFormComponent_div_0_Template, 5, 4, "div", 0);
990
- } if (rf & 2) {
991
- i0.ɵɵproperty("ngIf", ctx.visible);
992
- } }, dependencies: [i1$1.NgIf, i5$1.MatButton, AuthGoogleComponent, AuthInternComponent, AuthFacebookComponent, AuthMicrosoftComponent, AuthMicrosoftb2cComponent, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{z-index:999}div.login[_ngcontent-%COMP%]{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[_ngcontent-%COMP%]{position:fixed;top:20%;left:50%;transform:translate(-50%)}.backgroundDisable[_ngcontent-%COMP%]{position:fixed;top:0;left:0;background:#000;opacity:.8;z-index:100;height:100%;width:100%}"] });
993
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthFormComponent, [{
994
- type: Component,
995
- args: [{ selector: 'igo-auth-form', changeDetection: ChangeDetectionStrategy.Default, template: "<div *ngIf=\"visible\">\r\n <div *ngIf=\"!auth.logged && backgroundDisable\" class=\"backgroundDisable\"></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 </igo-auth-google>\r\n <igo-auth-microsoft\r\n *ngIf=\"options.microsoft && options.microsoft.enabled !== false\"\r\n (login)=\"onLogin()\">\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 </igo-auth-microsoftb2c>\r\n <igo-auth-facebook\r\n *ngIf=\"options.facebook && options.facebook.enabled !== false\"\r\n (login)=\"onLogin()\">\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 </igo-auth-intern>\r\n </div>\r\n\r\n <div *ngIf=\"auth.logged && showAlreadyConnectedDiv\" class=\"login center-block\">\r\n <p>{{'igo.auth.welcome' |\u00A0translate: user}}</p>\r\n <button mat-raised-button type=\"button\" (click)=\"logout()\">{{'igo.auth.signOut' |\u00A0translate}}</button>\r\n </div>\r\n\r\n <div *ngIf=\"showLogoutDiv\" class=\"login center-block\">\r\n <p>{{'igo.auth.deconnection' |\u00A0translate}}</p>\r\n <button *ngIf=\"options.homeRoute\" mat-raised-button type=\"button\" (click)=\"home()\">{{'igo.auth.home' |\u00A0translate}}</button>\r\n </div>\r\n\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"] }]
996
- }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router, decorators: [{
997
- type: Optional
998
- }] }]; }, { backgroundDisable: [{
999
- type: Input
1000
- }], hasAlreadyConnectedDiv: [{
1001
- type: Input
1002
- }], hasLogoutDiv: [{
1003
- type: Input
1004
- }], showAlreadyConnectedDiv: [{
1005
- type: Input
1006
- }], showLogoutDiv: [{
1007
- type: Input
1008
- }], login: [{
1009
- type: Output
750
+ function AuthFormComponent_div_0_div_1_Template(rf, ctx) { if (rf & 1) {
751
+ i0.ɵɵelement(0, "div", 3);
752
+ } }
753
+ function AuthFormComponent_div_0_div_2_igo_auth_google_4_Template(rf, ctx) { if (rf & 1) {
754
+ const _r11 = i0.ɵɵgetCurrentView();
755
+ i0.ɵɵelementStart(0, "igo-auth-google", 7);
756
+ i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_google_4_Template_igo_auth_google_login_0_listener() { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r10.onLogin()); });
757
+ i0.ɵɵelementEnd();
758
+ } }
759
+ function AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template(rf, ctx) { if (rf & 1) {
760
+ const _r13 = i0.ɵɵgetCurrentView();
761
+ i0.ɵɵelementStart(0, "igo-auth-microsoft", 7);
762
+ i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template_igo_auth_microsoft_login_0_listener() { i0.ɵɵrestoreView(_r13); const ctx_r12 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r12.onLogin()); });
763
+ i0.ɵɵelementEnd();
764
+ } }
765
+ function AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template(rf, ctx) { if (rf & 1) {
766
+ const _r15 = i0.ɵɵgetCurrentView();
767
+ i0.ɵɵelementStart(0, "igo-auth-microsoftb2c", 7);
768
+ i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template_igo_auth_microsoftb2c_login_0_listener() { i0.ɵɵrestoreView(_r15); const ctx_r14 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r14.onLogin()); });
769
+ i0.ɵɵelementEnd();
770
+ } }
771
+ function AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template(rf, ctx) { if (rf & 1) {
772
+ const _r17 = i0.ɵɵgetCurrentView();
773
+ i0.ɵɵelementStart(0, "igo-auth-facebook", 7);
774
+ i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template_igo_auth_facebook_login_0_listener() { i0.ɵɵrestoreView(_r17); const ctx_r16 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r16.onLogin()); });
775
+ i0.ɵɵelementEnd();
776
+ } }
777
+ function AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template(rf, ctx) { if (rf & 1) {
778
+ const _r19 = i0.ɵɵgetCurrentView();
779
+ i0.ɵɵelementStart(0, "igo-auth-intern", 8);
780
+ i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template_igo_auth_intern_login_0_listener() { i0.ɵɵrestoreView(_r19); const ctx_r18 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r18.onLogin()); });
781
+ i0.ɵɵelementEnd();
782
+ } if (rf & 2) {
783
+ const ctx_r9 = i0.ɵɵnextContext(3);
784
+ i0.ɵɵproperty("allowAnonymous", ctx_r9.options.allowAnonymous);
785
+ } }
786
+ function AuthFormComponent_div_0_div_2_Template(rf, ctx) { if (rf & 1) {
787
+ i0.ɵɵelementStart(0, "div", 4)(1, "h1");
788
+ i0.ɵɵtext(2);
789
+ i0.ɵɵpipe(3, "translate");
790
+ i0.ɵɵelementEnd();
791
+ i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_2_igo_auth_google_4_Template, 1, 0, "igo-auth-google", 5);
792
+ i0.ɵɵtemplate(5, AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template, 1, 0, "igo-auth-microsoft", 5);
793
+ i0.ɵɵtemplate(6, AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template, 1, 0, "igo-auth-microsoftb2c", 5);
794
+ i0.ɵɵtemplate(7, AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template, 1, 0, "igo-auth-facebook", 5);
795
+ i0.ɵɵtemplate(8, AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template, 1, 1, "igo-auth-intern", 6);
796
+ i0.ɵɵelementEnd();
797
+ } if (rf & 2) {
798
+ const ctx_r2 = i0.ɵɵnextContext(2);
799
+ i0.ɵɵadvance(2);
800
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 6, "igo.auth.connection"));
801
+ i0.ɵɵadvance(2);
802
+ i0.ɵɵproperty("ngIf", ctx_r2.options.google && ctx_r2.options.google.enabled !== false);
803
+ i0.ɵɵadvance(1);
804
+ i0.ɵɵproperty("ngIf", ctx_r2.options.microsoft && ctx_r2.options.microsoft.enabled !== false);
805
+ i0.ɵɵadvance(1);
806
+ i0.ɵɵproperty("ngIf", ctx_r2.options.microsoftb2c && ctx_r2.options.microsoftb2c.enabled !== false);
807
+ i0.ɵɵadvance(1);
808
+ i0.ɵɵproperty("ngIf", ctx_r2.options.facebook && ctx_r2.options.facebook.enabled !== false);
809
+ i0.ɵɵadvance(1);
810
+ i0.ɵɵproperty("ngIf", !ctx_r2.options.intern || ctx_r2.options.intern.enabled !== false);
811
+ } }
812
+ function AuthFormComponent_div_0_div_3_Template(rf, ctx) { if (rf & 1) {
813
+ const _r21 = i0.ɵɵgetCurrentView();
814
+ i0.ɵɵelementStart(0, "div", 4)(1, "p");
815
+ i0.ɵɵtext(2);
816
+ i0.ɵɵpipe(3, "translate");
817
+ i0.ɵɵelementEnd();
818
+ i0.ɵɵelementStart(4, "button", 9);
819
+ i0.ɵɵlistener("click", function AuthFormComponent_div_0_div_3_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r21); const ctx_r20 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r20.logout()); });
820
+ i0.ɵɵtext(5);
821
+ i0.ɵɵpipe(6, "translate");
822
+ i0.ɵɵelementEnd()();
823
+ } if (rf & 2) {
824
+ const ctx_r3 = i0.ɵɵnextContext(2);
825
+ i0.ɵɵadvance(2);
826
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(3, 2, "igo.auth.welcome", ctx_r3.user));
827
+ i0.ɵɵadvance(3);
828
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(6, 5, "igo.auth.signOut"));
829
+ } }
830
+ function AuthFormComponent_div_0_div_4_button_4_Template(rf, ctx) { if (rf & 1) {
831
+ const _r24 = i0.ɵɵgetCurrentView();
832
+ i0.ɵɵelementStart(0, "button", 9);
833
+ i0.ɵɵlistener("click", function AuthFormComponent_div_0_div_4_button_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r24); const ctx_r23 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r23.home()); });
834
+ i0.ɵɵtext(1);
835
+ i0.ɵɵpipe(2, "translate");
836
+ i0.ɵɵelementEnd();
837
+ } if (rf & 2) {
838
+ i0.ɵɵadvance(1);
839
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, "igo.auth.home"));
840
+ } }
841
+ function AuthFormComponent_div_0_div_4_Template(rf, ctx) { if (rf & 1) {
842
+ i0.ɵɵelementStart(0, "div", 4)(1, "p");
843
+ i0.ɵɵtext(2);
844
+ i0.ɵɵpipe(3, "translate");
845
+ i0.ɵɵelementEnd();
846
+ i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_4_button_4_Template, 3, 3, "button", 10);
847
+ i0.ɵɵelementEnd();
848
+ } if (rf & 2) {
849
+ const ctx_r4 = i0.ɵɵnextContext(2);
850
+ i0.ɵɵadvance(2);
851
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 2, "igo.auth.deconnection"));
852
+ i0.ɵɵadvance(2);
853
+ i0.ɵɵproperty("ngIf", ctx_r4.options.homeRoute);
854
+ } }
855
+ function AuthFormComponent_div_0_Template(rf, ctx) { if (rf & 1) {
856
+ i0.ɵɵelementStart(0, "div");
857
+ i0.ɵɵtemplate(1, AuthFormComponent_div_0_div_1_Template, 1, 0, "div", 1);
858
+ i0.ɵɵtemplate(2, AuthFormComponent_div_0_div_2_Template, 9, 8, "div", 2);
859
+ i0.ɵɵtemplate(3, AuthFormComponent_div_0_div_3_Template, 7, 7, "div", 2);
860
+ i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_4_Template, 5, 4, "div", 2);
861
+ i0.ɵɵelementEnd();
862
+ } if (rf & 2) {
863
+ const ctx_r0 = i0.ɵɵnextContext();
864
+ i0.ɵɵadvance(1);
865
+ i0.ɵɵproperty("ngIf", !ctx_r0.auth.logged && ctx_r0.backgroundDisable);
866
+ i0.ɵɵadvance(1);
867
+ i0.ɵɵproperty("ngIf", !ctx_r0.auth.logged && ctx_r0.showLoginDiv);
868
+ i0.ɵɵadvance(1);
869
+ i0.ɵɵproperty("ngIf", ctx_r0.auth.logged && ctx_r0.showAlreadyConnectedDiv);
870
+ i0.ɵɵadvance(1);
871
+ i0.ɵɵproperty("ngIf", ctx_r0.showLogoutDiv);
872
+ } }
873
+ class AuthFormComponent {
874
+ constructor(auth, config, router) {
875
+ this.auth = auth;
876
+ this.config = config;
877
+ this.router = router;
878
+ this._backgroundDisable = true;
879
+ this._hasAlreadyConnectedDiv = true;
880
+ this._hasLogoutDiv = true;
881
+ this._showAlreadyConnectedDiv = false;
882
+ this._showLogoutDiv = false;
883
+ this.login = new EventEmitter();
884
+ this.visible = true;
885
+ this.options = this.config.getConfig('auth') || {};
886
+ this.visible = Object.getOwnPropertyNames(this.options).length !== 0;
887
+ }
888
+ get backgroundDisable() {
889
+ if (this.isLogoutRoute || this.isLogoutRoute) {
890
+ return false;
891
+ }
892
+ return this._backgroundDisable;
893
+ }
894
+ set backgroundDisable(value) {
895
+ this._backgroundDisable = value.toString() === 'true';
896
+ }
897
+ get hasAlreadyConnectedDiv() {
898
+ return this._hasAlreadyConnectedDiv;
899
+ }
900
+ set hasAlreadyConnectedDiv(value) {
901
+ this._hasAlreadyConnectedDiv = value.toString() === 'true';
902
+ }
903
+ get hasLogoutDiv() {
904
+ return this._hasLogoutDiv;
905
+ }
906
+ set hasLogoutDiv(value) {
907
+ this._hasLogoutDiv = value.toString() === 'true';
908
+ }
909
+ get showAlreadyConnectedDiv() {
910
+ if (this.isLogoutRoute) {
911
+ return this.hasAlreadyConnectedDiv;
912
+ }
913
+ return this._showAlreadyConnectedDiv;
914
+ }
915
+ set showAlreadyConnectedDiv(value) {
916
+ this._showAlreadyConnectedDiv = value.toString() === 'true';
917
+ }
918
+ get showLogoutDiv() {
919
+ if (this.isLogoutRoute) {
920
+ return this.hasLogoutDiv;
921
+ }
922
+ return this._showLogoutDiv;
923
+ }
924
+ set showLogoutDiv(value) {
925
+ this._showLogoutDiv = value.toString() === 'true';
926
+ }
927
+ get showLoginDiv() {
928
+ if (!this.isLogoutRoute) {
929
+ return true;
930
+ }
931
+ }
932
+ ngOnInit() {
933
+ this.analyzeRoute();
934
+ this.getName();
935
+ }
936
+ onLogin() {
937
+ this.auth.goToRedirectUrl();
938
+ this.getName();
939
+ this.login.emit(true);
940
+ }
941
+ logout() {
942
+ this.auth.logout().subscribe(() => {
943
+ this.user = undefined;
944
+ if (this.router) {
945
+ if (this.options.logoutRoute) {
946
+ this.router.navigate([this.options.logoutRoute]);
947
+ }
948
+ else if (this.options.homeRoute) {
949
+ this.router.navigate([this.options.homeRoute]);
950
+ }
951
+ }
952
+ });
953
+ }
954
+ home() {
955
+ if (this.router && this.options.homeRoute) {
956
+ this.router.navigate([this.options.homeRoute]);
957
+ }
958
+ }
959
+ getName() {
960
+ const tokenDecoded = this.auth.decodeToken();
961
+ if (tokenDecoded) {
962
+ this.user = {
963
+ name: tokenDecoded.user.firstName || tokenDecoded.user.sourceId
964
+ };
965
+ }
966
+ }
967
+ analyzeRoute() {
968
+ if (!this.router) {
969
+ return;
970
+ }
971
+ this.router.events
972
+ .pipe(filter((event) => event instanceof NavigationStart))
973
+ .subscribe((changeEvent) => {
974
+ if (changeEvent.url) {
975
+ const currentRoute = changeEvent.url;
976
+ const logoutRoute = this.options.logoutRoute;
977
+ const loginRoute = this.options.loginRoute;
978
+ this.isLogoutRoute = currentRoute === logoutRoute;
979
+ this.isLoginRoute = currentRoute === loginRoute;
980
+ if (this.isLogoutRoute) {
981
+ this.auth.logout();
982
+ }
983
+ }
984
+ });
985
+ }
986
+ }
987
+ AuthFormComponent.ɵfac = function AuthFormComponent_Factory(t) { return new (t || AuthFormComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i3.Router, 8)); };
988
+ AuthFormComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthFormComponent, selectors: [["igo-auth-form"]], inputs: { backgroundDisable: "backgroundDisable", hasAlreadyConnectedDiv: "hasAlreadyConnectedDiv", hasLogoutDiv: "hasLogoutDiv", showAlreadyConnectedDiv: "showAlreadyConnectedDiv", showLogoutDiv: "showLogoutDiv" }, outputs: { login: "login" }, decls: 1, vars: 1, consts: [[4, "ngIf"], ["class", "backgroundDisable", 4, "ngIf"], ["class", "login center-block", 4, "ngIf"], [1, "backgroundDisable"], [1, "login", "center-block"], [3, "login", 4, "ngIf"], [3, "allowAnonymous", "login", 4, "ngIf"], [3, "login"], [3, "allowAnonymous", "login"], ["mat-raised-button", "", "type", "button", 3, "click"], ["mat-raised-button", "", "type", "button", 3, "click", 4, "ngIf"]], template: function AuthFormComponent_Template(rf, ctx) { if (rf & 1) {
989
+ i0.ɵɵtemplate(0, AuthFormComponent_div_0_Template, 5, 4, "div", 0);
990
+ } if (rf & 2) {
991
+ i0.ɵɵproperty("ngIf", ctx.visible);
992
+ } }, dependencies: [i1$1.NgIf, i5$1.MatButton, AuthGoogleComponent, AuthInternComponent, AuthFacebookComponent, AuthMicrosoftComponent, AuthMicrosoftb2cComponent, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{z-index:999}div.login[_ngcontent-%COMP%]{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[_ngcontent-%COMP%]{position:fixed;top:20%;left:50%;transform:translate(-50%)}.backgroundDisable[_ngcontent-%COMP%]{position:fixed;top:0;left:0;background:#000;opacity:.8;z-index:100;height:100%;width:100%}"] });
993
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthFormComponent, [{
994
+ type: Component,
995
+ args: [{ selector: 'igo-auth-form', changeDetection: ChangeDetectionStrategy.Default, template: "<div *ngIf=\"visible\">\n <div *ngIf=\"!auth.logged && backgroundDisable\" class=\"backgroundDisable\"></div>\n\n <div *ngIf=\"!auth.logged && showLoginDiv\" class=\"login center-block\">\n <h1>{{'igo.auth.connection' | translate}}</h1>\n\n <igo-auth-google\n *ngIf=\"options.google && options.google.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-google>\n <igo-auth-microsoft\n *ngIf=\"options.microsoft && options.microsoft.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-microsoft>\n <igo-auth-microsoftb2c\n *ngIf=\"options.microsoftb2c && options.microsoftb2c.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-microsoftb2c>\n <igo-auth-facebook\n *ngIf=\"options.facebook && options.facebook.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-facebook>\n <igo-auth-intern\n *ngIf=\"!options.intern || options.intern.enabled !== false\"\n [allowAnonymous]=\"options.allowAnonymous\"\n (login)=\"onLogin()\">\n </igo-auth-intern>\n </div>\n\n <div *ngIf=\"auth.logged && showAlreadyConnectedDiv\" class=\"login center-block\">\n <p>{{'igo.auth.welcome' |\u00A0translate: user}}</p>\n <button mat-raised-button type=\"button\" (click)=\"logout()\">{{'igo.auth.signOut' |\u00A0translate}}</button>\n </div>\n\n <div *ngIf=\"showLogoutDiv\" class=\"login center-block\">\n <p>{{'igo.auth.deconnection' |\u00A0translate}}</p>\n <button *ngIf=\"options.homeRoute\" mat-raised-button type=\"button\" (click)=\"home()\">{{'igo.auth.home' |\u00A0translate}}</button>\n </div>\n\n</div>\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"] }]
996
+ }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router, decorators: [{
997
+ type: Optional
998
+ }] }]; }, { backgroundDisable: [{
999
+ type: Input
1000
+ }], hasAlreadyConnectedDiv: [{
1001
+ type: Input
1002
+ }], hasLogoutDiv: [{
1003
+ type: Input
1004
+ }], showAlreadyConnectedDiv: [{
1005
+ type: Input
1006
+ }], showLogoutDiv: [{
1007
+ type: Input
1008
+ }], login: [{
1009
+ type: Output
1010
1010
  }] }); })();
1011
1011
 
1012
- class LoggedGuard {
1013
- constructor(authService, config, router) {
1014
- this.authService = authService;
1015
- this.config = config;
1016
- this.router = router;
1017
- }
1018
- canActivate(route, state) {
1019
- if (this.authService.logged) {
1020
- return true;
1021
- }
1022
- this.authService.redirectUrl = state.url;
1023
- const authConfig = this.config.getConfig('auth');
1024
- if (authConfig && authConfig.loginRoute) {
1025
- this.router.navigateByUrl(authConfig.loginRoute);
1026
- }
1027
- return false;
1028
- }
1029
- }
1030
- LoggedGuard.ɵfac = function LoggedGuard_Factory(t) { return new (t || LoggedGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1031
- LoggedGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoggedGuard, factory: LoggedGuard.ɵfac, providedIn: 'root' });
1032
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LoggedGuard, [{
1033
- type: Injectable,
1034
- args: [{
1035
- providedIn: 'root'
1036
- }]
1012
+ class LoggedGuard {
1013
+ constructor(authService, config, router) {
1014
+ this.authService = authService;
1015
+ this.config = config;
1016
+ this.router = router;
1017
+ }
1018
+ canActivate(route, state) {
1019
+ if (this.authService.logged) {
1020
+ return true;
1021
+ }
1022
+ this.authService.redirectUrl = state.url;
1023
+ const authConfig = this.config.getConfig('auth');
1024
+ if (authConfig && authConfig.loginRoute) {
1025
+ this.router.navigateByUrl(authConfig.loginRoute);
1026
+ }
1027
+ return false;
1028
+ }
1029
+ }
1030
+ LoggedGuard.ɵfac = function LoggedGuard_Factory(t) { return new (t || LoggedGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1031
+ LoggedGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoggedGuard, factory: LoggedGuard.ɵfac, providedIn: 'root' });
1032
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LoggedGuard, [{
1033
+ type: Injectable,
1034
+ args: [{
1035
+ providedIn: 'root'
1036
+ }]
1037
1037
  }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router }]; }, null); })();
1038
1038
 
1039
- class AuthGuard {
1040
- constructor(authService, config, router) {
1041
- this.authService = authService;
1042
- this.config = config;
1043
- this.router = router;
1044
- }
1045
- canActivate(route, state) {
1046
- if (this.authService.authenticated) {
1047
- return true;
1048
- }
1049
- this.authService.redirectUrl = state.url;
1050
- const authConfig = this.config.getConfig('auth');
1051
- if (authConfig && authConfig.loginRoute) {
1052
- this.router.navigateByUrl(authConfig.loginRoute);
1053
- }
1054
- return false;
1055
- }
1056
- }
1057
- AuthGuard.ɵfac = function AuthGuard_Factory(t) { return new (t || AuthGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1058
- AuthGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthGuard, factory: AuthGuard.ɵfac, providedIn: 'root' });
1059
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthGuard, [{
1060
- type: Injectable,
1061
- args: [{
1062
- providedIn: 'root'
1063
- }]
1039
+ class AuthGuard {
1040
+ constructor(authService, config, router) {
1041
+ this.authService = authService;
1042
+ this.config = config;
1043
+ this.router = router;
1044
+ }
1045
+ canActivate(route, state) {
1046
+ if (this.authService.authenticated) {
1047
+ return true;
1048
+ }
1049
+ this.authService.redirectUrl = state.url;
1050
+ const authConfig = this.config.getConfig('auth');
1051
+ if (authConfig && authConfig.loginRoute) {
1052
+ this.router.navigateByUrl(authConfig.loginRoute);
1053
+ }
1054
+ return false;
1055
+ }
1056
+ }
1057
+ AuthGuard.ɵfac = function AuthGuard_Factory(t) { return new (t || AuthGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1058
+ AuthGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthGuard, factory: AuthGuard.ɵfac, providedIn: 'root' });
1059
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthGuard, [{
1060
+ type: Injectable,
1061
+ args: [{
1062
+ providedIn: 'root'
1063
+ }]
1064
1064
  }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router }]; }, null); })();
1065
1065
 
1066
- class AdminGuard {
1067
- constructor(authService, config, router) {
1068
- this.authService = authService;
1069
- this.config = config;
1070
- this.router = router;
1071
- }
1072
- canActivate(route, state) {
1073
- const token = this.authService.decodeToken();
1074
- if (token && token.user && token.user.isAdmin) {
1075
- return true;
1076
- }
1077
- this.authService.redirectUrl = state.url;
1078
- const authConfig = this.config.getConfig('auth');
1079
- if (authConfig && authConfig.loginRoute) {
1080
- this.router.navigateByUrl(authConfig.loginRoute);
1081
- }
1082
- return false;
1083
- }
1084
- }
1085
- AdminGuard.ɵfac = function AdminGuard_Factory(t) { return new (t || AdminGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1086
- AdminGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AdminGuard, factory: AdminGuard.ɵfac, providedIn: 'root' });
1087
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AdminGuard, [{
1088
- type: Injectable,
1089
- args: [{
1090
- providedIn: 'root'
1091
- }]
1066
+ class AdminGuard {
1067
+ constructor(authService, config, router) {
1068
+ this.authService = authService;
1069
+ this.config = config;
1070
+ this.router = router;
1071
+ }
1072
+ canActivate(route, state) {
1073
+ const token = this.authService.decodeToken();
1074
+ if (token && token.user && token.user.isAdmin) {
1075
+ return true;
1076
+ }
1077
+ this.authService.redirectUrl = state.url;
1078
+ const authConfig = this.config.getConfig('auth');
1079
+ if (authConfig && authConfig.loginRoute) {
1080
+ this.router.navigateByUrl(authConfig.loginRoute);
1081
+ }
1082
+ return false;
1083
+ }
1084
+ }
1085
+ AdminGuard.ɵfac = function AdminGuard_Factory(t) { return new (t || AdminGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1086
+ AdminGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AdminGuard, factory: AdminGuard.ɵfac, providedIn: 'root' });
1087
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AdminGuard, [{
1088
+ type: Injectable,
1089
+ args: [{
1090
+ providedIn: 'root'
1091
+ }]
1092
1092
  }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router }]; }, null); })();
1093
1093
 
1094
- class ProfilsGuard {
1095
- constructor(authService, config, router) {
1096
- this.authService = authService;
1097
- this.config = config;
1098
- this.router = router;
1099
- }
1100
- canActivate(_route, state) {
1101
- return this.authService.getProfils().pipe(map((profils) => {
1102
- const authConfig = this.config.getConfig('auth');
1103
- if (profils &&
1104
- profils.profils &&
1105
- profils.profils.some(v => authConfig.profilsGuard.indexOf(v) !== -1)) {
1106
- return true;
1107
- }
1108
- this.authService.redirectUrl = state.url;
1109
- if (authConfig && authConfig.loginRoute) {
1110
- this.router.navigateByUrl(authConfig.loginRoute);
1111
- }
1112
- return false;
1113
- }));
1114
- }
1115
- }
1116
- ProfilsGuard.ɵfac = function ProfilsGuard_Factory(t) { return new (t || ProfilsGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1117
- ProfilsGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ProfilsGuard, factory: ProfilsGuard.ɵfac, providedIn: 'root' });
1118
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ProfilsGuard, [{
1119
- type: Injectable,
1120
- args: [{
1121
- providedIn: 'root'
1122
- }]
1094
+ class ProfilsGuard {
1095
+ constructor(authService, config, router) {
1096
+ this.authService = authService;
1097
+ this.config = config;
1098
+ this.router = router;
1099
+ }
1100
+ canActivate(_route, state) {
1101
+ return this.authService.getProfils().pipe(map((profils) => {
1102
+ const authConfig = this.config.getConfig('auth');
1103
+ if (profils &&
1104
+ profils.profils &&
1105
+ profils.profils.some(v => authConfig.profilsGuard.indexOf(v) !== -1)) {
1106
+ return true;
1107
+ }
1108
+ this.authService.redirectUrl = state.url;
1109
+ if (authConfig && authConfig.loginRoute) {
1110
+ this.router.navigateByUrl(authConfig.loginRoute);
1111
+ }
1112
+ return false;
1113
+ }));
1114
+ }
1115
+ }
1116
+ ProfilsGuard.ɵfac = function ProfilsGuard_Factory(t) { return new (t || ProfilsGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1117
+ ProfilsGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ProfilsGuard, factory: ProfilsGuard.ɵfac, providedIn: 'root' });
1118
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ProfilsGuard, [{
1119
+ type: Injectable,
1120
+ args: [{
1121
+ providedIn: 'root'
1122
+ }]
1123
1123
  }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router }]; }, null); })();
1124
1124
 
1125
- class AuthInterceptor {
1126
- constructor(config, tokenService, http) {
1127
- this.config = config;
1128
- this.tokenService = tokenService;
1129
- this.http = http;
1130
- this.refreshInProgress = false;
1131
- }
1132
- get trustHosts() {
1133
- const trustHosts = this.config.getConfig('auth.trustHosts') || [];
1134
- trustHosts.push(window.location.hostname);
1135
- return trustHosts;
1136
- }
1137
- get hostsWithCredentials() {
1138
- return this.config.getConfig('auth.hostsWithCredentials') || [];
1139
- }
1140
- get hostsWithAuthByKey() {
1141
- return this.config.getConfig('auth.hostsByKey') || [];
1142
- }
1143
- intercept(originalReq, next) {
1144
- const withCredentials = this.handleHostsWithCredentials(originalReq.url);
1145
- let req = originalReq.clone();
1146
- const hostWithKey = this.handleHostsAuthByKey(originalReq.url);
1147
- if (hostWithKey) {
1148
- req = req.clone({
1149
- params: req.params.set(hostWithKey.key, hostWithKey.value)
1150
- });
1151
- }
1152
- if (withCredentials) {
1153
- req = originalReq.clone({
1154
- withCredentials
1155
- });
1156
- return next.handle(req);
1157
- }
1158
- this.refreshToken();
1159
- const token = this.tokenService.get();
1160
- const element = document.createElement('a');
1161
- element.href = req.url;
1162
- if (element.host === '') {
1163
- element.href = element.href; // FIX IE11, DO NOT REMOVE
1164
- }
1165
- if (!token || this.trustHosts.indexOf(element.hostname) === -1) {
1166
- return next.handle(req);
1167
- }
1168
- const authHeader = `Bearer ${token}`;
1169
- let authReq = req.clone({
1170
- headers: req.headers.set('Authorization', authHeader)
1171
- });
1172
- const tokenDecoded = this.tokenService.decode();
1173
- if (authReq.params.get('_i') === 'true' &&
1174
- tokenDecoded &&
1175
- tokenDecoded.user &&
1176
- tokenDecoded.user.sourceId) {
1177
- const hashUser = Md5.hashStr(tokenDecoded.user.sourceId);
1178
- authReq = authReq.clone({
1179
- params: authReq.params.set('_i', hashUser)
1180
- });
1181
- }
1182
- else if (authReq.params.get('_i') === 'true') {
1183
- authReq = authReq.clone({
1184
- params: authReq.params.delete('_i')
1185
- });
1186
- }
1187
- return next.handle(authReq);
1188
- }
1189
- interceptXhr(xhr, url) {
1190
- const withCredentials = this.handleHostsWithCredentials(url);
1191
- if (withCredentials) {
1192
- xhr.withCredentials = withCredentials;
1193
- return true;
1194
- }
1195
- this.refreshToken();
1196
- const element = document.createElement('a');
1197
- element.href = url;
1198
- const token = this.tokenService.get();
1199
- if (!token || this.trustHosts.indexOf(element.hostname) === -1) {
1200
- return false;
1201
- }
1202
- xhr.setRequestHeader('Authorization', 'Bearer ' + token);
1203
- return true;
1204
- }
1205
- alterUrlWithKeyAuth(url) {
1206
- const hostWithKey = this.handleHostsAuthByKey(url);
1207
- let interceptedUrl = url;
1208
- if (hostWithKey) {
1209
- const urlDecomposed = interceptedUrl.split(/[?&]/);
1210
- let urlWithKeyAdded = urlDecomposed.shift();
1211
- const paramsToKeep = urlDecomposed.filter(p => p.length !== 0);
1212
- paramsToKeep.push(`${hostWithKey.key}=${hostWithKey.value}`);
1213
- if (paramsToKeep.length) {
1214
- urlWithKeyAdded += '?' + paramsToKeep.join('&');
1215
- }
1216
- return urlWithKeyAdded;
1217
- }
1218
- return;
1219
- }
1220
- handleHostsWithCredentials(reqUrl) {
1221
- let withCredentials = false;
1222
- for (const hostWithCredentials of this.hostsWithCredentials) {
1223
- const domainRegex = new RegExp(hostWithCredentials.domainRegFilters);
1224
- if (domainRegex.test(reqUrl)) {
1225
- withCredentials = hostWithCredentials.withCredentials !== undefined ? hostWithCredentials.withCredentials : undefined;
1226
- break;
1227
- }
1228
- }
1229
- return withCredentials;
1230
- }
1231
- handleHostsAuthByKey(reqUrl) {
1232
- let hostWithKey;
1233
- for (const hostWithAuthByKey of this.hostsWithAuthByKey) {
1234
- const domainRegex = new RegExp(hostWithAuthByKey.domainRegFilters);
1235
- if (domainRegex.test(reqUrl)) {
1236
- var replace = `${hostWithAuthByKey.keyProperty}=${hostWithAuthByKey.keyValue}`;
1237
- var keyAdded = new RegExp(replace, "gm");
1238
- if (!keyAdded.test(reqUrl)) {
1239
- hostWithKey = { key: hostWithAuthByKey.keyProperty, value: hostWithAuthByKey.keyValue };
1240
- break;
1241
- }
1242
- }
1243
- }
1244
- return hostWithKey;
1245
- }
1246
- refreshToken() {
1247
- const jwt = this.tokenService.decode();
1248
- const currentTime = new Date().getTime() / 1000;
1249
- if (!this.refreshInProgress &&
1250
- jwt &&
1251
- currentTime < jwt.exp &&
1252
- currentTime > jwt.exp - 1800) {
1253
- this.refreshInProgress = true;
1254
- const url = this.config.getConfig('auth.url');
1255
- return this.http.post(`${url}/refresh`, {}).subscribe((data) => {
1256
- this.tokenService.set(data.token);
1257
- this.refreshInProgress = false;
1258
- }, err => {
1259
- err.error.caught = true;
1260
- return err;
1261
- });
1262
- }
1263
- }
1264
- }
1265
- AuthInterceptor.ɵfac = function AuthInterceptor_Factory(t) { return new (t || AuthInterceptor)(i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(TokenService), i0.ɵɵinject(i1.HttpClient)); };
1266
- AuthInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthInterceptor, factory: AuthInterceptor.ɵfac, providedIn: 'root' });
1267
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthInterceptor, [{
1268
- type: Injectable,
1269
- args: [{
1270
- providedIn: 'root'
1271
- }]
1125
+ class AuthInterceptor {
1126
+ constructor(config, tokenService, http) {
1127
+ this.config = config;
1128
+ this.tokenService = tokenService;
1129
+ this.http = http;
1130
+ this.refreshInProgress = false;
1131
+ }
1132
+ get trustHosts() {
1133
+ const trustHosts = this.config.getConfig('auth.trustHosts') || [];
1134
+ trustHosts.push(window.location.hostname);
1135
+ return trustHosts;
1136
+ }
1137
+ get hostsWithCredentials() {
1138
+ return this.config.getConfig('auth.hostsWithCredentials') || [];
1139
+ }
1140
+ get hostsWithAuthByKey() {
1141
+ return this.config.getConfig('auth.hostsByKey') || [];
1142
+ }
1143
+ intercept(originalReq, next) {
1144
+ const withCredentials = this.handleHostsWithCredentials(originalReq.url);
1145
+ let req = originalReq.clone();
1146
+ const hostWithKey = this.handleHostsAuthByKey(originalReq.url);
1147
+ if (hostWithKey) {
1148
+ req = req.clone({
1149
+ params: req.params.set(hostWithKey.key, hostWithKey.value)
1150
+ });
1151
+ }
1152
+ if (withCredentials) {
1153
+ req = originalReq.clone({
1154
+ withCredentials
1155
+ });
1156
+ return next.handle(req);
1157
+ }
1158
+ this.refreshToken();
1159
+ const token = this.tokenService.get();
1160
+ const element = document.createElement('a');
1161
+ element.href = req.url;
1162
+ if (element.host === '') {
1163
+ element.href = element.href; // FIX IE11, DO NOT REMOVE
1164
+ }
1165
+ if (!token || this.trustHosts.indexOf(element.hostname) === -1) {
1166
+ return next.handle(req);
1167
+ }
1168
+ const authHeader = `Bearer ${token}`;
1169
+ let authReq = req.clone({
1170
+ headers: req.headers.set('Authorization', authHeader)
1171
+ });
1172
+ const tokenDecoded = this.tokenService.decode();
1173
+ if (authReq.params.get('_i') === 'true' &&
1174
+ tokenDecoded &&
1175
+ tokenDecoded.user &&
1176
+ tokenDecoded.user.sourceId) {
1177
+ const hashUser = Md5.hashStr(tokenDecoded.user.sourceId);
1178
+ authReq = authReq.clone({
1179
+ params: authReq.params.set('_i', hashUser)
1180
+ });
1181
+ }
1182
+ else if (authReq.params.get('_i') === 'true') {
1183
+ authReq = authReq.clone({
1184
+ params: authReq.params.delete('_i')
1185
+ });
1186
+ }
1187
+ return next.handle(authReq);
1188
+ }
1189
+ interceptXhr(xhr, url) {
1190
+ const withCredentials = this.handleHostsWithCredentials(url);
1191
+ if (withCredentials) {
1192
+ xhr.withCredentials = withCredentials;
1193
+ return true;
1194
+ }
1195
+ this.refreshToken();
1196
+ const element = document.createElement('a');
1197
+ element.href = url;
1198
+ const token = this.tokenService.get();
1199
+ if (!token || this.trustHosts.indexOf(element.hostname) === -1) {
1200
+ return false;
1201
+ }
1202
+ xhr.setRequestHeader('Authorization', 'Bearer ' + token);
1203
+ return true;
1204
+ }
1205
+ alterUrlWithKeyAuth(url) {
1206
+ const hostWithKey = this.handleHostsAuthByKey(url);
1207
+ let interceptedUrl = url;
1208
+ if (hostWithKey) {
1209
+ const urlDecomposed = interceptedUrl.split(/[?&]/);
1210
+ let urlWithKeyAdded = urlDecomposed.shift();
1211
+ const paramsToKeep = urlDecomposed.filter(p => p.length !== 0);
1212
+ paramsToKeep.push(`${hostWithKey.key}=${hostWithKey.value}`);
1213
+ if (paramsToKeep.length) {
1214
+ urlWithKeyAdded += '?' + paramsToKeep.join('&');
1215
+ }
1216
+ return urlWithKeyAdded;
1217
+ }
1218
+ return;
1219
+ }
1220
+ handleHostsWithCredentials(reqUrl) {
1221
+ let withCredentials = false;
1222
+ for (const hostWithCredentials of this.hostsWithCredentials) {
1223
+ const domainRegex = new RegExp(hostWithCredentials.domainRegFilters);
1224
+ if (domainRegex.test(reqUrl)) {
1225
+ withCredentials = hostWithCredentials.withCredentials !== undefined ? hostWithCredentials.withCredentials : undefined;
1226
+ break;
1227
+ }
1228
+ }
1229
+ return withCredentials;
1230
+ }
1231
+ handleHostsAuthByKey(reqUrl) {
1232
+ let hostWithKey;
1233
+ for (const hostWithAuthByKey of this.hostsWithAuthByKey) {
1234
+ const domainRegex = new RegExp(hostWithAuthByKey.domainRegFilters);
1235
+ if (domainRegex.test(reqUrl)) {
1236
+ var replace = `${hostWithAuthByKey.keyProperty}=${hostWithAuthByKey.keyValue}`;
1237
+ var keyAdded = new RegExp(replace, "gm");
1238
+ if (!keyAdded.test(reqUrl)) {
1239
+ hostWithKey = { key: hostWithAuthByKey.keyProperty, value: hostWithAuthByKey.keyValue };
1240
+ break;
1241
+ }
1242
+ }
1243
+ }
1244
+ return hostWithKey;
1245
+ }
1246
+ refreshToken() {
1247
+ const jwt = this.tokenService.decode();
1248
+ const currentTime = new Date().getTime() / 1000;
1249
+ if (!this.refreshInProgress &&
1250
+ jwt &&
1251
+ currentTime < jwt.exp &&
1252
+ currentTime > jwt.exp - 1800) {
1253
+ this.refreshInProgress = true;
1254
+ const url = this.config.getConfig('auth.url');
1255
+ return this.http.post(`${url}/refresh`, {}).subscribe((data) => {
1256
+ this.tokenService.set(data.token);
1257
+ this.refreshInProgress = false;
1258
+ }, err => {
1259
+ err.error.caught = true;
1260
+ return err;
1261
+ });
1262
+ }
1263
+ }
1264
+ }
1265
+ AuthInterceptor.ɵfac = function AuthInterceptor_Factory(t) { return new (t || AuthInterceptor)(i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(TokenService), i0.ɵɵinject(i1.HttpClient)); };
1266
+ AuthInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthInterceptor, factory: AuthInterceptor.ɵfac, providedIn: 'root' });
1267
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthInterceptor, [{
1268
+ type: Injectable,
1269
+ args: [{
1270
+ providedIn: 'root'
1271
+ }]
1272
1272
  }], function () { return [{ type: i2.ConfigService }, { type: TokenService }, { type: i1.HttpClient }]; }, null); })();
1273
1273
 
1274
- function MSALConfigFactory(config) {
1275
- const msConf = config.getConfig('auth.microsoft') || {};
1276
- msConf.redirectUri = msConf.redirectUri || window.location.href;
1277
- msConf.authority = msConf.authority || 'https://login.microsoftonline.com/organizations';
1278
- const myMsalObj = new PublicClientApplication({
1279
- auth: msConf,
1280
- cache: {
1281
- cacheLocation: 'sessionStorage'
1282
- }
1283
- });
1284
- return myMsalObj;
1285
- }
1286
- function MSALConfigFactoryb2c(config) {
1287
- const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions') || {};
1288
- msConf.redirectUri = msConf.redirectUri || window.location.href;
1289
- msConf.authority = msConf.authority || 'https://login.microsoftonline.com/organizations';
1290
- const myMsalObj = new PublicClientApplication({
1291
- auth: msConf,
1292
- cache: {
1293
- cacheLocation: 'sessionStorage'
1294
- }
1295
- });
1296
- return myMsalObj;
1297
- }
1298
- function MSALAngularConfigFactory(config) {
1299
- const msConf = config.getConfig('auth.microsoft') || {};
1300
- return {
1301
- interactionType: InteractionType.Popup,
1302
- authRequest: {
1303
- scopes: ['user.read'],
1304
- loginHint: 'todo',
1305
- },
1306
- type: 'add'
1307
- };
1308
- }
1309
- function MSALAngularConfigFactoryb2c(config) {
1310
- const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions') || {};
1311
- return {
1312
- interactionType: InteractionType.Popup,
1313
- authRequest: {
1314
- scopes: [msConf.clientId]
1315
- },
1316
- type: 'b2c'
1317
- };
1318
- }
1319
- function provideAuthMicrosoft(type) {
1320
- if (type === 'b2c') {
1321
- return [
1322
- {
1323
- provide: MSAL_INSTANCE,
1324
- useFactory: MSALConfigFactoryb2c,
1325
- deps: [ConfigService]
1326
- },
1327
- {
1328
- provide: MSAL_GUARD_CONFIG,
1329
- useFactory: MSALAngularConfigFactoryb2c,
1330
- deps: [ConfigService],
1331
- multi: true
1332
- },
1333
- MsalServiceb2c
1334
- ];
1335
- }
1336
- else {
1337
- return [
1338
- {
1339
- provide: MSAL_INSTANCE,
1340
- useFactory: MSALConfigFactory,
1341
- deps: [ConfigService]
1342
- },
1343
- {
1344
- provide: MSAL_GUARD_CONFIG,
1345
- useFactory: MSALAngularConfigFactory,
1346
- deps: [ConfigService],
1347
- multi: true
1348
- },
1349
- MsalService
1350
- ];
1351
- }
1274
+ function MSALConfigFactory(config) {
1275
+ const msConf = config.getConfig('auth.microsoft') || {};
1276
+ msConf.redirectUri = msConf.redirectUri || window.location.href;
1277
+ msConf.authority = msConf.authority || 'https://login.microsoftonline.com/organizations';
1278
+ const myMsalObj = new PublicClientApplication({
1279
+ auth: msConf,
1280
+ cache: {
1281
+ cacheLocation: 'sessionStorage'
1282
+ }
1283
+ });
1284
+ return myMsalObj;
1285
+ }
1286
+ function MSALConfigFactoryb2c(config) {
1287
+ const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions') || {};
1288
+ msConf.redirectUri = msConf.redirectUri || window.location.href;
1289
+ msConf.authority = msConf.authority || 'https://login.microsoftonline.com/organizations';
1290
+ const myMsalObj = new PublicClientApplication({
1291
+ auth: msConf,
1292
+ cache: {
1293
+ cacheLocation: 'sessionStorage'
1294
+ }
1295
+ });
1296
+ return myMsalObj;
1297
+ }
1298
+ function MSALAngularConfigFactory(config) {
1299
+ const msConf = config.getConfig('auth.microsoft') || {};
1300
+ return {
1301
+ interactionType: InteractionType.Popup,
1302
+ authRequest: {
1303
+ scopes: ['user.read'],
1304
+ loginHint: 'todo',
1305
+ },
1306
+ type: 'add'
1307
+ };
1308
+ }
1309
+ function MSALAngularConfigFactoryb2c(config) {
1310
+ const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions') || {};
1311
+ return {
1312
+ interactionType: InteractionType.Popup,
1313
+ authRequest: {
1314
+ scopes: [msConf.clientId]
1315
+ },
1316
+ type: 'b2c'
1317
+ };
1318
+ }
1319
+ function provideAuthMicrosoft(type) {
1320
+ if (type === 'b2c') {
1321
+ return [
1322
+ {
1323
+ provide: MSAL_INSTANCE,
1324
+ useFactory: MSALConfigFactoryb2c,
1325
+ deps: [ConfigService]
1326
+ },
1327
+ {
1328
+ provide: MSAL_GUARD_CONFIG,
1329
+ useFactory: MSALAngularConfigFactoryb2c,
1330
+ deps: [ConfigService],
1331
+ multi: true
1332
+ },
1333
+ MsalServiceb2c
1334
+ ];
1335
+ }
1336
+ else {
1337
+ return [
1338
+ {
1339
+ provide: MSAL_INSTANCE,
1340
+ useFactory: MSALConfigFactory,
1341
+ deps: [ConfigService]
1342
+ },
1343
+ {
1344
+ provide: MSAL_GUARD_CONFIG,
1345
+ useFactory: MSALAngularConfigFactory,
1346
+ deps: [ConfigService],
1347
+ multi: true
1348
+ },
1349
+ MsalService
1350
+ ];
1351
+ }
1352
1352
  }
1353
1353
 
1354
- class ProtectedDirective {
1355
- constructor(authentication, el) {
1356
- if (!authentication.isAuthenticated()) {
1357
- el.nativeElement.parentNode.removeChild(el.nativeElement);
1358
- }
1359
- }
1360
- }
1361
- ProtectedDirective.ɵfac = function ProtectedDirective_Factory(t) { return new (t || ProtectedDirective)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
1362
- ProtectedDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ProtectedDirective, selectors: [["", "igoProtected", ""]] });
1363
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ProtectedDirective, [{
1364
- type: Directive,
1365
- args: [{
1366
- selector: '[igoProtected]'
1367
- }]
1354
+ class ProtectedDirective {
1355
+ constructor(authentication, el) {
1356
+ if (!authentication.isAuthenticated()) {
1357
+ el.nativeElement.parentNode.removeChild(el.nativeElement);
1358
+ }
1359
+ }
1360
+ }
1361
+ ProtectedDirective.ɵfac = function ProtectedDirective_Factory(t) { return new (t || ProtectedDirective)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
1362
+ ProtectedDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ProtectedDirective, selectors: [["", "igoProtected", ""]] });
1363
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ProtectedDirective, [{
1364
+ type: Directive,
1365
+ args: [{
1366
+ selector: '[igoProtected]'
1367
+ }]
1368
1368
  }], function () { return [{ type: AuthService }, { type: i0.ElementRef }]; }, null); })();
1369
1369
 
1370
- class AuthStorageService extends StorageService {
1371
- constructor(config, http, authService, tokenService) {
1372
- super(config);
1373
- this.http = http;
1374
- this.authService = authService;
1375
- this.tokenService = tokenService;
1376
- this.authService.authenticate$.subscribe(isAuthenticated => {
1377
- if (isAuthenticated && this.options.url) {
1378
- this.http
1379
- .get(this.options.url)
1380
- .subscribe((userIgo) => {
1381
- if (userIgo && userIgo.preference) {
1382
- for (const key of Object.keys(userIgo.preference)) {
1383
- const value = userIgo.preference[key];
1384
- super.set(key, value);
1385
- }
1386
- }
1387
- });
1388
- }
1389
- });
1390
- }
1391
- set(key, value, scope = StorageScope.LOCAL) {
1392
- if (scope === StorageScope.LOCAL &&
1393
- this.authService.authenticated &&
1394
- this.options.url) {
1395
- const preference = {};
1396
- preference[key] = value;
1397
- this.http.patch(this.options.url, { preference }).subscribe();
1398
- }
1399
- super.set(key, value, scope);
1400
- }
1401
- remove(key, scope = StorageScope.LOCAL) {
1402
- if (scope === StorageScope.LOCAL &&
1403
- this.authService.authenticated &&
1404
- this.options.url) {
1405
- const preference = {};
1406
- preference[key] = undefined;
1407
- this.http.patch(this.options.url, { preference }).subscribe();
1408
- }
1409
- super.remove(key, scope);
1410
- }
1411
- clear(scope = StorageScope.LOCAL) {
1412
- if (scope === StorageScope.LOCAL &&
1413
- this.authService.authenticated &&
1414
- this.options.url) {
1415
- this.http.patch(this.options.url, { preference: {} }, {
1416
- params: {
1417
- mergePreference: 'false'
1418
- }
1419
- }).subscribe();
1420
- }
1421
- let token;
1422
- if (scope === StorageScope.LOCAL) {
1423
- token = this.tokenService.get();
1424
- }
1425
- super.clear(scope);
1426
- if (token) {
1427
- this.tokenService.set(token);
1428
- }
1429
- if (scope === StorageScope.LOCAL &&
1430
- this.authService.authenticated &&
1431
- this.options.url) {
1432
- this.http
1433
- .get(this.options.url)
1434
- .subscribe((userIgo) => {
1435
- if (userIgo && userIgo.preference) {
1436
- for (const key of Object.keys(userIgo.preference)) {
1437
- const value = userIgo.preference[key];
1438
- super.set(key, value);
1439
- }
1440
- }
1441
- });
1442
- }
1443
- }
1444
- }
1445
- AuthStorageService.ɵfac = function AuthStorageService_Factory(t) { return new (t || AuthStorageService)(i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(AuthService), i0.ɵɵinject(TokenService)); };
1446
- AuthStorageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthStorageService, factory: AuthStorageService.ɵfac, providedIn: 'root' });
1447
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthStorageService, [{
1448
- type: Injectable,
1449
- args: [{
1450
- providedIn: 'root'
1451
- }]
1370
+ class AuthStorageService extends StorageService {
1371
+ constructor(config, http, authService, tokenService) {
1372
+ super(config);
1373
+ this.http = http;
1374
+ this.authService = authService;
1375
+ this.tokenService = tokenService;
1376
+ this.authService.authenticate$.subscribe(isAuthenticated => {
1377
+ if (isAuthenticated && this.options.url) {
1378
+ this.http
1379
+ .get(this.options.url)
1380
+ .subscribe((userIgo) => {
1381
+ if (userIgo && userIgo.preference) {
1382
+ for (const key of Object.keys(userIgo.preference)) {
1383
+ const value = userIgo.preference[key];
1384
+ super.set(key, value);
1385
+ }
1386
+ }
1387
+ });
1388
+ }
1389
+ });
1390
+ }
1391
+ set(key, value, scope = StorageScope.LOCAL) {
1392
+ if (scope === StorageScope.LOCAL &&
1393
+ this.authService.authenticated &&
1394
+ this.options.url) {
1395
+ const preference = {};
1396
+ preference[key] = value;
1397
+ this.http.patch(this.options.url, { preference }).subscribe();
1398
+ }
1399
+ super.set(key, value, scope);
1400
+ }
1401
+ remove(key, scope = StorageScope.LOCAL) {
1402
+ if (scope === StorageScope.LOCAL &&
1403
+ this.authService.authenticated &&
1404
+ this.options.url) {
1405
+ const preference = {};
1406
+ preference[key] = undefined;
1407
+ this.http.patch(this.options.url, { preference }).subscribe();
1408
+ }
1409
+ super.remove(key, scope);
1410
+ }
1411
+ clear(scope = StorageScope.LOCAL) {
1412
+ if (scope === StorageScope.LOCAL &&
1413
+ this.authService.authenticated &&
1414
+ this.options.url) {
1415
+ this.http.patch(this.options.url, { preference: {} }, {
1416
+ params: {
1417
+ mergePreference: 'false'
1418
+ }
1419
+ }).subscribe();
1420
+ }
1421
+ let token;
1422
+ if (scope === StorageScope.LOCAL) {
1423
+ token = this.tokenService.get();
1424
+ }
1425
+ super.clear(scope);
1426
+ if (token) {
1427
+ this.tokenService.set(token);
1428
+ }
1429
+ if (scope === StorageScope.LOCAL &&
1430
+ this.authService.authenticated &&
1431
+ this.options.url) {
1432
+ this.http
1433
+ .get(this.options.url)
1434
+ .subscribe((userIgo) => {
1435
+ if (userIgo && userIgo.preference) {
1436
+ for (const key of Object.keys(userIgo.preference)) {
1437
+ const value = userIgo.preference[key];
1438
+ super.set(key, value);
1439
+ }
1440
+ }
1441
+ });
1442
+ }
1443
+ }
1444
+ }
1445
+ AuthStorageService.ɵfac = function AuthStorageService_Factory(t) { return new (t || AuthStorageService)(i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(AuthService), i0.ɵɵinject(TokenService)); };
1446
+ AuthStorageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthStorageService, factory: AuthStorageService.ɵfac, providedIn: 'root' });
1447
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthStorageService, [{
1448
+ type: Injectable,
1449
+ args: [{
1450
+ providedIn: 'root'
1451
+ }]
1452
1452
  }], function () { return [{ type: i2.ConfigService }, { type: i1.HttpClient }, { type: AuthService }, { type: TokenService }]; }, null); })();
1453
1453
 
1454
- const routes = [
1455
- { path: 'login', component: AuthFormComponent },
1456
- { path: 'logout', component: AuthFormComponent }
1457
- ];
1458
- class AuthRoutingModule {
1459
- }
1460
- AuthRoutingModule.ɵfac = function AuthRoutingModule_Factory(t) { return new (t || AuthRoutingModule)(); };
1461
- AuthRoutingModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AuthRoutingModule });
1462
- AuthRoutingModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [RouterModule.forChild(routes), RouterModule] });
1463
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthRoutingModule, [{
1464
- type: NgModule,
1465
- args: [{
1466
- imports: [RouterModule.forChild(routes)],
1467
- exports: [RouterModule],
1468
- providers: []
1469
- }]
1470
- }], null, null); })();
1454
+ const routes = [
1455
+ { path: 'login', component: AuthFormComponent },
1456
+ { path: 'logout', component: AuthFormComponent }
1457
+ ];
1458
+ class AuthRoutingModule {
1459
+ }
1460
+ AuthRoutingModule.ɵfac = function AuthRoutingModule_Factory(t) { return new (t || AuthRoutingModule)(); };
1461
+ AuthRoutingModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AuthRoutingModule });
1462
+ AuthRoutingModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [RouterModule.forChild(routes), RouterModule] });
1463
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthRoutingModule, [{
1464
+ type: NgModule,
1465
+ args: [{
1466
+ imports: [RouterModule.forChild(routes)],
1467
+ exports: [RouterModule],
1468
+ providers: []
1469
+ }]
1470
+ }], null, null); })();
1471
1471
  (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AuthRoutingModule, { imports: [i3.RouterModule], exports: [RouterModule] }); })();
1472
1472
 
1473
- class IgoAuthModule {
1474
- static forRoot() {
1475
- return {
1476
- ngModule: IgoAuthModule,
1477
- providers: [
1478
- {
1479
- provide: HTTP_INTERCEPTORS,
1480
- useClass: AuthInterceptor,
1481
- multi: true
1482
- },
1483
- {
1484
- provide: StorageService,
1485
- useClass: AuthStorageService
1486
- },
1487
- ...provideAuthMicrosoft('add'),
1488
- ...provideAuthMicrosoft('b2c')
1489
- ]
1490
- };
1491
- }
1492
- }
1493
- IgoAuthModule.ɵfac = function IgoAuthModule_Factory(t) { return new (t || IgoAuthModule)(); };
1494
- IgoAuthModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoAuthModule });
1495
- IgoAuthModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
1496
- ReactiveFormsModule,
1497
- MatFormFieldModule,
1498
- MatInputModule,
1499
- MatIconModule,
1500
- MatButtonModule,
1501
- IgoLanguageModule,
1502
- MsalModule] });
1503
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoAuthModule, [{
1504
- type: NgModule,
1505
- args: [{
1506
- imports: [
1507
- CommonModule,
1508
- ReactiveFormsModule,
1509
- MatFormFieldModule,
1510
- MatInputModule,
1511
- MatIconModule,
1512
- MatButtonModule,
1513
- IgoLanguageModule,
1514
- MsalModule
1515
- ],
1516
- declarations: [
1517
- AuthFormComponent,
1518
- AuthGoogleComponent,
1519
- AuthInternComponent,
1520
- AuthFacebookComponent,
1521
- AuthMicrosoftComponent,
1522
- AuthMicrosoftb2cComponent,
1523
- ProtectedDirective
1524
- ],
1525
- exports: [AuthFormComponent, ProtectedDirective]
1526
- }]
1527
- }], null, null); })();
1528
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoAuthModule, { declarations: [AuthFormComponent,
1529
- AuthGoogleComponent,
1530
- AuthInternComponent,
1531
- AuthFacebookComponent,
1532
- AuthMicrosoftComponent,
1533
- AuthMicrosoftb2cComponent,
1534
- ProtectedDirective], imports: [CommonModule,
1535
- ReactiveFormsModule,
1536
- MatFormFieldModule,
1537
- MatInputModule,
1538
- MatIconModule,
1539
- MatButtonModule,
1540
- IgoLanguageModule,
1473
+ class IgoAuthModule {
1474
+ static forRoot() {
1475
+ return {
1476
+ ngModule: IgoAuthModule,
1477
+ providers: [
1478
+ {
1479
+ provide: HTTP_INTERCEPTORS,
1480
+ useClass: AuthInterceptor,
1481
+ multi: true
1482
+ },
1483
+ {
1484
+ provide: StorageService,
1485
+ useClass: AuthStorageService
1486
+ },
1487
+ ...provideAuthMicrosoft('add'),
1488
+ ...provideAuthMicrosoft('b2c')
1489
+ ]
1490
+ };
1491
+ }
1492
+ }
1493
+ IgoAuthModule.ɵfac = function IgoAuthModule_Factory(t) { return new (t || IgoAuthModule)(); };
1494
+ IgoAuthModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoAuthModule });
1495
+ IgoAuthModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
1496
+ ReactiveFormsModule,
1497
+ MatFormFieldModule,
1498
+ MatInputModule,
1499
+ MatIconModule,
1500
+ MatButtonModule,
1501
+ IgoLanguageModule,
1502
+ MsalModule] });
1503
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoAuthModule, [{
1504
+ type: NgModule,
1505
+ args: [{
1506
+ imports: [
1507
+ CommonModule,
1508
+ ReactiveFormsModule,
1509
+ MatFormFieldModule,
1510
+ MatInputModule,
1511
+ MatIconModule,
1512
+ MatButtonModule,
1513
+ IgoLanguageModule,
1514
+ MsalModule
1515
+ ],
1516
+ declarations: [
1517
+ AuthFormComponent,
1518
+ AuthGoogleComponent,
1519
+ AuthInternComponent,
1520
+ AuthFacebookComponent,
1521
+ AuthMicrosoftComponent,
1522
+ AuthMicrosoftb2cComponent,
1523
+ ProtectedDirective
1524
+ ],
1525
+ exports: [AuthFormComponent, ProtectedDirective]
1526
+ }]
1527
+ }], null, null); })();
1528
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoAuthModule, { declarations: [AuthFormComponent,
1529
+ AuthGoogleComponent,
1530
+ AuthInternComponent,
1531
+ AuthFacebookComponent,
1532
+ AuthMicrosoftComponent,
1533
+ AuthMicrosoftb2cComponent,
1534
+ ProtectedDirective], imports: [CommonModule,
1535
+ ReactiveFormsModule,
1536
+ MatFormFieldModule,
1537
+ MatInputModule,
1538
+ MatIconModule,
1539
+ MatButtonModule,
1540
+ IgoLanguageModule,
1541
1541
  MsalModule], exports: [AuthFormComponent, ProtectedDirective] }); })();
1542
1542
 
1543
- /*
1544
- * Public API Surface of auth
1543
+ /*
1544
+ * Public API Surface of auth
1545
1545
  */
1546
1546
 
1547
- /**
1548
- * Generated bundle index. Do not edit.
1547
+ /**
1548
+ * Generated bundle index. Do not edit.
1549
1549
  */
1550
1550
 
1551
1551
  export { AdminGuard, AuthFormComponent, AuthGuard, AuthInterceptor, AuthRoutingModule, AuthService, AuthStorageService, IgoAuthModule, LoggedGuard, MSALAngularConfigFactory, MSALAngularConfigFactoryb2c, MSALConfigFactory, MSALConfigFactoryb2c, ProfilsGuard, ProtectedDirective, TokenService, provideAuthMicrosoft };